在OctahedronGeometry THREE.js中选择Hexagonal Face

时间:2015-03-20 19:04:54

标签: javascript coffeescript three.js geometry

我有一个测地球 - 使用THREE.OctahedronGeometry创建 - 我想将三角形​​面组合成六边形面,因此可以选择它们。我对如何处理这个问题或者它是否可行而感到茫然。任何见解将不胜感激。

以下是一个例子: enter image description here

createGeodesicSphere =->
        geometry = new THREE.OctahedronGeometry(200, 3)
        material = new THREE.MeshBasicMaterial({
            color        : 0xFFFFFF,
            shading      : THREE.FlatShading,
            side         : THREE.DoubleSide,
            vertexColors : THREE.FaceColors,
            overdraw     : true 
            })

        # Explode geometry so each face has unique vertices
        explodeModifier = new THREE.ExplodeModifier()
        explodeModifier.modify(geometry)

        geodesicMesh = new THREE.Mesh(geometry , material)
        geodesicFaces = geometry.faces  

        for i in [0..geodesicFaces.length-1]
            geodesicFaces[i].color.setRGB(Math.random(), Math.random(), Math.random())

        geodesicMesh.position.x = 0
        geodesicMesh.position.y = 0
        geodesicMesh.position.z = 0

        scene.add(geodesicMesh)

1 个答案:

答案 0 :(得分:1)

很可能它不可能,但您可以尝试非常接近六边形的voronoi图:Spherical Voronoi Tessellation with Java 7: need fix for winding vertices around faces