翻譯|使用教程|編輯:胡濤|2023-03-21 10:10:28.997|閱讀 329 次
概述:在這里我們將討論如何制作各種具有不同變換和變化的三維圓柱體
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
Aspose.3D 是一個(gè)功能豐富的游戲軟件和計(jì)算機(jī)輔助設(shè)計(jì)(CAD)的API,可以在不依賴任何3D建模和渲染軟件的情況下操作文檔。API支持Discreet3DS, WavefrontOBJ, FBX (ASCII, Binary), STL (ASCII, Binary), Universal3D, Collada, glTF, GLB, PLY, DirectX, Google Draco文件格式等等。開發(fā)人員可以輕松地創(chuàng)建,讀取,轉(zhuǎn)換,修改和控制3D文件格式的實(shí)質(zhì)。
圓柱體常用于三維場(chǎng)景。在不同的圖形處理應(yīng)用程序中,您可能需要?jiǎng)?chuàng)建不同類型的圓柱體。在這里我們將討論如何制作各種具有不同變換和變化的三維圓柱體。它解釋了如何在 C# 中以編程方式創(chuàng)建具有剪切底部、剪切頂部和具有不同 theta 長(zhǎng)度的風(fēng)扇圓柱體的 3D 圓柱體。
Aspose.3D for .NET API 可用于創(chuàng)建或操作 3D 場(chǎng)景和對(duì)象。此外,您無(wú)需安裝任何其他 3D 處理應(yīng)用程序或工具即可使用 API。只需從New Releases頁(yè)面快速配置 API或運(yùn)行下面的NuGet安裝命令:
PM> Install-Package Aspose.3D
您可以按照以下步驟在三維場(chǎng)景中制作圓柱體:
下面的代碼片段演示了如何按照這些步驟在 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);
此外,下圖顯示了使用上述代碼片段生成的輸出圖像。
以下步驟說(shuō)明了如何在 3D 場(chǎng)景中創(chuàng)建風(fēng)筒:
以下代碼片段詳細(xì)說(shuō)明了如何在 C# 中以編程方式創(chuàng)建風(fēng)扇圓柱體:
// 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);
以下屏幕截圖顯示了使用此示例代碼創(chuàng)建的輸出場(chǎng)景:
以上便是如何在 C# 中創(chuàng)建 3D 圓柱體。如有任何疑問,請(qǐng)隨時(shí)與我們聯(lián)系。
歡迎下載|體驗(yàn)更多Aspose產(chǎn)品
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn