1

I'm having some trouble working out how to get a Point3D from a shape in javafx 3d.

I'd like to get a Point3D object with an X, Y and Z from my sphere which has been rotated on two axis and translated. However there is no sphere.getX, sphere.getY, sphere.getZ etc. in order to be able to construct a 3D point based on the vertices of the sphere.

I feel like I've missed a trick here, my Sphere exists in 3D space, does anyone have any Idea how I'd get the X,Y and Z coordinates in order to construct a Point3D object?

(The end result of what I want is to be able to input an X, Y, Z into a new Point 3D object without using the mouse)

nickynw
  • 35
  • 5
  • 2
    If you have "X, Y and Z" you have all the information needed to construct a point by `new Point3D(x, y, z)` . What else do you want to get from the sphere ? – c0der Apr 04 '19 at 05:23
  • 3
    Possible duplicated of [JavaFX 3D Graphics: Mouse click position on 3D object](https://stackoverflow.com/questions/28863312/javafx-3d-graphics-mouse-click-position-on-3d-object). – José Pereda Apr 04 '19 at 07:16
  • @c0der poster says the Sphere has been both rotated on two axes and translated which would explain why they don't know the current X, Y, Z. – Birdasaur Apr 04 '19 at 13:02
  • 1
    @Birdasaur thank you for clarifying it. So the question can also be interpreted as how to apply radial translation to a point ? – c0der Apr 04 '19 at 13:25
  • 1
    Possible duplicate of [JavaFX 3D Graphics: Mouse click position on 3D object](https://stackoverflow.com/questions/28863312/javafx-3d-graphics-mouse-click-position-on-3d-object) – SedJ601 Apr 04 '19 at 13:26
  • I'll take a look at whether I can use what you've linked, I'm trying to get the X/Y/Z of the sphere without using the mouse. – nickynw Apr 04 '19 at 13:40
  • Do you mean something like getting any {x, y, z} from the local sphere into the actual coordinates after all the transformations? like `localToScene(bounds)`? – José Pereda Apr 04 '19 at 15:08
  • 1
    If that is the case, in this [answer](https://stackoverflow.com/a/52020701/3956070) you have a possible implementation – José Pereda Apr 04 '19 at 15:18
  • The x, y, z at the centre of the sphere yes, and getting the coordinates of that to use in my methods. I'll take a look at what you've linked, thanks. – nickynw Apr 04 '19 at 16:31

0 Answers0