In different three-dimensional scenes and animations, you may need to create different types of cylinders and apply several types of transformations and other operations as per your requirements. Following such scenarios, this article elaborates on how to create cylinders in Java applications. Moreover, it also covers how you can customize offset top, offset bottom, shear bottom, etc.
- Create 3D Cylinders Programmatically – Java API Installation
- Make a Cylinder in Java
- Create a Fan Cylinder in Java
Create 3D Cylinders Programmatically – Java API Installation
Aspose.3D for Java API supports creating or manipulating 3D cylinders from within Java applications. You can easily configure the API by downloading its JAR files from the Downloads page or pasting the following configurations in the pom.xml file of your project in order to configure it from the Aspose Repository.
<repositories> <repository> <id>AsposeJavaAPI</id> <name>Aspose Java API</name> <url>http://repository.aspose.com/repo/</url> </repository> </repositories>
<dependencies> <dependency> <groupId>com.aspose</groupId> <artifactId>aspose-3d</artifactId> <version>22.10</version> </dependency> </dependencies>
Make a Cylinder in Java
You can make a cylinder in a 3D Object file with the following steps:
- Create an object of the Scene class.
- Specify the vertices transform offset of the bottom side.
- Append the created cylinder to the scene.
- Make another cylinder and customize the shear bottom.
- Append the cylinder and save the generated scene.
The following sample code elaborates on how to make a cylinder programmatically in Java:
Furthermore, the following screenshot shows the cylinders generated using the above code snippet.
Create a Fan Cylinder in Java
You need to follow the steps below to create a fan cylinder in Java:
- Initialize a Scene class object.
- Make a cylinder and set the boolean property GenerateFanCylinder.
- Specify theta length and create a child node.
- Create a cylinder without a fan and repeat the steps above.
- Save the output scene.
The code sample below shows how to create a fan cylinder programmatically in Java:
Moreover, the screenshot below shows the output file containing a fan cylinder and without a fan cylinder:
Get Free Temporary License
You may request a free temporary license to evaluate the API without any limitations.
In this article, you have learned how to create a 3D cylinder programmatically in Java. If you are interested to learn about other features of the API, please visit the API documentation space. Furthermore, in case of any inquiries, please feel free to write to us at forum.