3
A
回答
6
該解決方案使用ChandlerPrall的ThreeCSG.js項目:http://github.com/chandlerprall/ThreeCSG
(就目前而言,我建議使用支持材料實驗版本 - 紫外分支 - http://github.com/chandlerprall/ThreeCSG/tree/uvs)
下面的代碼,你將需要:
// Cylinder constructor parameters:
// radiusAtTop, radiusAtBottom, height, segmentsAroundRadius, segmentsAlongHeight
var smallCylinderGeom = new THREE.CylinderGeometry(30, 30, 80, 20, 4);
var largeCylinderGeom = new THREE.CylinderGeometry(40, 40, 80, 20, 4);
var smallCylinderBSP = new ThreeBSP(smallCylinderGeom);
var largeCylinderBSP = new ThreeBSP(largeCylinderGeom);
var intersectionBSP = largeCylinderBSP.subtract(smallCylinderBSP);
var redMaterial = new THREE.MeshLambertMaterial({ color: 0xff0000 });
var hollowCylinder = intersectionBSP.toMesh(redMaterial);
scene.add(hollowCylinder);
+0
是的,謝謝,我想出了幾乎相同的解決方案。 – 2012-08-08 08:45:18
+0
你是創業板!優秀。 – 2015-07-01 14:13:38
2
這是不可能的,你將不得不縫合頂點。如果您的氣缸沒有厚度,您可以使用THREE.CylinderGeometry()
。如果它確實有厚度,可以使用CSG。
4
var extrudeSettings = {
amount : 2,
steps : 1,
bevelEnabled: false,
curveSegments: 8
};
var arcShape = new THREE.Shape();
arcShape.absarc(0, 0, 1, 0, Math.PI * 2, 0, false);
var holePath = new THREE.Path();
holePath.absarc(0, 0, 0.8, 0, Math.PI * 2, true);
arcShape.holes.push(holePath);
var geometry = new THREE.ExtrudeGeometry(arcShape, extrudeSettings);
相關問題
- 1. 如何用JavaFX創建空心圓柱體和圓錐體?
- 2. 如何在three.js中從圓柱體中拉伸高度段?
- 3. three.js - 無法創建圓柱體
- 4. With three.js,我如何從SphereGeometry中擠出一個圓柱體?
- 5. 如何在renderscript中製作圓柱體
- 6. Three.js圓柱體在3D平面中旋轉
- 7. 用LibGDX創建空心圓柱
- 8. 使用tkinter畫布在python中創建空心圓柱體或管道
- 9. 使用three.js繪製一個切割出圓柱體的圓柱體的最簡單方法是什麼?
- 10. 如何計算圓柱體「頂部」圓心,給定旋轉角度?
- 11. 在Matplotlib中繪製一個以飛機爲中心的實心圓柱體
- 12. Three.js - 表示矢量的圓柱體的旋轉
- 13. 如何用OpenGLES繪製圓柱體?
- 14. 在圓柱體中生成隨機點
- 15. 在MATLAB中對HSV顏色空間圓柱體進行建模
- 16. three.js - 如何繞特定點旋轉圓柱?
- 17. 在圓柱體內用相機視圖繪製html5畫布圓柱體
- 18. 查看圓柱體內部
- 19. 圓柱投影到球體
- 20. X3dom:旋轉圓柱體
- 21. 創建透明圓柱體
- 22. 如何在OpenTK(.Glu.Cylinder)中繪製圓柱體?
- 23. 如何在OpenGL中設置(創建)切片圓柱體
- 24. 如何在matplotlib中關閉圓柱體的末端
- 25. 如何在rgl R中顯示圓柱體3d數據?
- 26. 如何在XNA4中紋理多個紋理的圓柱體?
- 27. 如何在Android上的OpenGL-es中繪製圓柱體?
- 28. 如何在Silverlight中圍繞圓柱體纏繞圖像
- 29. 如何在三個js中創建一個半圓柱體?
- 30. GLSL中的圓柱體冒充者
我有同樣的問題,但措辭不同。 http://stackoverflow.com/questions/11638686/straight-tube-using-tubegeometry – Recur 2012-08-08 01:26:54