1/** 2 * @namespace 3 */ 4var THREEx = THREEx || {} 5 6/** 7 * dilate a geometry inplace 8 * @param {THREEP3DL.Geometry} geometry geometry to dilate 9 * @param {Number} length percent to dilate, use negative value to erode 10 */ 11THREEx.dilateGeometry = function(geometry, length){ 12 // gather vertexNormals from geometry.faces 13 var vertexNormals = new Array(geometry.vertices.length); 14 geometry.faces.forEach(function(face){ 15 if( face instanceof THREEP3DL.Face4 ){ 16 vertexNormals[face.a] = face.vertexNormals[0]; 17 vertexNormals[face.b] = face.vertexNormals[1]; 18 vertexNormals[face.c] = face.vertexNormals[2]; 19 vertexNormals[face.d] = face.vertexNormals[3]; 20 }else if( face instanceof THREEP3DL.Face3 ){ 21 vertexNormals[face.a] = face.vertexNormals[0]; 22 vertexNormals[face.b] = face.vertexNormals[1]; 23 vertexNormals[face.c] = face.vertexNormals[2]; 24 }else console.assert(false); 25 }); 26 // modify the vertices according to vertextNormal 27 geometry.vertices.forEach(function(vertex, idx){ 28 var vertexNormal = vertexNormals[idx]; 29 vertex.x += vertexNormal.x * length; 30 vertex.y += vertexNormal.y * length; 31 vertex.z += vertexNormal.z * length; 32 }); 33}; 34
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.