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

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.

Repository:

 <repositories>
    <repository>
        <id>AsposeJavaAPI</id>
        <name>Aspose Java API</name>
        <url>http://repository.aspose.com/repo/</url>
    </repository>
</repositories>

Dependency:

 <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:

  1. Create an object of the Scene class.
  2. Specify the vertices transform offset of the bottom side.
  3. Append the created cylinder to the scene.
  4. Make another cylinder and customize the shear bottom.
  5. 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.

Make 3D Cylinder C#

Create a Fan Cylinder in Java

You need to follow the steps below to create a fan cylinder in Java:

  1. Initialize a Scene class object.
  2. Make a cylinder and set the boolean property GenerateFanCylinder.
  3. Specify theta length and create a child node.
  4. Create a cylinder without a fan and repeat the steps above.
  5. 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:

Make 3D Cylinder C#

Get Free Temporary License

You may request a free temporary license to evaluate the API without any limitations.

Conclusion

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.

See Also

Convert MA to USDZ in Java