翻譯|使用教程|編輯:胡濤|2022-12-23 10:18:13.170|閱讀 284 次
概述:本文將向你介紹如何在 Java 中創(chuàng)建 3D 圓柱體,歡迎查閱
# 界面/圖表報(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ì)。
Aspose API支持流行文件格式處理,并允許將各類文檔導(dǎo)出或轉(zhuǎn)換為固定布局文件格式和最常用的圖像/多媒體格式。
在不同的三維場(chǎng)景和動(dòng)畫中,您可能需要?jiǎng)?chuàng)建不同類型的圓柱體,并根據(jù)需要應(yīng)用多種類型的變換和其他操作。順著這樣的場(chǎng)景,本文詳細(xì)闡述了如何在Java應(yīng)用程序中創(chuàng)建圓柱體。此外,它還介紹了如何自定義偏移頂部、偏移底部、剪切底部等。
Aspose.3D for Java API 支持從 Java 應(yīng)用程序中創(chuàng)建或操作 3D 圓柱體。您可以通過(guò)從下載頁(yè)面下載其 JAR 文件或?qū)⒁韵屡渲谜迟N到您項(xiàng)目的 pom.xml 文件中以便從Aspose Repository對(duì)其進(jìn)行配置,從而輕松配置 API 。
存儲(chǔ)庫(kù):
<repositories> <repository> <id>AsposeJavaAPI</id> <name>Aspose Java API</name> <url>//repository.aspose.com/repo/</url> </repository> </repositories>
依賴:
<dependencies> <dependency> <groupId>com.aspose</groupId> <artifactId>aspose-3d</artifactId> <version>22.10</version> </dependency> </dependencies>
您可以通過(guò)以下步驟在 3D 對(duì)象文件中制作圓柱體:
以下示例代碼詳細(xì)說(shuō)明了如何在 Java 中以編程方式制作圓柱體:
// Create a scene com.aspose.threed.Scene scene = new com.aspose.threed.Scene(); // Create cylinder 1 var cylinder1 = new com.aspose.threed.Cylinder(2, 2, 10, 20, 1, false); // Set OffsetBottom cylinder1.setOffsetBottom(new com.aspose.threed.Vector3(5, 3, 0)); // Add cylinder to without a ShearBottom to the scene scene.getRootNode().createChildNode(cylinder1); // Create cylinder 2 var cylinder2 = new com.aspose.threed.Cylinder(2, 2, 10, 20, 1, false); // Customized shear bottom for cylinder 2 cylinder2.setShearBottom(new com.aspose.threed.Vector2(0, 0.83)); // Add cylinder 2 to the scene scene.getRootNode().createChildNode(cylinder2).getTransform().setTranslation(new com.aspose.threed.Vector3(10, 0, 0)); // Save scene scene.save("CustomizedCylinder.obj", com.aspose.threed.FileFormat.WAVEFRONTOBJ);
此外,以下屏幕截圖顯示了使用上述代碼片段生成的圓柱體。
您需要按照以下步驟在 Java 中創(chuàng)建風(fēng)筒:
下面的代碼示例顯示了如何在 Java 中以編程方式創(chuàng)建風(fēng)扇氣缸:
// Create a Scene com.aspose.threed.Scene scene = new com.aspose.threed.Scene(); // Create a cylinder var fan = new com.aspose.threed.Cylinder(2, 2, 10, 20, 1, false); // Set GenerateGanCylinder to true fan.setGenerateFanCylinder(true); // Set ThetaLength fan.setThetaLength(com.aspose.threed.MathUtils.toRadian(270)); // Create ChildNode scene.getRootNode().createChildNode(fan).getTransform().setTranslation(new com.aspose.threed.Vector3(10, 0, 0)); // Create a cylinder without a fan var nonfan = new com.aspose.threed.Cylinder(2, 2, 10, 20, 1, false); // Set GenerateGanCylinder to false nonfan.setGenerateFanCylinder(false); // Set ThetaLengeth fan.setThetaLength(com.aspose.threed.MathUtils.toRadian(270)); // Create ChildNode scene.getRootNode().createChildNode(nonfan); // Save scene scene.save("FanCylinder.obj", com.aspose.threed.FileFormat.WAVEFRONTOBJ);
此外,下面的屏幕截圖顯示了包含風(fēng)筒和沒(méi)有風(fēng)筒的輸出文件:
以上便是如何在Aspose.3D Java 中創(chuàng)建 3D 圓柱體。如有任何疑問(wèn),請(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