Coordinate transformations in javafx


I want to have a right-handed Cartesian coordinate system in JavaFX, so (0,0) at lower left corner of window, x increasing to the right and y increasing upwards. I can't figure out how to do that with transforms. If I apply a rotation transform, the buttons will be upside down. All I want is to be able to use this coordinate system instead of the default one.

7/27/2014 8:55:28 PM

As mentioned in the JavaFX documentation (see chapter Y-down versus Y-up), Y down is used by many 2D graphics libraries, which is where JavaFX has started.

To force Y up and correct drawing, you could put all your content in a rotated parent node:

// Rotate camera to use Y up.

// Rotate scene content for correct drawing.
Group yUp = new Group();

Scene scene = new Scene(yUp);

Now add everything to yUp to use those nodes like in a Y up environment.

Bear in mind that this is fine in 2D space. If you come up with additional 3D features, make sure your models grow in negative Y direction. Otherwise you would have to use another container.

12/4/2015 9:29:29 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow