THREE.js 部分球体几何给出了两个部分,其中一个部分是预期的
THREE.js partial sphere geometry gives two segments where one segment expected
我正在尝试使用 THREE.SphereGeometry 构造函数的扩展选项制作部分球体几何体,例如
// material
var dish_material = new THREE.MeshLambertMaterial( {
color: 0x00ffff,
side: THREE.DoubleSide,
ambient: 0x00ffff,
shading: THREE.FlatShading,
transparent: true,
opacity: 0.7,
} );
var segment_material = new THREE.MeshLambertMaterial( {
color: 0xffff00,
side: THREE.DoubleSide,
ambient: 0x00ffff,
shading: THREE.FlatShading,
transparent: true,
opacity: 0.7,
} );
// geometries
var dish_geometry = new THREE.SphereGeometry(radius=5, widthSegments=16, heightSegments=16,
phiStart=0, phiLength=Math.PI*2,
thetaStart=Math.PI, thetaLength=Math.PI/4);
var segment_geometry = new THREE.SphereGeometry(radius=5, widthSegments=16, heightSegments=16,
phiStart=0, phiLength=Math.PI/4,
thetaStart=0, thetaLength=Math.PI*2);
// meshes
dish = new THREE.Mesh( dish_geometry, dish_material );
scene.add( dish );
segment = new THREE.Mesh( segment_geometry, segment_material );
scene.add( segment );
这里是 JSFiddle 使用上面的代码。
"dish" 对象(蓝色)看起来符合预期。
但是 "segment" 对象(黄色)有两个部分,而我原以为只有一个。
我的问题
这是"double segment"预期的几何形状吗?
您指定了 thetaLength=Math.PI*2,这将导致一个完整的圆。如果该圆旋转,您将得到您描述的几何形状。
我想你会想改为写 thetaLength=Math.PI。
我正在尝试使用 THREE.SphereGeometry 构造函数的扩展选项制作部分球体几何体,例如
// material
var dish_material = new THREE.MeshLambertMaterial( {
color: 0x00ffff,
side: THREE.DoubleSide,
ambient: 0x00ffff,
shading: THREE.FlatShading,
transparent: true,
opacity: 0.7,
} );
var segment_material = new THREE.MeshLambertMaterial( {
color: 0xffff00,
side: THREE.DoubleSide,
ambient: 0x00ffff,
shading: THREE.FlatShading,
transparent: true,
opacity: 0.7,
} );
// geometries
var dish_geometry = new THREE.SphereGeometry(radius=5, widthSegments=16, heightSegments=16,
phiStart=0, phiLength=Math.PI*2,
thetaStart=Math.PI, thetaLength=Math.PI/4);
var segment_geometry = new THREE.SphereGeometry(radius=5, widthSegments=16, heightSegments=16,
phiStart=0, phiLength=Math.PI/4,
thetaStart=0, thetaLength=Math.PI*2);
// meshes
dish = new THREE.Mesh( dish_geometry, dish_material );
scene.add( dish );
segment = new THREE.Mesh( segment_geometry, segment_material );
scene.add( segment );
这里是 JSFiddle 使用上面的代码。
"dish" 对象(蓝色)看起来符合预期。
但是 "segment" 对象(黄色)有两个部分,而我原以为只有一个。
我的问题
这是"double segment"预期的几何形状吗?
您指定了 thetaLength=Math.PI*2,这将导致一个完整的圆。如果该圆旋转,您将得到您描述的几何形状。
我想你会想改为写 thetaLength=Math.PI。