How to use the ShapeUtils function from three
Find comprehensive JavaScript three.ShapeUtils code examples handpicked from public code repositorys.
GitHub: anvaka/actg
![anvaka profile picture](/anvaka.png?size=40)
112 113 114 115 116 117 118 119 120 121
extractGlyphPoints: function(c, face, scale, offset, path) { var pts = []; var b2 = THREE.ShapeUtils.b2; var b3 = THREE.ShapeUtils.b3; var i, i2, divisions, outline, action, length, scaleX, scaleY,
+ 7 other calls in file
GitHub: thatbimgirl/api
88 89 90 91 92 93 94 95 96 97
//bottomPoints.push([x,y]); }; } //const bottomCurve = new THREE.Curve(bottomPoints); //const bottomShape = new THREE.Shape(bottomCurve); //var a = THREE.ShapeUtils.area(bottomPoints); //const unique = [...new Set(bottomPoints.map(item => item))] //write algorithm to delete duplicates var unique = [];
+ 3 other calls in file
30 31 32 33 34 35 36 37 38 39
geometry.vertices.push(new THREE.Vector3(i + 0.6, Math.sin(i) - 0.6, i - 0.6)) geometry.vertices.push(new THREE.Vector3(i + 0.6, Math.sin(i) - 1.2, i + 0.1)) } let holes = [] , triangles = THREE.ShapeUtils.triangulateShape(geometry.vertices, holes) for (var i = 0; i < triangles.length; i++) { geometry.faces.push(new THREE.Face3(triangles[i][0], triangles[i][1], triangles[i][2])) }
three.Vector3 is the most popular function in three (22341 examples)