Cylinders are commonly used in three-dimensional scenes. In different graphics processing applications, you may need to create different types of cylinders. Here we will discuss how to make various kinds of three-dimensional cylinders with different transforms and variations. It explains how to create a 3D cylinder with a shear bottom, shear top, and fan cylinder with different theta lengths programmatically in C#.
- Create 3D Cylinders Programmatically – C# API Installation
- Make a Cylinder in C#
- Create a Fan Cylinder in C#
Create 3D Cylinders Programmatically – C# API Installation
Aspose.3D for .NET API can be used to create or manipulate 3D scenes and objects. Moreover, you do not need to install any other 3D processing applications or tools to work with the API. Just configure the API quickly from the New Releases page or run the NuGet installation command below:
PM> Install-Package Aspose.3D
Make a Cylinder in C#
You can make a cylinder in a three-dimensional scene by following the steps below:
- Initialize an object of the Scene class.
- Set the vertices to transform the offset of the bottom side.
- Add the cylinder to the scene.
- Create another cylinder and customize the shear bottom.
- Add the cylinder and Save the output scene.
The code snippet below demonstrates how to follow these steps and make a cylinder programmatically in C#:
Moreover, the following image shows the output image generated using the above code snippet.
Create a Fan Cylinder in C#
The following steps explain how to create a fan cylinder in a 3D scene:
- Create a Scene class object.
- Create a cylinder and set GenerateFanCylinder to true.
- Set the length of theta and create a child node.
- Create a cylinder without a fan and repeat the above steps.
- Save the output scene.
The following code snippet elaborates on how to create a fan cylinder programmatically in C#:
The following screenshot shows the output scene created using this sample code:
Get Free Temporary License
You may request a free temporary license to test the API to its full capacity.
In this article, you have learned how to create a 3D cylinder programmatically in C#. It covers how to modify the code snippet to create a variety of cylinder shapes. Furthermore, you can explore many other features of the API by taking a look at the documentation section. In case of any ambiguities, please reach out to us at forum.