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