提交 02961c58 编写于 作者: M Mr.doob

Updated builds.

上级 b70137f8
......@@ -30498,15 +30498,13 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
function toShapesNoHoles( inSubpaths ) {
var i, il;
var tmpPath, tmpShape;
var shapes = [];
for ( i = 0, il = inSubpaths.length; i < il; i ++ ) {
for ( var i = 0, il = inSubpaths.length; i < il; i ++ ) {
tmpPath = inSubpaths[ i ];
var tmpPath = inSubpaths[ i ];
tmpShape = new THREE.Shape();
var tmpShape = new THREE.Shape();
tmpShape.actions = tmpPath.actions;
tmpShape.curves = tmpPath.curves;
......@@ -30567,7 +30565,7 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
var subPaths = extractSubpaths( this.actions );
if ( subPaths.length == 0 ) return [];
if ( noHoles ) return toShapesNoHoles( subPaths );
if ( noHoles === true ) return toShapesNoHoles( subPaths );
var solid, tmpPath, tmpShape, shapes = [];
......
......@@ -587,8 +587,8 @@ THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return cons
u=g.y):(g=this.actions[d-1].args,r=g[g.length-2],u=g[g.length-1]);for(f=1;f<=a;f++)s=f/a,g=THREE.Shape.Utils.b2(s,r,q,h),s=THREE.Shape.Utils.b2(s,u,p,k),c.push(new THREE.Vector2(g,s));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];k=f[5];q=f[0];p=f[1];l=f[2];n=f[3];0<c.length?(g=c[c.length-1],r=g.x,u=g.y):(g=this.actions[d-1].args,r=g[g.length-2],u=g[g.length-1]);for(f=1;f<=a;f++)s=f/a,g=THREE.Shape.Utils.b3(s,r,q,l,h),s=THREE.Shape.Utils.b3(s,u,p,n,k),c.push(new THREE.Vector2(g,s));break;case THREE.PathActions.CSPLINE_THRU:g=
this.actions[d-1].args;s=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;s=s.concat(f[0]);s=new THREE.SplineCurve(s);for(f=1;f<=g;f++)c.push(s.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];k=f[1];p=f[2];l=f[3];g=f[4];q=!!f[5];r=g-l;u=2*a;for(f=1;f<=u;f++)s=f/u,q||(s=1-s),s=l+s*r,g=h+p*Math.cos(s),s=k+p*Math.sin(s),c.push(new THREE.Vector2(g,s));break;case THREE.PathActions.ELLIPSE:for(h=f[0],k=f[1],p=f[2],n=f[3],l=f[4],g=f[5],q=!!f[6],r=g-l,u=2*a,f=1;f<=u;f++)s=f/u,q||
(s=1-s),s=l+s*r,g=h+p*Math.cos(s),s=k+n*Math.sin(s),c.push(new THREE.Vector2(g,s))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c};
THREE.Path.prototype.toShapes=function(a,b){function c(a){var b,c,d,e,f=[];b=0;for(c=a.length;b<c;b++)d=a[b],e=new THREE.Shape,e.actions=d.actions,e.curves=d.curves,f.push(e);return f}function d(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],h=b[f],k=h.x-g.x,l=h.y-g.y;if(1E-10<Math.abs(l)){if(0>l&&(g=b[f],k=-k,h=b[e],l=-l),!(a.y<g.y||a.y>h.y))if(a.y==g.y){if(a.x==g.x)return!0}else{e=l*(a.x-g.x)-k*(a.y-g.y);if(0==e)return!0;0>e||(d=!d)}}else if(a.y==g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&
a.x<=h.x))return!0}return d}var e=function(a){var b,c,d,e,f=[],g=new THREE.Path;b=0;for(c=a.length;b<c;b++)d=a[b],e=d.args,d=d.action,d==THREE.PathActions.MOVE_TO&&0!=g.actions.length&&(f.push(g),g=new THREE.Path),g[d].apply(g,e);0!=g.actions.length&&f.push(g);return f}(this.actions);if(0==e.length)return[];if(b)return c(e);var f,g,h,k=[];if(1==e.length)return g=e[0],h=new THREE.Shape,h.actions=g.actions,h.curves=g.curves,k.push(h),k;var l=!THREE.Shape.Utils.isClockWise(e[0].getPoints()),l=a?!l:l;
THREE.Path.prototype.toShapes=function(a,b){function c(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=a[c],f=new THREE.Shape;f.actions=e.actions;f.curves=e.curves;b.push(f)}return b}function d(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],h=b[f],k=h.x-g.x,l=h.y-g.y;if(1E-10<Math.abs(l)){if(0>l&&(g=b[f],k=-k,h=b[e],l=-l),!(a.y<g.y||a.y>h.y))if(a.y==g.y){if(a.x==g.x)return!0}else{e=l*(a.x-g.x)-k*(a.y-g.y);if(0==e)return!0;0>e||(d=!d)}}else if(a.y==g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=
h.x))return!0}return d}var e=function(a){var b,c,d,e,f=[],g=new THREE.Path;b=0;for(c=a.length;b<c;b++)d=a[b],e=d.args,d=d.action,d==THREE.PathActions.MOVE_TO&&0!=g.actions.length&&(f.push(g),g=new THREE.Path),g[d].apply(g,e);0!=g.actions.length&&f.push(g);return f}(this.actions);if(0==e.length)return[];if(!0===b)return c(e);var f,g,h,k=[];if(1==e.length)return g=e[0],h=new THREE.Shape,h.actions=g.actions,h.curves=g.curves,k.push(h),k;var l=!THREE.Shape.Utils.isClockWise(e[0].getPoints()),l=a?!l:l;
h=[];var n=[],q=[],p=0,r;n[p]=void 0;q[p]=[];var u,s;u=0;for(s=e.length;u<s;u++)g=e[u],r=g.getPoints(),f=THREE.Shape.Utils.isClockWise(r),(f=a?!f:f)?(!l&&n[p]&&p++,n[p]={s:new THREE.Shape,p:r},n[p].s.actions=g.actions,n[p].s.curves=g.curves,l&&p++,q[p]=[]):q[p].push({h:g,p:r[0]});if(!n[0])return c(e);if(1<n.length){u=!1;s=[];g=0;for(e=n.length;g<e;g++)h[g]=[];g=0;for(e=n.length;g<e;g++)for(f=q[g],l=0;l<f.length;l++){p=f[l];r=!0;for(var v=0;v<n.length;v++)d(p.p,n[v].p)&&(g!=v&&s.push({froms:g,tos:v,
hole:l}),r?(r=!1,h[v].push(p)):u=!0);r&&h[g].push(p)}0<s.length&&(u||(q=h))}u=0;for(s=n.length;u<s;u++)for(h=n[u].s,k.push(h),g=q[u],e=0,f=g.length;e<f;e++)h.holes.push(g[e].h);return k};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};
THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册