How to get the absolute rotation of a Node in JavaFX

Mirko Fetter

In JavaFX the rotateProperty of a Node provides me with its rotation in degree relative to its parent. Is there a way to get the absolute rotation in degree, either relative to the Scene or the Screen?

For example, is there a way to calculate the angle from the Transform object of a Node i can get from getLocalToSceneTransform()?

Mirko Fetter

So, i did the math myself, and for my case i either get the rotation in Radians via:

double xx = myNode.getLocalToSceneTransform().getMxx();
double xy = myNode.getLocalToSceneTransform().getMxy();
double angle = Math.atan2(-xy, xx);

or

double yx = myNode.getLocalToSceneTransform().getMyx();
double yy = myNode.getLocalToSceneTransform().getMyy();
double angle = Math.atan2(yx, yy);

In both cases this can be converted to 360-degrees:

angle = Math.toDegrees(angle);
angle = angle < 0 ? angle + 360 : angle;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to get positions of rotated coordinate before rotation?

From Java

How to get an absolute file path in Python

From Dev

How to get to an angle choosing the shortest rotation direction

From Dev

JavaFX: Get Node by row and column

From Dev

How to get superview's frame after rotation?

From Dev

How should I get the absolute URL in CsQuery?

From Dev

How to get the absolute rotation of a Node in JavaFX

From Dev

Obtain absolute rotation using CMDeviceMotion?

From Dev

How to get the real position of a sub node in SceneKit after rotation?

From Dev

Absolute rotation using Matrix?

From Dev

How do I get the rotation of degree with getBoundingClientRect?

From Dev

how to get view rotation in android

From Dev

Get real position of a node in JavaFX

From Dev

JavaFx: How to get the corresponding stylesheet for a given style class of a Node?

From Dev

How to get absolute paths in Hadoop Filesystem?

From Dev

How can I get the absolute path to the gulpfile?

From Dev

Node.js: Get (absolute) root path of installed npm package

From Dev

How to get the absolute path for the resources directory in Java?

From Dev

How to create a JavaFX Image from an absolute path?

From Dev

How do I get the absolute path for '<img src=''>' in node from the a response.body

From Dev

How to get the calling node inside the controller of JavaFX program

From Dev

How to get node bounds according to its specific ancestor in JavaFX 8?

From Dev

How to get the X and Y location of a javaFX node for displaying a PopupControl?

From Dev

How to get the absolute path in Java

From Dev

Get a node CSS absolute position in Javascript

From Dev

Get proper absolute rotation after mesh.lookAt

From Dev

How to handle Node focus in JavaFX

From Dev

How to synchronize rotation on multiple images in JavaFX Canvas

From Dev

How to create a JavaFX Image from an absolute path?

Related Related

  1. 1

    How to get positions of rotated coordinate before rotation?

  2. 2

    How to get an absolute file path in Python

  3. 3

    How to get to an angle choosing the shortest rotation direction

  4. 4

    JavaFX: Get Node by row and column

  5. 5

    How to get superview's frame after rotation?

  6. 6

    How should I get the absolute URL in CsQuery?

  7. 7

    How to get the absolute rotation of a Node in JavaFX

  8. 8

    Obtain absolute rotation using CMDeviceMotion?

  9. 9

    How to get the real position of a sub node in SceneKit after rotation?

  10. 10

    Absolute rotation using Matrix?

  11. 11

    How do I get the rotation of degree with getBoundingClientRect?

  12. 12

    how to get view rotation in android

  13. 13

    Get real position of a node in JavaFX

  14. 14

    JavaFx: How to get the corresponding stylesheet for a given style class of a Node?

  15. 15

    How to get absolute paths in Hadoop Filesystem?

  16. 16

    How can I get the absolute path to the gulpfile?

  17. 17

    Node.js: Get (absolute) root path of installed npm package

  18. 18

    How to get the absolute path for the resources directory in Java?

  19. 19

    How to create a JavaFX Image from an absolute path?

  20. 20

    How do I get the absolute path for '<img src=''>' in node from the a response.body

  21. 21

    How to get the calling node inside the controller of JavaFX program

  22. 22

    How to get node bounds according to its specific ancestor in JavaFX 8?

  23. 23

    How to get the X and Y location of a javaFX node for displaying a PopupControl?

  24. 24

    How to get the absolute path in Java

  25. 25

    Get a node CSS absolute position in Javascript

  26. 26

    Get proper absolute rotation after mesh.lookAt

  27. 27

    How to handle Node focus in JavaFX

  28. 28

    How to synchronize rotation on multiple images in JavaFX Canvas

  29. 29

    How to create a JavaFX Image from an absolute path?

HotTag

Archive