I work with Three.js. I have a set of 3D points (x, y, z) and a set of faces. One face consists of K points . It can also be convex as concave. I did not find anything that could help me in the Three.js documentation. One solution might be to triangulate these shapes, but so far I have not found a simple 3D triangulation algorithm.
Another solution would do something like this:
var pointsGeometry = new THREE.Geometry(); pointsGeometry.vertices.push(new THREE.Vector3(10, 0, 0)); pointsGeometry.vertices.push(new THREE.Vector3(10, 10, 0)); pointsGeometry.vertices.push(new THREE.Vector3(0, 10, 0)); pointsGeometry.vertices.push(new THREE.Vector3(1, 3, 0)); pointsGeometry.vertices.push(new THREE.Vector3(-1, 3, 0)); pointsGeometry.vertices.push(new THREE.Vector3(10, 0, 0)); var material = new THREE.MeshBasicMaterial({color: 0x00ff00}); var mesh = new THREE.Shape/ShapeGeometry/Something(pointsGeometry, material); group.add(mesh); scene.add(group);
I have a lot of these shapes that build a closed surface.
Any suggestion?
Thank you for attention. Have a nice day.
Swisx source share