How to create hollow cylinder and truncated cone with JavaFX?

前端 未结 3 738
既然无缘
既然无缘 2021-01-26 07:20

I\'m learning JavaFX 3D. So far I have not found a way how I can create the following objects:

  • Hollow cylinder
  • Truncated cone

Can someone p

3条回答
  •  無奈伤痛
    2021-01-26 08:20

    The first - create a cylinder, and use two different appearance objects - one for cylinder, side, and one for the two bases. For the two bases, use an invisible appearance (rendering attributes). For info on how to set different appearances to bases, set thread: http://forum.java.sun.com/thread.jspa?threadID=663825&tstart=0

    The second - use a clipping plane to clip of the bottom and top of the cylinder, and you have a hollow cylinder.

    Those two methods will give you a hollow cylinder with a COMPLETELY empty interior.

    If you're looking to have walls with a given thickness, there is a boolean operations set available on the internet. Create a large cylinder, and subtract a smaller cylinder. For info on the boolean op set, set this thread: http://forum.java.sun.com/thread.jspa?threadID=658612&tstart=0

    Finally, it's really pretty easy to create a cylinder's geometry yourself, and it can be automated really easily with a loop. I would create four separate geometries: one for the inner cylinder with the rendered faces on the inside, one for the outer cylinder, with the rendered faces on the outside, one for the base, a disc with a hole in the middle and bottom surfaces rendered, and one for the top, another disc with a hole in the middle, and top surfaces rendered.

    That can all be done pretty easily with a triangle strip array.

提交回复
热议问题