|
@@ -463,8 +463,8 @@ THREE.Path.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.su
|
|
THREE.Path.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,!0))};THREE.Path.prototype.createGeometry=function(b){for(var c=new THREE.Geometry,e=0;e<b.length;e++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(b[e].x,b[e].y,0)));return c};
|
|
THREE.Path.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,!0))};THREE.Path.prototype.createGeometry=function(b){for(var c=new THREE.Geometry,e=0;e<b.length;e++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(b[e].x,b[e].y,0)));return c};
|
|
THREE.Path.prototype.transform=function(b){b=new THREE.Path;b.moveTo(0,0);b.quadraticCurveTo(100,20,140,80);console.log(b.cacheArcLengths());var c=this.getBoundingBox(),e=this.getPoints(),f,h,g,j,m,p;f=0;for(h=e.length;f<h;f++)g=e[f],j=g.x,m=g.y,p=j/c.maxX,j=b.getPoint(p),m=b.getNormalVector(p).multiplyScalar(m),g.x=j.x+m.x,g.y=j.y+m.y;return e};
|
|
THREE.Path.prototype.transform=function(b){b=new THREE.Path;b.moveTo(0,0);b.quadraticCurveTo(100,20,140,80);console.log(b.cacheArcLengths());var c=this.getBoundingBox(),e=this.getPoints(),f,h,g,j,m,p;f=0;for(h=e.length;f<h;f++)g=e[f],j=g.x,m=g.y,p=j/c.maxX,j=b.getPoint(p),m=b.getNormalVector(p).multiplyScalar(m),g.x=j.x+m.x,g.y=j.y+m.y;return e};
|
|
THREE.Path.prototype.nltransform=function(b,c,e,f,h,g){var j=this.getPoints(),m,p,t,n,o;m=0;for(p=j.length;m<p;m++)t=j[m],n=t.x,o=t.y,t.x=b*n+c*o+e,t.y=f*o+h*n+g;return j};
|
|
THREE.Path.prototype.nltransform=function(b,c,e,f,h,g){var j=this.getPoints(),m,p,t,n,o;m=0;for(p=j.length;m<p;m++)t=j[m],n=t.x,o=t.y,t.x=b*n+c*o+e,t.y=f*o+h*n+g;return j};
|
|
-THREE.Path.prototype.debug=function(b){var c=this.getMinAndMax();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,h,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],h=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,h);c.stroke();c.closePath();c.strokeStyle="red";f=this.getPoints();
|
|
|
|
-b=0;for(e=f.length;b<e;b++)h=f[b],c.beginPath(),c.arc(h.x,h.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
|
|
|
|
+THREE.Path.prototype.debug=function(b){var c=this.getBoundingBox();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,h,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],h=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,h);c.stroke();c.closePath();c.strokeStyle="red";f=
|
|
|
|
+this.getPoints();b=0;for(e=f.length;b<e;b++)h=f[b],c.beginPath(),c.arc(h.x,h.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
THREE.Path.prototype.toShapes=function(){var b,c,e,f,h=[],g=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)e=this.actions[b],f=e.args,e=e.action,e==THREE.PathActions.MOVE_TO&&g.actions.length!=0&&(h.push(g),g=new THREE.Path),g[e].apply(g,f);g.actions.length!=0&&h.push(g);if(h.length==0)return[];var j,g=[];if(THREE.Shape.Utils.isClockWise(h[0].getPoints())){b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(j&&g.push(j),j=new THREE.Shape,j.actions=f.actions,j.curves=
|
|
THREE.Path.prototype.toShapes=function(){var b,c,e,f,h=[],g=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)e=this.actions[b],f=e.args,e=e.action,e==THREE.PathActions.MOVE_TO&&g.actions.length!=0&&(h.push(g),g=new THREE.Path),g[e].apply(g,f);g.actions.length!=0&&h.push(g);if(h.length==0)return[];var j,g=[];if(THREE.Shape.Utils.isClockWise(h[0].getPoints())){b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(j&&g.push(j),j=new THREE.Shape,j.actions=f.actions,j.curves=
|
|
f.curves):j.holes.push(f);g.push(j)}else{j=new THREE.Shape;b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(j.actions=f.actions,j.curves=f.curves,g.push(j),j=new THREE.Shape):j.holes.push(f)}return g};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
|
|
f.curves):j.holes.push(f);g.push(j)}else{j=new THREE.Shape;b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(j.actions=f.actions,j.curves=f.curves,g.push(j),j=new THREE.Shape):j.holes.push(f)}return g};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
|
|
THREE.Shape.prototype.getPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getPoints();return e};THREE.Shape.prototype.getSpacedPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getSpacedPoints();return e};THREE.Shape.prototype.extractAllPoints=function(){return{shape:this.getPoints(),holes:this.getPointsHoles()}};THREE.Shape.prototype.extractAllSpacedPoints=function(){return{shape:this.getSpacedPoints(),holes:this.getSpacedPointsHoles()}};
|
|
THREE.Shape.prototype.getPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getPoints();return e};THREE.Shape.prototype.getSpacedPointsHoles=function(){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getSpacedPoints();return e};THREE.Shape.prototype.extractAllPoints=function(){return{shape:this.getPoints(),holes:this.getPointsHoles()}};THREE.Shape.prototype.extractAllSpacedPoints=function(){return{shape:this.getSpacedPoints(),holes:this.getSpacedPointsHoles()}};
|
|
@@ -484,11 +484,11 @@ f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.
|
|
THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f,g,j,h,k;f=new THREE.Vector2(b.x-c.x,b.y-c.y);g=new THREE.Vector2(b.x-e.x,b.y-e.y);f=f.normalize();g=g.normalize();j=new THREE.Vector2(-f.y,f.x);h=new THREE.Vector2(g.y,-g.x);g=b.clone().addSelf(j);k=b.clone().addSelf(h);if(g.equals(k))return h;g=c.clone().addSelf(j);k=e.clone().addSelf(h);j=f.dot(h);h=k.clone().subSelf(g).dot(h);j==0&&
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f,g,j,h,k;f=new THREE.Vector2(b.x-c.x,b.y-c.y);g=new THREE.Vector2(b.x-e.x,b.y-e.y);f=f.normalize();g=g.normalize();j=new THREE.Vector2(-f.y,f.x);h=new THREE.Vector2(g.y,-g.x);g=b.clone().addSelf(j);k=b.clone().addSelf(h);if(g.equals(k))return h;g=c.clone().addSelf(j);k=e.clone().addSelf(h);j=f.dot(h);h=k.clone().subSelf(g).dot(h);j==0&&
|
|
(console.log("Either infinite or no solutions!"),h==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j=h/j;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.clone().multiplyScalar(j).addSelf(g).subSelf(b)}function h(b){for(G=b.length;--G>=0;){Z=G;aa=G-1;aa<0&&(aa=b.length-1);for(var c=0,c=0;c<v+n*2;c++){var e=Q*c,f=Q*(c+1),g=ha+Z+e,e=ha+aa+e,j=ha+
|
|
(console.log("Either infinite or no solutions!"),h==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j=h/j;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.clone().multiplyScalar(j).addSelf(g).subSelf(b)}function h(b){for(G=b.length;--G>=0;){Z=G;aa=G-1;aa<0&&(aa=b.length-1);for(var c=0,c=0;c<v+n*2;c++){var e=Q*c,f=Q*(c+1),g=ha+Z+e,e=ha+aa+e,j=ha+
|
|
-aa+f,f=ha+Z+f;g+=K;e+=K;j+=K;f+=K;B.faces.push(new THREE.Face4(g,e,j,f))}}}function g(b,c,e){B.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function j(b,c,e){b+=K;c+=K;e+=K;B.faces.push(new THREE.Face3(b,c,e))}var m=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:p-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:!0;o||(n=0);var v=c.steps!==void 0?c.steps:1,u=c.path!==void 0?c.path:
|
|
|
|
-null,y,w=!1;if(u)y=u.getPoints(),v=y.length,w=!0;var C,x,I,B=this,K=this.vertices.length,u=b.extractAllPoints(),F=u.shape,u=u.holes,A=!THREE.Shape.Utils.isClockWise(F);if(A){F=F.reverse();x=0;for(I=u.length;x<I;x++)C=u[x],THREE.Shape.Utils.isClockWise(C)&&(u[x]=C.reverse());A=!1}var A=THREE.Shape.Utils.triangulateShape(F,u),X=F;x=0;for(I=u.length;x<I;x++)C=u[x],F=F.concat(C);var G,H,L,O,P,N,Q=F.length,S=A.length,$=[];G=0;H=X.length;Z=H-1;for(aa=G+1;G<H;G++,Z++,aa++)Z==H&&(Z=0),aa==H&&(aa=0),$[G]=
|
|
|
|
-f(X[G],X[Z],X[aa]);var k=[],J,da=$.concat();x=0;for(I=u.length;x<I;x++){C=u[x];J=[];G=0;H=C.length;Z=H-1;for(aa=G+1;G<H;G++,Z++,aa++)Z==H&&(Z=0),aa==H&&(aa=0),J[G]=f(C[G],C[Z],C[aa]);k.push(J);da=da.concat(J)}for(L=0;L<n;L++){O=L/n;P=p*(1-O);O=t*Math.sin(O*Math.PI/2);G=0;for(H=X.length;G<H;G++)N=e(X[G],$[G],O),g(N.x,N.y,-P);x=0;for(I=u.length;x<I;x++){C=u[x];J=k[x];G=0;for(H=C.length;G<H;G++)N=e(C[G],J[G],O),g(N.x,N.y,-P)}}O=t;for(G=0;G<Q;G++)N=o?e(F[G],da[G],O):F[G],w?g(N.x,N.y+y[0].y,y[0].x):g(N.x,
|
|
|
|
-N.y,0);for(L=1;L<=v;L++)for(G=0;G<Q;G++)N=o?e(F[G],da[G],O):F[G],w?g(N.x,N.y+y[L-1].y,y[L-1].x):g(N.x,N.y,m/v*L);for(L=n-1;L>=0;L--){O=L/n;P=p*(1-O);O=t*Math.sin(O*Math.PI/2);G=0;for(H=X.length;G<H;G++)N=e(X[G],$[G],O),g(N.x,N.y,m+P);x=0;for(I=u.length;x<I;x++){C=u[x];J=k[x];G=0;for(H=C.length;G<H;G++)N=e(C[G],J[G],O),w?g(N.x,N.y+y[v-1].y,y[v-1].x+P):g(N.x,N.y,m+P)}}if(o){p=Q*0;for(G=0;G<S;G++)m=A[G],j(m[2]+p,m[1]+p,m[0]+p);p=Q*(v+n*2);for(G=0;G<S;G++)m=A[G],j(m[0]+p,m[1]+p,m[2]+p)}else{for(G=0;G<
|
|
|
|
-S;G++)m=A[G],j(m[2],m[1],m[0]);for(G=0;G<S;G++)m=A[G],j(m[0]+Q*v,m[1]+Q*v,m[2]+Q*v)}var Z,aa,ha=0;h(X);ha+=X.length;x=0;for(I=u.length;x<I;x++)C=u[x],h(C),ha+=C.length;this.computeCentroids();this.computeFaceNormals()};
|
|
|
|
|
|
+aa+f,f=ha+Z+f;g+=K;e+=K;j+=K;f+=K;B.faces.push(new THREE.Face4(g,e,j,f))}}}function g(b,c,e){B.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function j(b,c,e){b+=K;c+=K;e+=K;B.faces.push(new THREE.Face3(b,c,e))}var m=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:p-2,n=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:!0,v=c.steps!==void 0?c.steps:1,u=c.path!==void 0?c.path:null,y,w=!1;
|
|
|
|
+if(u)y=u.getPoints(),v=y.length,w=!0,o=!1;o||(t=p=n=0);var C,x,I,B=this,K=this.vertices.length,u=b.extractAllPoints(),F=u.shape,u=u.holes,A=!THREE.Shape.Utils.isClockWise(F);if(A){F=F.reverse();x=0;for(I=u.length;x<I;x++)C=u[x],THREE.Shape.Utils.isClockWise(C)&&(u[x]=C.reverse());A=!1}var A=THREE.Shape.Utils.triangulateShape(F,u),X=F;x=0;for(I=u.length;x<I;x++)C=u[x],F=F.concat(C);var G,H,L,O,P,N,Q=F.length,S=A.length,$=[];G=0;H=X.length;Z=H-1;for(aa=G+1;G<H;G++,Z++,aa++)Z==H&&(Z=0),aa==H&&(aa=0),
|
|
|
|
+$[G]=f(X[G],X[Z],X[aa]);var k=[],J,da=$.concat();x=0;for(I=u.length;x<I;x++){C=u[x];J=[];G=0;H=C.length;Z=H-1;for(aa=G+1;G<H;G++,Z++,aa++)Z==H&&(Z=0),aa==H&&(aa=0),J[G]=f(C[G],C[Z],C[aa]);k.push(J);da=da.concat(J)}for(L=0;L<n;L++){O=L/n;P=p*(1-O);O=t*Math.sin(O*Math.PI/2);G=0;for(H=X.length;G<H;G++)N=e(X[G],$[G],O),g(N.x,N.y,-P);x=0;for(I=u.length;x<I;x++){C=u[x];J=k[x];G=0;for(H=C.length;G<H;G++)N=e(C[G],J[G],O),g(N.x,N.y,-P)}}O=t;for(G=0;G<Q;G++)N=o?e(F[G],da[G],O):F[G],w?g(N.x,N.y+y[0].y,y[0].x):
|
|
|
|
+g(N.x,N.y,0);for(L=1;L<=v;L++)for(G=0;G<Q;G++)N=o?e(F[G],da[G],O):F[G],w?g(N.x,N.y+y[L-1].y,y[L-1].x):g(N.x,N.y,m/v*L);for(L=n-1;L>=0;L--){O=L/n;P=p*(1-O);O=t*Math.sin(O*Math.PI/2);G=0;for(H=X.length;G<H;G++)N=e(X[G],$[G],O),g(N.x,N.y,m+P);x=0;for(I=u.length;x<I;x++){C=u[x];J=k[x];G=0;for(H=C.length;G<H;G++)N=e(C[G],J[G],O),w?g(N.x,N.y+y[v-1].y,y[v-1].x+P):g(N.x,N.y,m+P)}}if(o){p=Q*0;for(G=0;G<S;G++)m=A[G],j(m[2]+p,m[1]+p,m[0]+p);p=Q*(v+n*2);for(G=0;G<S;G++)m=A[G],j(m[0]+p,m[1]+p,m[2]+p)}else{for(G=
|
|
|
|
+0;G<S;G++)m=A[G],j(m[2],m[1],m[0]);for(G=0;G<S;G++)m=A[G],j(m[0]+Q*v,m[1]+Q*v,m[2]+Q*v)}var Z,aa,ha=0;h(X);ha+=X.length;x=0;for(I=u.length;x<I;x++)C=u[x],h(C),ha+=C.length;this.computeCentroids();this.computeFaceNormals()};
|
|
THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=h.vertices[b].position,g=h.vertices[e].position;return c((f.x+g.x)/2,(f.y+g.y)/2,(f.z+g.z)/2)}var h=this,g=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
|
|
THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=h.vertices[b].position,g=h.vertices[e].position;return c((f.x+g.x)/2,(f.y+g.y)/2,(f.z+g.z)/2)}var h=this,g=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
|
|
-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,g);e(0,5,1,g);e(0,1,7,g);e(0,7,10,g);e(0,10,11,g);e(1,5,9,g);e(5,11,4,g);e(11,10,2,g);e(10,7,6,g);e(7,1,8,g);e(3,9,4,g);e(3,4,2,g);e(3,2,6,g);e(3,6,8,g);e(3,8,9,g);e(4,9,5,g);e(2,4,11,g);e(6,2,10,g);e(8,6,7,g);e(9,8,1,g);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var m in g.faces){var p=f(g.faces[m].a,g.faces[m].b),t=f(g.faces[m].b,g.faces[m].c),n=f(g.faces[m].c,g.faces[m].a);e(g.faces[m].a,p,n,j);e(g.faces[m].b,t,p,j);
|
|
-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,g);e(0,5,1,g);e(0,1,7,g);e(0,7,10,g);e(0,10,11,g);e(1,5,9,g);e(5,11,4,g);e(11,10,2,g);e(10,7,6,g);e(7,1,8,g);e(3,9,4,g);e(3,4,2,g);e(3,2,6,g);e(3,6,8,g);e(3,8,9,g);e(4,9,5,g);e(2,4,11,g);e(6,2,10,g);e(8,6,7,g);e(9,8,1,g);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var m in g.faces){var p=f(g.faces[m].a,g.faces[m].b),t=f(g.faces[m].b,g.faces[m].c),n=f(g.faces[m].c,g.faces[m].a);e(g.faces[m].a,p,n,j);e(g.faces[m].b,t,p,j);
|
|
e(g.faces[m].c,n,t,j);e(p,t,n,j)}g.faces=j.faces}h.faces=g.faces;delete g;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
e(g.faces[m].c,n,t,j);e(p,t,n,j)}g.faces=j.faces}h.faces=g.faces;delete g;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|