|
@@ 805-806 (lines=2) @@
|
| 802 |
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry; |
| 803 |
|
THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,j,l=[],k=[];for(j=0;j<=e;j++){var p=[],m=[],o=j/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,r=new THREE.Vector3;r.x=q*Math.sin(n*Math.PI*2);r.y=-o*c+g;r.z=q*Math.cos(n*Math.PI*2);this.vertices.push(r);p.push(this.vertices.length-1);m.push(new THREE.UV(n,o))}l.push(p);k.push(m)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){p=this.vertices[l[0][h]].clone();m=this.vertices[l[0][h+ |
| 804 |
|
1]].clone()}else{p=this.vertices[l[1][h]].clone();m=this.vertices[l[1][h+1]].clone()}p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(j=0;j<e;j++){var o=l[j][h],q=l[j+1][h],n=l[j+1][h+1],r=l[j][h+1],u=p.clone(),t=p.clone(),y=m.clone(),s=m.clone(),w=k[j][h].clone(),H=k[j+1][h].clone(),E=k[j+1][h+1].clone(),z=k[j][h+1].clone();this.faces.push(new THREE.Face4(o,q,n,r,[u,t,y,s]));this.faceVertexUvs[0].push([w,H,E,z])}}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0, |
| 805 |
|
g,0));for(h=0;h<d;h++){o=l[0][h];q=l[0][h+1];n=this.vertices.length-1;u=new THREE.Vector3(0,1,0);t=new THREE.Vector3(0,1,0);y=new THREE.Vector3(0,1,0);w=k[0][h].clone();H=k[0][h+1].clone();E=new THREE.UV(H.u,0);this.faces.push(new THREE.Face3(o,q,n,[u,t,y]));this.faceVertexUvs[0].push([w,H,E])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){o=l[j][h+1];q=l[j][h];n=this.vertices.length-1;u=new THREE.Vector3(0,-1,0);t=new THREE.Vector3(0,-1,0);y=new THREE.Vector3(0,-1,0); |
| 806 |
|
w=k[j][h+1].clone();H=k[j][h].clone();E=new THREE.UV(H.u,1);this.faces.push(new THREE.Face3(o,q,n,[u,t,y]));this.faceVertexUvs[0].push([w,H,E])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry; |
| 807 |
|
THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)}; |
| 808 |
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone(); |
| 809 |
|
h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);if(f===0){console.log("Either infinite or no solutions!");g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")}g=g/f;if(g<0){b=Math.atan2(b.y-a.y,b.x-a.x);a=Math.atan2(c.y-a.y,c.x-a.x);b>a&&(a=a+Math.PI*2);c=(b+a)/2;a=-Math.cos(c);c=-Math.sin(c);return new THREE.Vector2(a,c)}return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(F=c.length;--F>=0;){e=F;f=F-1;f<0&&(f= |
|
@@ 804-805 (lines=2) @@
|
| 801 |
|
[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=void 0)for(var y in h)this.sides[y]!==void 0&&(this.sides[y]=h[y]);this.sides.px&&j("z","y",-1,-1,c,b,k,o);this.sides.nx&&j("z","y",1,-1,c,b,-k,r);this.sides.py&&j("x","z",1,1,a,c,p,q);this.sides.ny&&j("x","z",1,-1,a,c,-p,u);this.sides.pz&&j("x","y",1,-1,a,b,m,n);this.sides.nz&&j("x","y",-1,-1,a,b,-m,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry; |
| 802 |
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry; |
| 803 |
|
THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,g=c/2,d=d||8,e=e||1,h,j,l=[],k=[];for(j=0;j<=e;j++){var p=[],m=[],o=j/e,q=o*(b-a)+a;for(h=0;h<=d;h++){var n=h/d,r=new THREE.Vector3;r.x=q*Math.sin(n*Math.PI*2);r.y=-o*c+g;r.z=q*Math.cos(n*Math.PI*2);this.vertices.push(r);p.push(this.vertices.length-1);m.push(new THREE.UV(n,o))}l.push(p);k.push(m)}c=(b-a)/c;for(h=0;h<d;h++){if(a!==0){p=this.vertices[l[0][h]].clone();m=this.vertices[l[0][h+ |
| 804 |
|
1]].clone()}else{p=this.vertices[l[1][h]].clone();m=this.vertices[l[1][h+1]].clone()}p.setY(Math.sqrt(p.x*p.x+p.z*p.z)*c).normalize();m.setY(Math.sqrt(m.x*m.x+m.z*m.z)*c).normalize();for(j=0;j<e;j++){var o=l[j][h],q=l[j+1][h],n=l[j+1][h+1],r=l[j][h+1],u=p.clone(),t=p.clone(),y=m.clone(),s=m.clone(),w=k[j][h].clone(),H=k[j+1][h].clone(),E=k[j+1][h+1].clone(),z=k[j][h+1].clone();this.faces.push(new THREE.Face4(o,q,n,r,[u,t,y,s]));this.faceVertexUvs[0].push([w,H,E,z])}}if(!f&&a>0){this.vertices.push(new THREE.Vector3(0, |
| 805 |
|
g,0));for(h=0;h<d;h++){o=l[0][h];q=l[0][h+1];n=this.vertices.length-1;u=new THREE.Vector3(0,1,0);t=new THREE.Vector3(0,1,0);y=new THREE.Vector3(0,1,0);w=k[0][h].clone();H=k[0][h+1].clone();E=new THREE.UV(H.u,0);this.faces.push(new THREE.Face3(o,q,n,[u,t,y]));this.faceVertexUvs[0].push([w,H,E])}}if(!f&&b>0){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++){o=l[j][h+1];q=l[j][h];n=this.vertices.length-1;u=new THREE.Vector3(0,-1,0);t=new THREE.Vector3(0,-1,0);y=new THREE.Vector3(0,-1,0); |
| 806 |
|
w=k[j][h+1].clone();H=k[j][h].clone();E=new THREE.UV(H.u,1);this.faces.push(new THREE.Face3(o,q,n,[u,t,y]));this.faceVertexUvs[0].push([w,H,E])}}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry; |
| 807 |
|
THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);a=a instanceof Array?a:[a];this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)}; |
| 808 |
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone(); |