当前位置: 首页>>代码示例>>Java>>正文


Java Vector3D.PLUS_I属性代码示例

本文整理汇总了Java中org.apache.commons.math3.geometry.euclidean.threed.Vector3D.PLUS_I属性的典型用法代码示例。如果您正苦于以下问题:Java Vector3D.PLUS_I属性的具体用法?Java Vector3D.PLUS_I怎么用?Java Vector3D.PLUS_I使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.math3.geometry.euclidean.threed.Vector3D的用法示例。


在下文中一共展示了Vector3D.PLUS_I属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transformNode

private void transformNode(SceneNode sceneNode) {
    if (sceneNode.getModel() == null) return;

    Rotation xRot = new Rotation(Vector3D.PLUS_I, 0);
    Rotation yRot = new Rotation(Vector3D.PLUS_J, 0);
    Rotation zRot = new Rotation(Vector3D.PLUS_K, 0);

    Vector3D modelTranslation = sceneNode.getModel().getTranslation();
    Vector3D modelScaling = sceneNode.getModel().getScale();

    System.out.println("Scale: " + modelScaling);
    System.out.println("Translation: " + modelTranslation);
    System.out.println("Rotation: " + sceneNode.getModel().getRotation());

    /*xRot = new Rotation(Vector3D.PLUS_I, value.getX());
    yRot = new Rotation(Vector3D.PLUS_J, value.getY());
    zRot = new Rotation(Vector3D.PLUS_K, value.getZ());*/

    sceneNode.getTransform().setTranslation(modelTranslation);

    sceneNode.getTransform().rotate(xRot);
    sceneNode.getTransform().rotate(yRot);
    sceneNode.getTransform().rotate(zRot);
}
 
开发者ID:plushmonkey,项目名称:modelviewer,代码行数:24,代码来源:FBXSceneCreator.java

示例2: handleRotate

private void handleRotate(CommandSender commandSender, String[] args) {
    if (args.length != 3) {
        commandSender.sendMessage("/model rotate [axis-XYZ] [degrees] (bad arg count)");
        return;
    }

    BukkitSceneView view = history.get(commandSender.getName());
    if (view == null) {
        commandSender.sendMessage("No models to rotate");
        return;
    }

    if (!(commandSender instanceof Player))
        return;

    String axisStr = args[1];
    Vector3D axis = null;

    if (axisStr.equalsIgnoreCase("x")) {
        axis = Vector3D.PLUS_I;
    } else if (axisStr.equalsIgnoreCase("y")) {
        axis = Vector3D.PLUS_J;
    } else if (axisStr.equalsIgnoreCase("z")) {
        axis = Vector3D.PLUS_K;
    }

    if (axis == null) {
        commandSender.sendMessage("/model rotate [axis-XYZ] [degrees] (axis null)");
        return;
    }

    int degrees;

    try {
        degrees = Integer.parseInt(args[2]);
    } catch (NumberFormatException e) {
        commandSender.sendMessage("/model rotate [axis-XYZ] [degrees] (bad number format)");
        return;
    }

    double rot = Math.toRadians(degrees);

    view.getScene().getTransform().rotate(new Rotation(axis, rot));

    view.clear();
    Player player = (Player)commandSender;
    view.render(player.getWorld(), () -> {
        commandSender.sendMessage("Model rotated. (" + view.getBlockCount() + " blocks)");
    });
}
 
开发者ID:plushmonkey,项目名称:modelviewer,代码行数:50,代码来源:ModelCommand.java


注:本文中的org.apache.commons.math3.geometry.euclidean.threed.Vector3D.PLUS_I属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。