Lavorare con il cilindro
Personalizza la parte superiore offset
Aspose.3D for .NET consente di personalizzare la parte superiore offset di un cilindro. Per utilizzare questa funzionalità, puoi utilizzare la proprietà Offset
della classe Cylinder
. Il seguente frammento di codice mostra come personalizzare Offset Top:
// For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET | |
// Create a scene | |
Scene scene = new Scene(); | |
// Initialize cylinder | |
var cylinder1 = new Cylinder(2, 2, 10, 20, 1, false); | |
// Set OffsetTop | |
cylinder1.OffsetTop = new Vector3(5, 3, 0); | |
// Create ChildNode | |
scene.RootNode.CreateChildNode(cylinder1).Transform.Translation = new Vector3(10, 0, 0); | |
// Intialze second cylinder without customized OffsetTop | |
var cylinder2 = new Cylinder(2, 2, 10, 20, 1, false); | |
// Create ChildNode | |
scene.RootNode.CreateChildNode(cylinder2); | |
// Save | |
scene.Save("CustomizedOffsetTopCylinder.obj"); |
Quello sinistro ha OffsetTop impostato su (5, 3, 0), è facile vedere che il tappo superiore si è spostato e anche l’intero busto ne viene influenzato.
Personalizza ShearBottom
Aspose.3D for .NET consente di personalizzare il fondo di taglio di un cilindro. Per utilizzare questa funzionalità, puoi utilizzare la proprietà ShearBottom
della classe Cylinder
. Il seguente frammento di codice mostra come personalizzare il fondo di taglio:
// For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET | |
// Create a scene | |
Scene scene = new Scene(); | |
// Create cylinder 1 | |
var cylinder1 = new Cylinder(2, 2, 10, 20, 1, false); | |
// Customized shear bottom for cylinder 1 | |
cylinder1.ShearBottom = new Vector2(0, 0.83);// shear 47.5deg in xy plane(z-axis) | |
// Add cylinder 1 to the scene | |
scene.RootNode.CreateChildNode(cylinder1).Transform.Translation = new Vector3(10, 0, 0); | |
// Create cylinder 2 | |
var cylinder2 = new Cylinder(2, 2, 10, 20, 1, false); | |
// Add cylinder to without a ShearBottom to the scene | |
scene.RootNode.CreateChildNode(cylinder2); | |
// Save scene | |
scene.Save("CustomizedShearBottomCylinder.obj"); | |
Il cilindro sinistro ha ShearBottom
a (0, 0,83) mentre quello destro è un cilindro ordinale.
Crea Ventilatore-Cilindro
Aspose.3D for .NET consente di creare un cilindro della ventola. Per poter utilizzare questa funzionalità, puoi impostare la proprietà GenerateFanCylinder
della classe Cylinder
su true
. Il seguente frammento di codice mostra come utilizzare questa funzionalità:
// For complete examples and data files, please go to https://github.com/aspose-3d/Aspose.3D-for-.NET | |
// Create a scene | |
Scene scene = new Scene(); | |
// Create cylinder 1 | |
var cylinder1 = new Cylinder(2, 2, 10, 20, 1, false); | |
// Customized shear bottom for cylinder 1 | |
cylinder1.ShearBottom = new Vector2(0, 0.83);// shear 47.5deg in xy plane(z-axis) | |
// Add cylinder 1 to the scene | |
scene.RootNode.CreateChildNode(cylinder1).Transform.Translation = new Vector3(10, 0, 0); | |
// Create cylinder 2 | |
var cylinder2 = new Cylinder(2, 2, 10, 20, 1, false); | |
// Add cylinder to without a ShearBottom to the scene | |
scene.RootNode.CreateChildNode(cylinder2); | |
// Save scene | |
scene.Save("CustomizedShearBottomCylinder.obj"); | |
Il cilindro sinistro ha GenerateFanCylinder = false
e quello destro ha GenerateFanCylinder = true
.