diff --git a/build/Geometrize.js b/build/Geometrize.js index 8d70e67..65bd04d 100644 --- a/build/Geometrize.js +++ b/build/Geometrize.js @@ -2,14 +2,14 @@ * Geometrize * computational geometry and rendering library for JavaScript * -* @version 1.0.1 (2024-11-29 17:00:43) +* @version 1.0.1 (2024-11-29 18:10:26) * https://github.com/foo123/Geometrize * **//** * Geometrize * computational geometry and rendering library for JavaScript * -* @version 1.0.1 (2024-11-29 17:00:43) +* @version 1.0.1 (2024-11-29 18:10:26) * https://github.com/foo123/Geometrize * **/ @@ -2855,22 +2855,12 @@ var CBezier = makeClass(Bezier2D, { x1 = p[1].x, y1 = p[1].y, x2 = p[2].x, y2 = p[2].y, x3 = p[3].x, y3 = p[3].y, - vxx, vxy, vyx, vyy, - vzx, vzy, x, y, - s, t, rs, rp; + x, y, s, t, rs, rp; - vxx = x2 - x1; - vxy = y2 - y1; - vyx = x1 - x0; - vyy = y1 - y0; - vzx = x3 - x0; - vzy = y3 - y0; - s = solve_linear_linear_system(vxx, vyx, -vzx, vxy, vyy, -vzy); - if (!s) - { - return false; - } - x = s[0].x; y = s[0].y; + s = solve_linear_linear_system(x2 - x1, x1 - x0, -(x3 - x0), y2 - y1, y1 - y0, -(y3 - y0)); + if (!s) return false; + x = s[0].x; + y = s[0].y; if ( (x > 1) || (4 * y > (x + 1) * (3 - x)) || diff --git a/build/Geometrize.min.js b/build/Geometrize.min.js index c28ac15..24f8870 100644 --- a/build/Geometrize.min.js +++ b/build/Geometrize.min.js @@ -2,7 +2,7 @@ * Geometrize * computational geometry and rendering library for JavaScript * -* @version 1.0.1 (2024-11-29 17:00:43) +* @version 1.0.1 (2024-11-29 18:10:26) * https://github.com/foo123/Geometrize * **/!function(t,n,e){"use strict";"object"==typeof module&&module.exports?(module.$deps=module.$deps||{})&&(module.exports=module.$deps[n]=e.call(t)):"function"==typeof define&&define.amd&&"function"==typeof require&&"function"==typeof require.specified&&require.specified(n)?define(n,["module"],function(n){return e.moduleUri=n.uri,e.call(t)}):n in t||(t[n]=e.call(t)||1)&&"function"==typeof define&&define.amd&&define(function(){return t[n]})}("undefined"!=typeof self?self:this,"Geometrize",function(e){"use strict";var D=Object.prototype.hasOwnProperty,r=Object.prototype.toString,C=Object.defineProperty,_=Math,w=_.abs,$=_.sqrt,P=_.pow,S=_.PI,A=2*S,Q=1e-6,q=S/4,i=$(2),I=$(3),N=20,R=.01,Z={},F=function(){},n="undefined"!=typeof global&&"[object global]"===r.call(global),y="undefined"!=typeof window&&"[object Window]"===r.call(window),G=(n?global:y&&window,{VERSION:"1.0.1",Math:{},Geometry:{}});function t(n,t,e){arguments.length<2&&(t=n,n=null);var r,i,o,u=D.call(t,"constructor")?t.constructor:function(){};for(r in n?(u.prototype=Object.create(n.prototype),u.prototype.$super=(i=n,o={},function(n,t){var e=":"+n;return 1===o[e]?(i.prototype.$super||F).call(this,n,t):(o[e]=1,n=("constructor"===n?i:i.prototype[n]||F).apply(this,t||[]),o[e]=0,n)})):u.prototype.$super=F,u.prototype.constructor=u,t)D.call(t,r)&&"constructor"!==r&&(u.prototype[r]=t[r]);if(e)for(r in e)D.call(e,r)&&(u[r]=e[r]);return u}var n={$changed:!1,$cb:null,dispose:function(){this.$cb=null},isChanged:function(n){return arguments.length?(this.$changed=!!n,this):this.$changed},onChange:function(n,t){var e,r=this;return!1===t&&(L(n)||$t(n))?r.$cb&&-1!==(e=($t(n)?r.$cb.map(function(n){return v(n.id)}):r.$cb).indexOf(n))&&r.$cb.splice(e,1):L(n)&&(r.$cb||(r.$cb=[]),-1===(e=r.$cb.indexOf(n)))&&r.$cb.push(n),r},triggerChange:function(){var t=this;return t.$cb&&t.$cb.forEach(function(n){n(t)}),t}},o=t(null,gt(null,{constructor:function n(t){var e=this,r=null,i=null;return t instanceof n?t:e instanceof n?(i=gt(r=n.Properties,{},n.Defaults),Pt(t)&&(i=gt(r,i,t)),r.forEach(function(t){C(e,t,{get:function(){return i[t]},set:function(n){i[t]!==n&&(i[t]=n,e.isChanged(!0),e.triggerChange())},enumerable:!0,configurable:!1})}),e.toObj=function(){return r.reduce(function(n,t){return n[t]=i[t],n},{})},void e.isChanged(!0)):new n(t)},clone:function(){return new o(this.toObj())},toSVG:function(){var e=this.toObj();return Object.keys(e).reduce(function(n,t){return n+t+":"+v(e[t])+";"},"")},toCanvas:function(n){var t=this;return n.lineCap=t["stroke-linecap"],n.lineJoin=t["stroke-linejoin"],n.lineWidth=t["stroke-width"],n.fillStyle="none"===t.fill?"transparent":t.fill,n.strokeStyle=t.stroke,n}},n),{Properties:["stroke-width","stroke","stroke-opacity","stroke-linecap","stroke-linejoin","fill","fill-opacity","fill-rule"],Defaults:{"stroke-width":1,stroke:"#000000","stroke-opacity":1,"stroke-linecap":"butt","stroke-linejoin":"miter",fill:"none","fill-opacity":1,"fill-rule":"evenodd"}}),j=(G.Style=o,t(null,gt(null,{constructor:function e(r){var i=this;return r instanceof e?r:i instanceof e?(r=O(r),i.dispose=function(){r=null,e.prototype.dispose.call(i)},i.clone=function(){return new e(r)},i.val=function(n){var t;return arguments.length?(n=n instanceof e?n.val():O(n),t=!k(r,n),r=n,t&&(i.isChanged(!0),i.triggerChange()),i):r},i.valueOf=function(){return r.valueOf()},i.toString=function(){return v(r)},void i.isChanged(!0)):new e(r)},clone:null,val:null,valueOf:null,toString:null},n))),g=t(null,{constructor:function n(t,e,r,i,o,u){var a=this;return t instanceof n?t:a instanceof n?void(b(t)&&6<=t.length?(a.$00=O(t[0]),a.$01=O(t[1]),a.$02=O(t[2]),a.$10=O(t[3]),a.$11=O(t[4]),a.$12=O(t[5])):(a.$00=t,a.$01=e,a.$02=r,a.$10=i,a.$11=o,a.$12=u)):new n(t,e,r,i,o,u)},$00:1,$01:0,$02:0,$10:0,$11:1,$12:0,clone:function(){var n=this;return new g(n.$00,n.$01,n.$02,n.$10,n.$11,n.$12)},eq:function(n){var t;return n instanceof g&&k((t=this).$00,n.$00)&&k(t.$01,n.$01)&&k(t.$02,n.$02)&&k(t.$10,n.$10)&&k(t.$11,n.$11)&&k(t.$12,n.$12)},add:function(n){var t=this;return n instanceof g?new g(t.$00+n.$00,t.$01+n.$01,t.$02+n.$02,t.$10+n.$10,t.$11+n.$11,t.$12+n.$12):(n=O(n),new g(t.$00+n,t.$01+n,t.$02+n,t.$10+n,t.$11+n,t.$12+n))},mul:function(n){var t,e,r,i,o,u,a=this,s=a.$00,l=a.$01,c=a.$02,f=a.$10,h=a.$11,a=a.$12;return n instanceof g?(t=n.$00,e=n.$01,r=n.$02,i=n.$10,o=n.$11,u=n.$12,0,new g(s*t+l*i,s*e+l*o,s*r+l*u+c,f*t+h*i,f*e+h*o,f*r+h*u+a)):(n=O(n),new g(s*n,l*n,c*n,f*n,h*n,a*n))},det:function(){var n=this,t=n.$00,e=n.$01,r=(n.$02,n.$10),i=n.$11;n.$12;return t*i-e*r},inv:function(){var n=this,t=n.$00,e=n.$01,r=n.$02,i=n.$10,o=n.$11,n=n.$12,u=t*o-e*i;return d(u,0)?null:new g(o=o/u,e=-e/u,-o*r-e*n,o=-i/u,e=t/u,-o*r-e*n)},transform:function(n,t){var e=this,r=n.x,n=n.y,i=e.$00*r+e.$01*n+e.$02,r=e.$10*r+e.$11*n+e.$12;return t?(t.x=i,t.y=r):t=new V(i,r),t},getTranslation:function(){return{x:this.$02,y:this.$12}},getRotationAngle:function(){return _.atan2(this.$10,this.$00)},getScale:function(){var n=this.$00,t=-this.$01,e=this.$10,r=this.$11;return{x:M(n)*a(n,e),y:M(r)*a(t,r)}},toArray:function(){var n=this;return[n.$00,n.$01,n.$02,n.$10,n.$11,n.$12,0,0,1]},toSVG:function(){var n=this;return"matrix("+v(n.$00)+" "+v(n.$10)+" "+v(n.$01)+" "+v(n.$11)+" "+v(n.$02)+" "+v(n.$12)+")"},toCSS:function(){var n=this;return"matrix("+v(n.$00)+","+v(n.$10)+","+v(n.$01)+","+v(n.$11)+","+v(n.$02)+","+v(n.$12)+")"},toCanvas:function(n,t){var e=this;return n[!0===t?"setTransform":"transform"](e.$00,e.$10,e.$01,e.$11,e.$02,e.$12),n},toTex:function(){return g.arrayTex(this.toArray(),3,3)},toString:function(){return g.arrayString(this.toArray(),3,3)}},{eye:function(){return new g(1,0,0,0,1,0)},translate:function(n,t){return new g(1,0,O(n),0,1,O(t))},rotate:function(n,t,e){e=O(e||0),t=O(t||0),n=O(n||0);var r=_.cos(n),n=_.sin(n);return new g(r,-n,t-r*t+n*e,n,r,e-r*e-n*t)},scale:function(n,t,e,r){return r=O(r||0),e=O(e||0),n=O(n),t=O(t),new g(n,0,-n*e+e,0,t,-t*r+r)},reflectX:function(){return new g(-1,0,0,0,1,0)},reflectY:function(){return new g(1,0,0,0,-1,0)},shearX:function(n){return new g(1,O(n),0,0,1,0)},shearY:function(n){return new g(1,0,0,O(n),1,0)},arrayTex:function(n,t,e){for(var r="\\begin{pmatrix}",i=0;iS,fs:0t.x?n:t),(!l&&(at.y?n:t),{ymin:y.y,xmin:g.x,ymax:d.y,xmax:h.x}}),configurable:!1}),C(l,"_hull",{get:function(){var t,n,e,r,i,o,u,a;return null==b&&(t=l.center,n=l.rX,e=l.rY,r=l.theta,i=l.dtheta,o=l.start,u=l.end,a=_.abs(i)+q=A&&n.closePath()},toTex:function(){var n=this;return"\\text{Arc: }\\left("+[_t(n.start),_t(n.end),v(n.radiusX),v(n.radiusY),v(n.angle)+"\\text{°}",v(n.largeArc?1:0),v(n.sweep?1:0)].join(",")+"\\right)"},toString:function(){var n=this;return"Arc("+[v(n.start),v(n.end),v(n.radiusX),v(n.radiusY),v(n.angle)+"°",v(n.largeArc),v(n.sweep)].join(",")+")"}})),ln=(G.Arc=sn,t(W,{constructor:function n(t,e){var r=this,i=null,o=null,u=null,a=null;return t instanceof n?t:r instanceof n?(i=new j(_.abs(O(e))),r.$super("constructor",[[t],{radius:i}]),C(r,"center",{get:function(){return r.points[0]},set:function(n){r.points[0]=n},enumerable:!0,configurable:!1}),C(r,"radius",{get:function(){return i.val()},set:function(n){i.val(_.abs(O(n))),i.isChanged()&&(r.isChanged(!0),r.triggerChange())},enumerable:!0,configurable:!1}),C(r,"radiusX",{get:function(){return r.radius},set:function(n){r.radius=n},enumerable:!0,configurable:!1}),C(r,"radiusY",{get:function(){return r.radius},set:function(n){r.radius=n},enumerable:!0,configurable:!1}),C(r,"rX",{get:function(){return r.radius},enumerable:!0,configurable:!1}),C(r,"rY",{get:function(){return r.radius},enumerable:!0,configurable:!1}),C(r,"angle",{get:function(){return 0},set:function(n){},enumerable:!0,configurable:!1}),C(r,"theta",{get:function(){return 0},enumerable:!1,configurable:!1}),C(r,"dtheta",{get:function(){return A},enumerable:!1,configurable:!1}),C(r,"cs",{get:function(){return[1,0]},enumerable:!1,configurable:!1}),C(r,"length",{get:function(){return o=null==o?A*i.val():o},enumerable:!0,configurable:!1}),C(r,"area",{get:function(){return u=null==u?S*i.val()*i.val():u},enumerable:!0,configurable:!1}),C(r,"_bbox",{get:function(){var n,t;return null==a&&(n=r.center,t=i.val(),a={ymin:n.y-t,xmin:n.x-t,ymax:n.y+t,xmax:n.x+t}),a},enumerable:!1,configurable:!1}),void(r.isChanged=function(n){return!0===n&&(a=u=o=null),r.$super("isChanged",arguments)})):new n(t,e)},name:"Circle",clone:function(){return new ln(this.center.clone(),this.radius)},transform:function(n){var t=this.center,e=this.radius,r=t.transform(n),t=new V(t.x+e,t.y+e).transform(n);return new ln(r,rt(r,t))},isClosed:function(){return!0},intersects:function(n){var t;return n instanceof V?!!this.hasPoint(n)&&[n]:n instanceof ln?!!(t=function(n,t,e,r){t"+v(r)+"":"/>");return t}function yt(u,a,s,i){if(!L(u.onChange)){var l=function(t){u.$cb.forEach(function(n){n(t)})},c=!0,f=(i=i||pt,function(n,t){for(var e=n;e 1) || (4 * y > (x + 1) * (3 - x)) ||