翻譯|使用教程|編輯:胡濤|2023-03-21 10:10:28.997|閱讀 329 次
概述:在這里我們將討論如何制作各種具有不同變換和變化的三維圓柱體
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Aspose.3D 是一個功能豐富的游戲軟件和計算機輔助設計(CAD)的API,可以在不依賴任何3D建模和渲染軟件的情況下操作文檔。API支持Discreet3DS, WavefrontOBJ, FBX (ASCII, Binary), STL (ASCII, Binary), Universal3D, Collada, glTF, GLB, PLY, DirectX, Google Draco文件格式等等。開發人員可以輕松地創建,讀取,轉換,修改和控制3D文件格式的實質。
圓柱體常用于三維場景。在不同的圖形處理應用程序中,您可能需要創建不同類型的圓柱體。在這里我們將討論如何制作各種具有不同變換和變化的三維圓柱體。它解釋了如何在 C# 中以編程方式創建具有剪切底部、剪切頂部和具有不同 theta 長度的風扇圓柱體的 3D 圓柱體。
Aspose.3D for .NET API 可用于創建或操作 3D 場景和對象。此外,您無需安裝任何其他 3D 處理應用程序或工具即可使用 API。只需從New Releases頁面快速配置 API或運行下面的NuGet安裝命令:
PM> Install-Package Aspose.3D
您可以按照以下步驟在三維場景中制作圓柱體:
下面的代碼片段演示了如何按照這些步驟在 C# 中以編程方式制作圓柱體:
// Create a scene Scene scene = new Scene(); // Create cylinder 1 var cylinder1 = new Aspose.ThreeD.Entities.Cylinder(2, 2, 10, 20, 1, false); // Set OffsetBottom cylinder1.OffsetBottom = new Aspose.ThreeD.Utilities.Vector3(5, 3, 0); // Add cylinder to without a ShearBottom to the scene scene.RootNode.CreateChildNode(cylinder1); // Create cylinder 2 var cylinder2 = new Aspose.ThreeD.Entities.Cylinder(2, 2, 10, 20, 1, false); // Customized shear bottom for cylinder 2 cylinder2.ShearBottom = new Aspose.ThreeD.Utilities.Vector2(0, 0.83); // Add cylinder 2 to the scene scene.RootNode.CreateChildNode(cylinder2).Transform.Translation = new Aspose.ThreeD.Utilities.Vector3(10, 0, 0); // Save scene scene.Save("CustomizedCylinder.obj", FileFormat.WavefrontOBJ);
此外,下圖顯示了使用上述代碼片段生成的輸出圖像。
以下步驟說明了如何在 3D 場景中創建風筒:
以下代碼片段詳細說明了如何在 C# 中以編程方式創建風扇圓柱體:
// Create a Scene Scene scene = new Scene(); // Create a cylinder var fan = new Aspose.ThreeD.Entities.Cylinder(2, 2, 10, 20, 1, false); // Set GenerateGanCylinder to true fan.GenerateFanCylinder = true; // Set ThetaLength fan.ThetaLength = Aspose.ThreeD.Utilities.MathUtils.ToRadian(270); // Create ChildNode scene.RootNode.CreateChildNode(fan).Transform.Translation = new Aspose.ThreeD.Utilities.Vector3(10, 0, 0); // Create a cylinder without a fan var nonfan = new Aspose.ThreeD.Entities.Cylinder(2, 2, 10, 20, 1, false); // Set GenerateGanCylinder to false nonfan.GenerateFanCylinder = false; // Set ThetaLengeth nonfan.ThetaLength = Aspose.ThreeD.Utilities.MathUtils.ToRadian(270); // Create ChildNode scene.RootNode.CreateChildNode(nonfan); // Save scene scene.Save("FanCylinder.obj", FileFormat.WavefrontOBJ);
以下屏幕截圖顯示了使用此示例代碼創建的輸出場景:
以上便是如何在 C# 中創建 3D 圓柱體。如有任何疑問,請隨時與我們聯系。
歡迎下載|體驗更多Aspose產品
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn