本文整理匯總了Java中javafx.scene.transform.Rotate.X_AXIS屬性的典型用法代碼示例。如果您正苦於以下問題:Java Rotate.X_AXIS屬性的具體用法?Java Rotate.X_AXIS怎麽用?Java Rotate.X_AXIS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javafx.scene.transform.Rotate
的用法示例。
在下文中一共展示了Rotate.X_AXIS屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: FlipPanel
public FlipPanel(final Orientation FLIP_DIRECTION) {
rotate = new Rotate(0, Rotate.Y_AXIS);
getTransforms().add(rotate);
backRotate = new Rotate(180, Orientation.HORIZONTAL == FLIP_DIRECTION ? Rotate.Y_AXIS : Rotate.X_AXIS);
front = new StackPane();
back = new StackPane();
back.setVisible(false);
getChildren().setAll(back, front);
flipToFront = new Timeline();
flipToBack = new Timeline();
flipTime = 700;
flipDirection = FLIP_DIRECTION;
registerListeners();
}
示例2: rotate3Dto
private void rotate3Dto(Shape3D shape, float tx, float ty, float tz){
if (rotationToInProgress){
return;
}
//System.out.printf("rotate3Dto:%s %f | %f | %f\n", shape.getId(), tx, ty, tz);
rotationToInProgress = true;
Rotate rxBox = new Rotate(0, 0, 0, 0, Rotate.X_AXIS);
Rotate ryBox = new Rotate(0, 0, 0, 0, Rotate.Y_AXIS);
Rotate rzBox = new Rotate(0, 0, 0, 0, Rotate.Z_AXIS);
float rx = tx - originX;
float ry = ty - originY;
float rz = tz - originZ;
rxBox.setAngle(rx);
ryBox.setAngle(ry);
rzBox.setAngle(rz);
shape.getTransforms().addAll(rxBox, ryBox, rzBox);
originX = tx;
originY = ty;
originZ = tz;
rotationToInProgress = false;
}
示例3: rotate3D
private void rotate3D(Group shape, float rx, float ry, float rz){
if (rotationInProgress){
return;
}
//System.out.printf("rotate3D:%s %f | %f | %f\n", shape.getId(), rx, ry, rz);
rotationInProgress = true;
Rotate rxBox = new Rotate(0, 0, 0, 0, Rotate.X_AXIS);
Rotate ryBox = new Rotate(0, 0, 0, 0, Rotate.Y_AXIS);
Rotate rzBox = new Rotate(0, 0, 0, 0, Rotate.Z_AXIS);
rxBox.setAngle(rx);
ryBox.setAngle(ry);
rzBox.setAngle(rz);
shape.getTransforms().addAll(rxBox, ryBox, rzBox);
rotationInProgress = false;
}
示例4: Transformations
/**
* Constructs a Transformation with a node
* @since v0.4
*
* @param object the node we add transformation getters
* @see Node
*/
public Transformations(Node object)
{
double pivotX = object.getBoundsInLocal().getWidth()/2;
double pivotY = object.getBoundsInLocal().getHeight()/2;
double pivotZ = object.getBoundsInLocal().getDepth()/2;
rotateX = new Rotate(0, pivotX, pivotY, pivotZ, Rotate.X_AXIS);
rotateY = new Rotate(0, pivotX, pivotY, pivotZ, Rotate.Y_AXIS);
rotateZ = new Rotate(0, pivotX, pivotY, pivotZ, Rotate.Z_AXIS);
incline = new Rotate(0, pivotX, object.getBoundsInLocal().getDepth(), pivotZ, Rotate.Y_AXIS);
translate = new Translate(0,0,0);
object.getTransforms().addAll(translate, incline, rotateX, rotateY, rotateZ); //The order of adding the transformations is important !
}
示例5: messageArrived
@SuppressWarnings("boxing")
@Override
public void messageArrived(String topic, MqttMessage message) {
System.out.println("messageArrived(" + topic + ")");
ByteBuffer buffer = ByteBuffer.wrap(message.getPayload());
double[] compass = new double[] { buffer.getDouble(), buffer.getDouble(), buffer.getDouble() };
double[] accel = new double[] { buffer.getDouble(), buffer.getDouble(), buffer.getDouble() };
double[] gyro = new double[] { buffer.getDouble(), buffer.getDouble(), buffer.getDouble() };
double[] quat = new double[] { buffer.getDouble(), buffer.getDouble(), buffer.getDouble(), buffer.getDouble() };
double[] ypr = new double[] { buffer.getDouble(), buffer.getDouble(), buffer.getDouble() };
double w = quat[QUAT_SCALER];
double x = quat[QUAT_X];
double y = quat[QUAT_Y];
double z = quat[QUAT_Z];
System.out.format("Got IMU data: compass=[%f, %f, %f], accel=[%f, %f, %f], "
+ "gyro=[%f, %f, %f], quat=[%f, %f, %f, %f], ypr=[%f, %f, %f]%n",
compass[0], compass[1], compass[2], accel[0], accel[1], accel[2],
gyro[0], gyro[1], gyro[2], quat[0], quat[1], quat[2], quat[3], ypr[0], ypr[1], ypr[2]);
Rotate rx = new Rotate(Math.toDegrees(ypr[0]), Rotate.X_AXIS);
Rotate ry = new Rotate(Math.toDegrees(ypr[1]), Rotate.Y_AXIS);
Rotate rz = new Rotate(Math.toDegrees(ypr[2]), Rotate.Z_AXIS);
double[] idt = { 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 };
Affine matrix = new Affine(idt, MatrixType.MT_3D_3x4, 0);
// http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54
matrix.setMxx(1 - (2*y*y + 2*z*z)); matrix.setMxy(2*x*y + 2*z*w); matrix.setMxz(2*x*z - 2*y*w);
matrix.setMyx(2*x*y - 2*z*w); matrix.setMyy(1 - (2*x*x + 2*z*z)); matrix.setMyz(2*y*z + 2*x*w);
matrix.setMzx(2*x*z + 2*y*w); matrix.setMzy(2*y*z - 2*x*w); matrix.setMzz(1 - (2*x*x + 2*y*y));
if (! Platform.isFxApplicationThread()) {
Platform.runLater(() -> {
testObject.getTransforms().setAll(matrix);
//testObject.getTransforms().clear();
//testObject.getTransforms().addAll(rx, ry, rz);
}
);
}
}
示例6: aBunchOfCapsules
protected static Group aBunchOfCapsules() {
Group capsuleGroup = new Group();
for(int i = 0; i < 50; i++) {
Random r = new Random();
float randomRadius = (float) ((r.nextFloat() * 100) + 25);
float randomHeight = (float) ((r.nextFloat() * 300) + 75);
Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
Capsule cap = new Capsule(randomRadius, randomHeight, randomColor);
cap.setEmissiveLightingColor(randomColor);
cap.setEmissiveLightingOn(r.nextBoolean());
cap.setDrawMode(r.nextBoolean() ? DrawMode.FILL : DrawMode.LINE);
double translationX = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationX *= -1;
}
double translationY = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationY *= -1;
}
double translationZ = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationZ *= -1;
}
Translate translate = new Translate(translationX, translationY, translationZ);
Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);
cap.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
capsuleGroup.getChildren().add(cap);
}
return capsuleGroup;
}
示例7: aBunchOfCones
protected static Group aBunchOfCones() {
Group coneGroup = new Group();
for (int i = 0; i < 100; i++) {
Random r = new Random();
//A lot of magic numbers in here that just artificially constrain the math
float randomRadius = (float) ((r.nextFloat()*100) + 25);
float randomHeight = (float) ((r.nextFloat()*300)+ 75);
int randomDivisions = (int) ((r.nextFloat()*50) + 5);
Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
Cone cone = new Cone(randomDivisions, randomRadius, randomHeight, randomColor);
cone.setEmissiveLightingColor(randomColor);
cone.setEmissiveLightingOn(r.nextBoolean());
cone.setDrawMode(r.nextBoolean() ? DrawMode.FILL : DrawMode.LINE);
double translationX = Math.random() * 1024;
if (Math.random() >= 0.5) {
translationX *= -1;
}
double translationY = Math.random() * 1024;
if (Math.random() >= 0.5) {
translationY *= -1;
}
double translationZ = Math.random() * 1024;
if (Math.random() >= 0.5) {
translationZ *= -1;
}
Translate translate = new Translate(translationX, translationY, translationZ);
Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);
cone.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
coneGroup.getChildren().add(cone);
}
return coneGroup;
}
示例8: aBunchOfSpheroid
protected static Group aBunchOfSpheroid() {
Group spheroidGroup = new Group();
for(int i = 0; i < 50; i++) {
Random r = new Random();
// A lot of magic numbers in here that just artificially constrain
// the math
float randomMajorRadius = (float) ((r.nextFloat() * 300) + 50);
float randomMinorRadius = (float) ((r.nextFloat() * 300) + 50);
int randomDivisions = (int) ((r.nextFloat() * 64) + 1);
Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
Spheroid sm = new Spheroid(randomDivisions, randomMajorRadius, randomMinorRadius, randomColor);
sm.setDrawMode(DrawMode.LINE);
double translationX = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationX *= -1;
}
double translationY = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationY *= -1;
}
double translationZ = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationZ *= -1;
}
Translate translate = new Translate(translationX, translationY, translationZ);
Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);
sm.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
spheroidGroup.getChildren().add(sm);
}
return spheroidGroup;
}
示例9: aBunchOfOctahedron
protected static Group aBunchOfOctahedron() {
Group octahedronGroup = new Group();
for(int i = 0; i < 100; i++) {
Random r = new Random();
// A lot of magic numbers in here that just artificially constrain
// the math
float randomHypotenuse = (float) ((r.nextFloat() * 300) + 25);
float randomHeight = (float) ((r.nextFloat() * 200) + 25);
Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
Octahedron octahedron = new Octahedron(randomHypotenuse, randomHeight, randomColor);
octahedron.setEmissiveLightingColor(randomColor);
octahedron.setEmissiveLightingOn(r.nextBoolean());
octahedron.setDrawMode(r.nextBoolean() ? DrawMode.FILL : DrawMode.LINE);
double translationX = Math.random() * 1024;
if(Math.random() >= 0.5) {
translationX *= -1;
}
double translationY = Math.random() * 1024;
if(Math.random() >= 0.5) {
translationY *= -1;
}
double translationZ = Math.random() * 1024;
if(Math.random() >= 0.5) {
translationZ *= -1;
}
Translate translate = new Translate(translationX, translationY, translationZ);
Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);
octahedron.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
octahedronGroup.getChildren().add(octahedron);
}
return octahedronGroup;
}
示例10: computeTransform
private TransformMatrix computeTransform(MouseEvent event) {
double factor = event.isAltDown() ? 0.1 : 1.0;
double xD = factor * (event.getSceneX() - xOrig);
double yD = factor * (event.getSceneY() - yOrig);
Rotate rotX = new Rotate(yD, Rotate.X_AXIS);
Rotate rotY = new Rotate(-xD, Rotate.Y_AXIS);
return new TransformMatrix(rotX).before(new TransformMatrix(rotY));
}
示例11: setFlipDirection
public void setFlipDirection(final Orientation FLIP_DIRECTION) {
if (FLIP_DIRECTION == flipDirection) return;
flipDirection = FLIP_DIRECTION;
backRotate = new Rotate(180, Orientation.HORIZONTAL == FLIP_DIRECTION ? Rotate.Y_AXIS : Rotate.X_AXIS);
adjustRotationAxis();
}
示例12: buildAxes
private void buildAxes() {
axisGroup.setId("axis");
final PhongMaterial redMaterial = new PhongMaterial();
redMaterial.setDiffuseColor(Color.RED);
redMaterial.setSpecularColor(Color.RED);
final PhongMaterial greenMaterial = new PhongMaterial();
greenMaterial.setDiffuseColor(Color.GREEN);
greenMaterial.setSpecularColor(Color.GREEN);
final PhongMaterial blueMaterial = new PhongMaterial();
blueMaterial.setDiffuseColor(Color.BLUE);
blueMaterial.setSpecularColor(Color.BLUE);
final Box xAxis = new Box(AXIS_LENGTH, 2, 1);
final Box yAxis = new Box(1, AXIS_LENGTH, 2);
final Box zAxis = new Box(2, 1, AXIS_LENGTH);
final Circle xPlane = new Circle(AXIS_LENGTH/2);
final Circle yPlane = new Circle(AXIS_LENGTH/2);
final Circle zPlane = new Circle(AXIS_LENGTH/2);
xPlane.setStroke(Color.RED);
xPlane.setStrokeWidth(2);
xPlane.setFill(Color.TRANSPARENT);
yPlane.setStroke(Color.GREEN);
yPlane.setStrokeWidth(2);
yPlane.setFill(Color.TRANSPARENT);
zPlane.setStroke(Color.BLUE);
zPlane.setStrokeWidth(2);
zPlane.setFill(Color.TRANSPARENT);
yPlane.setRotationAxis(Rotate.X_AXIS);
yPlane.setRotate(90);
zPlane.setRotationAxis(Rotate.Y_AXIS);
zPlane.setRotate(90);
xAxis.setMaterial(redMaterial);
yAxis.setMaterial(greenMaterial);
zAxis.setMaterial(blueMaterial);
axisGroup.getChildren().addAll(xAxis, yAxis, zAxis, xPlane, yPlane, zPlane);
axisGroup.setVisible(true);
axisGroup.setLayoutX(400);
axisGroup.setLayoutY(300);
Rotate rxBox = new Rotate(0, 0, 0, 0, Rotate.X_AXIS);
Rotate ryBox = new Rotate(0, 0, 0, 0, Rotate.Y_AXIS);
Rotate rzBox = new Rotate(0, 0, 0, 0, Rotate.Z_AXIS);
Translate tzBox = new Translate(240.0, 0, 240.0);
Double rx = 45.0;
Double ry = -45.0;
Double rz = 0.0;
rxBox.setAngle(rx);
ryBox.setAngle(ry);
rzBox.setAngle(rz);
axisGroup.getTransforms().addAll(tzBox, rxBox, ryBox, rzBox);
rootPane.getChildren().addAll(axisGroup);
}
示例13: aBunchOfTorus
protected static Group aBunchOfTorus() {
Group torusGroup = new Group();
for(int i = 0; i < 30; i++) {
Random r = new Random();
// A lot of magic numbers in here that just artificially constrain
// the math
float randomRadius = (float) ((r.nextFloat() * 300) + 50);
float randomTubeRadius = (float) ((r.nextFloat() * 100) + 1);
int randomTubeDivisions = (int) ((r.nextFloat() * 64) + 1);
int randomRadiusDivisions = (int) ((r.nextFloat() * 64) + 1);
Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
Torus torus = new Torus(randomTubeDivisions, randomRadiusDivisions, randomRadius, randomTubeRadius, randomColor);
torus.setEmissiveLightingColor(randomColor);
torus.setEmissiveLightingOn(r.nextBoolean());
double translationX = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationX *= -1;
}
double translationY = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationY *= -1;
}
double translationZ = Math.random() * 1024 * 1.95;
if(Math.random() >= 0.5) {
translationZ *= -1;
}
Translate translate = new Translate(translationX, translationY, translationZ);
Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);
torus.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
// torus.getTransforms().add(translate);
torusGroup.getChildren().add(torus);
}
return torusGroup;
}
示例14: aBunchOfTrapezoid
protected static Group aBunchOfTrapezoid() {
Group trapezoidGroup = new Group();
for(int i = 0; i < 50; i++) {
Random r = new Random();
// A lot of magic numbers in here that just artificially constrain
// the math
double randomSmallSize = (double) ((r.nextDouble() * 50) + 10);
double randomBigSize = (double) ((r.nextDouble() * 100) + 50);
double randomHeight = (double) ((r.nextDouble() * 50) + 25);
double randomDepth = (double) ((r.nextDouble() * 50) + 25);
Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
Trapezoid trapezoid = new Trapezoid(randomSmallSize, randomBigSize, randomHeight, randomDepth, randomColor);
// Trapezoid trapezoid = new Trapezoid(50, 100, 50, 50,
// randomColor);
trapezoid.setEmissiveLightingColor(randomColor);
trapezoid.setEmissiveLightingOn(r.nextBoolean());
trapezoid.setDrawMode(r.nextBoolean() ? DrawMode.FILL : DrawMode.LINE);
double translationX = Math.random() * 1024;
if(Math.random() >= 0.5) {
translationX *= -1;
}
double translationY = Math.random() * 1024;
if(Math.random() >= 0.5) {
translationY *= -1;
}
double translationZ = Math.random() * 1024;
if(Math.random() >= 0.5) {
translationZ *= -1;
}
Translate translate = new Translate(translationX, translationY, translationZ);
Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);
trapezoid.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
trapezoidGroup.getChildren().add(trapezoid);
}
return trapezoidGroup;
}
示例15: start
@Override
public void start(Stage stage) {
Group capsuleGroup = new Group();
for (int i = 0; i < 50; i++) {
Random r = new Random();
//A lot of magic numbers in here that just artificially constrain the math
float randomRadius = (float) ((r.nextFloat() * 100) + 25);
float randomHeight = (float) ((r.nextFloat() * 300) + 75);
Color randomColor = new Color(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
Capsule cap = new Capsule(randomRadius, randomHeight, randomColor);
cap.setEmissiveLightingColor(randomColor);
cap.setEmissiveLightingOn(r.nextBoolean());
cap.setDrawMode(r.nextBoolean() ? DrawMode.FILL : DrawMode.LINE);
double translationX = Math.random() * 1024 * 1.95;
if (Math.random() >= 0.5) {
translationX *= -1;
}
double translationY = Math.random() * 1024 * 1.95;
if (Math.random() >= 0.5) {
translationY *= -1;
}
double translationZ = Math.random() * 1024 * 1.95;
if (Math.random() >= 0.5) {
translationZ *= -1;
}
Translate translate = new Translate(translationX, translationY, translationZ);
Rotate rotateX = new Rotate(Math.random() * 360, Rotate.X_AXIS);
Rotate rotateY = new Rotate(Math.random() * 360, Rotate.Y_AXIS);
Rotate rotateZ = new Rotate(Math.random() * 360, Rotate.Z_AXIS);
cap.getTransforms().addAll(translate, rotateX, rotateY, rotateZ);
capsuleGroup.getChildren().add(cap);
}
root.getChildren().add(capsuleGroup);
camera = new AdvancedCamera();
controller = new FPSController();
camera.setNearClip(0.1);
camera.setFarClip(10000.0);
camera.setFieldOfView(42);
camera.setController(controller);
Scene scene = new Scene(new StackPane(root), 1024, 668, true, SceneAntialiasing.BALANCED);
scene.setCamera(camera);
scene.setFill(Color.BLACK);
controller.setScene(scene);
stage.setTitle("Hello World!");
stage.setScene(scene);
stage.show();
stage.setFullScreen(true);
stage.setFullScreenExitHint("");
}