Question

I am asking about drawing a line in the 3D as I want to draw lines between 3D Points.

I somehow confused about finding Point3D class but no Line3D or Plane3D.

Was it helpful?

Solution 2

JavaFX 2.2 3D support is rather rudimentary. You can create 2D shapes, then apply transforms to them to get them into 3D space, but you are not directly defining the shapes in 3D coordinate. So to get a 3D line you can define 2D line, then rotate it around the x and y axes and set a z coordinate on the node.

Future JavaFX versions will provide 3D specific shapes and meshes so that use of 3D features is more natural. For instance you could use a thin cylinder to represent a 3D line.

OTHER TIPS

While Jewelsea's answer would work it isn't convenient or performant. This answer is a little late but I think its important for future readers to note that you can have things like "Line3D" much easier now with the free open-source F(X)yz library:

http://fxyz3d.org

You will want to use the PolyLine3D class which allows you to simply specify a list of Point3Ds and it will connect them for you:

/src/org/fxyz/shapes/composites/PolyLine3D.java

and you can see example code on how to use it in the test directory:

/src/org/fxyz/tests/PolyLine3DTest.java

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top