From 85c94a9e5dc94c3cf93955d87fb2e84f7f2fe16c Mon Sep 17 00:00:00 2001 From: genxium Date: Fri, 23 Sep 2022 16:42:44 +0800 Subject: [PATCH] Preparation for changing collision system. --- frontend/assets/scenes/login.fire | 2 +- frontend/assets/scripts/BasePlayer.js | 36 ------ frontend/assets/scripts/Login.js | 1 + frontend/assets/scripts/Map.js | 16 +-- .../scripts/TileCollisionManagerSingleton.js | 113 ------------------ frontend/assets/scripts/modules/Collisions.js | 1 + .../assets/scripts/modules/Collisions.js.meta | 9 ++ frontend/settings/project.json | 19 +-- 8 files changed, 28 insertions(+), 169 deletions(-) create mode 100644 frontend/assets/scripts/modules/Collisions.js create mode 100644 frontend/assets/scripts/modules/Collisions.js.meta diff --git a/frontend/assets/scenes/login.fire b/frontend/assets/scenes/login.fire index 34a6ab6..c6d4630 100644 --- a/frontend/assets/scenes/login.fire +++ b/frontend/assets/scenes/login.fire @@ -440,7 +440,7 @@ "array": [ 0, 0, - 209.7912853806815, + 216.05530045313827, 0, 0, 0, diff --git a/frontend/assets/scripts/BasePlayer.js b/frontend/assets/scripts/BasePlayer.js index e4ce7f0..6aa7c3d 100644 --- a/frontend/assets/scripts/BasePlayer.js +++ b/frontend/assets/scripts/BasePlayer.js @@ -37,7 +37,6 @@ module.export = cc.Class({ const self = this; self.contactedControlledPlayers = []; self.contactedNPCPlayers = []; - self.coveringShelterZReducers = []; self.computedNewDifferentPosLocalToParentWithinCurrentFrame = null; self.actionMangerSingleton = new cc.ActionManager(); @@ -93,25 +92,6 @@ module.export = cc.Class({ } }, - _addCoveringShelterZReducer(comp) { - const self = this; - for (let coveringShelterZReducer of self.coveringShelterZReducers) { - if (coveringShelterZReducer._id == comp._id) { - return false; - } - } - self.coveringShelterZReducers.push(comp); - return true; - }, - - _removeCoveringShelterZReducer(comp) { - const self = this; - self.coveringShelterZReducers = self.coveringShelterZReducers.filter((coveringShelterZReducer) => { - return coveringShelterZReducer._id != comp._id; - }); - return true; - }, - _addContactedBarrier(collider) { const self = this; if (!self.contactedBarriers) { @@ -379,14 +359,6 @@ module.export = cc.Class({ case "PolygonBoundaryBarrier": playerScriptIns._addContactedBarrier(other); break; - case "PolygonBoundaryShelter": - break; - case "PolygonBoundaryShelterZReducer": - playerScriptIns._addCoveringShelterZReducer(other); - if (1 == playerScriptIns.coveringShelterZReducers.length) { - setLocalZOrder(self.node, 2); - } - break; default: break; } @@ -406,14 +378,6 @@ module.export = cc.Class({ case "PolygonBoundaryBarrier": playerScriptIns._removeContactedBarrier(other); break; - case "PolygonBoundaryShelter": - break; - case "PolygonBoundaryShelterZReducer": - playerScriptIns._removeCoveringShelterZReducer(other); - if (0 == playerScriptIns.coveringShelterZReducers.length) { - setLocalZOrder(self.node, 5); - } - break; default: break; } diff --git a/frontend/assets/scripts/Login.js b/frontend/assets/scripts/Login.js index cd46436..c8b2b77 100644 --- a/frontend/assets/scripts/Login.js +++ b/frontend/assets/scripts/Login.js @@ -1,5 +1,6 @@ const i18n = require('LanguageData'); i18n.init(window.language); // languageID should be equal to the one we input in New Language ID input field + cc.Class({ extends: cc.Component, diff --git a/frontend/assets/scripts/Map.js b/frontend/assets/scripts/Map.js index 5fb8b60..245ab8a 100644 --- a/frontend/assets/scripts/Map.js +++ b/frontend/assets/scripts/Map.js @@ -1,6 +1,8 @@ const i18n = require('LanguageData'); i18n.init(window.language); // languageID should be equal to the one we input in New Language ID input field +const collisions = require('./modules/Collisions'); + window.ALL_MAP_STATES = { VISUAL: 0, // For free dragging & zooming. EDITING_BELONGING: 1, @@ -56,14 +58,6 @@ cc.Class({ type: cc.Prefab, default: null, }, - polygonBoundaryShelterPrefab: { - type: cc.Prefab, - default: null, - }, - polygonBoundaryShelterZReducerPrefab: { - type: cc.Prefab, - default: null, - }, keyboardInputControllerNode: { type: cc.Node, default: null @@ -354,6 +348,9 @@ cc.Class({ self.recentInputCacheMaxCount = 1024; self.toRollbackRenderFrameId1 = null; self.toRollbackInputFrameId1 = null; + + self.latestCollisionSys = new collisions.Collisions(); + self.chaserCollisionSys = new collisions.Collisions(); self.transitToState(ALL_MAP_STATES.VISUAL); @@ -386,8 +383,7 @@ cc.Class({ const mapNode = self.node; const canvasNode = mapNode.parent; - cc.director.getCollisionManager().enabled = true; - cc.director.getCollisionManager().enabledDebugDraw = CC_DEBUG; + cc.director.getCollisionManager().enabled = false; // self.musicEffectManagerScriptIns = self.node.getComponent("MusicEffectManager"); self.musicEffectManagerScriptIns = null; diff --git a/frontend/assets/scripts/TileCollisionManagerSingleton.js b/frontend/assets/scripts/TileCollisionManagerSingleton.js index 1d710b0..2fdee4d 100644 --- a/frontend/assets/scripts/TileCollisionManagerSingleton.js +++ b/frontend/assets/scripts/TileCollisionManagerSingleton.js @@ -334,10 +334,6 @@ window.battleEntityTypeNameToGlobalGid = {}; TileCollisionManager.prototype.extractBoundaryObjects = function (withTiledMapNode) { let toRet = { barriers: [], - shelters: [], - shelterChainTails: [], - shelterChainHeads: [], - sheltersZReducer: [], frameAnimations: [], grandBoundaries: [], }; @@ -404,8 +400,6 @@ TileCollisionManager.prototype.extractBoundaryObjects = function (withTiledMapNo var currentObjectGroupUnderTile = mapInfo._parseObjectGroup(ch); gidBoundariesMap[parentGid] = { barriers: [], - shelters: [], - sheltersZReducer: [], }; for (let oidx = 0; oidx < currentObjectGroupUnderTile._objects.length; ++oidx) { const oo = currentObjectGroupUnderTile._objects[oidx]; @@ -429,22 +423,6 @@ TileCollisionManager.prototype.extractBoundaryObjects = function (withTiledMapNo brToPushTmp.boundaryType = boundaryType; gidBoundariesMap[parentGid].barriers.push(brToPushTmp); break; - case "shelter": - let shToPushTmp = []; - for (let shidx = 0; shidx < polylinePoints.length; ++shidx) { - shToPushTmp.push(cc.v2(oo.x, oo.y).add(polylinePoints[shidx])); - } - shToPushTmp.boundaryType = boundaryType; - gidBoundariesMap[parentGid].shelters.push(shToPushTmp); - break; - case "shelter_z_reducer": - let shzrToPushTmp = []; - for (let shzridx = 0; shzridx < polylinePoints.length; ++shzridx) { - shzrToPushTmp.push(cc.v2(oo.x, oo.y).add(polylinePoints[shzridx])); - } - shzrToPushTmp.boundaryType = boundaryType; - gidBoundariesMap[parentGid].sheltersZReducer.push(shzrToPushTmp); - break; default: break; } @@ -510,22 +488,6 @@ TileCollisionManager.prototype.extractBoundaryObjects = function (withTiledMapNo toPushBarriers.boundaryType = boundaryType; toRet.barriers.push(toPushBarriers); break; - case "shelter": - let toPushShelters = []; - for (let kk = 0; kk < polylinePoints.length; ++kk) { - toPushShelters.push(this.continuousObjLayerOffsetToContinuousMapNodePos(withTiledMapNode, object.offset.add(polylinePoints[kk]))); - } - toPushShelters.boundaryType = boundaryType; - toRet.shelters.push(toPushShelters); - break; - case "shelter_z_reducer": - let toPushSheltersZReducer = []; - for (let kkk = 0; kkk < polylinePoints.length; ++kkk) { - toPushSheltersZReducer.push(this.continuousObjLayerOffsetToContinuousMapNodePos(withTiledMapNode, object.offset.add(polylinePoints[kkk]))); - } - toPushSheltersZReducer.boundaryType = boundaryType; - toRet.sheltersZReducer.push(toPushSheltersZReducer); - break; default: break; } @@ -585,23 +547,6 @@ TileCollisionManager.prototype.extractBoundaryObjects = function (withTiledMapNo } toRet.barriers.push(brToPushTmp); } - for (let shidx = 0; shidx < gidBoundaries.shelters.length; ++shzridx) { - const theShelter = gidBoundaries.shelters[shidx]; // An array of cc.v2 points. - let shToPushTmp = []; - for (let tshidx = 0; tshidx < theShelter.length; ++tshidx) { - shToPushTmp.push(topLeftOfWholeTsxTileInMapNode.add(cc.v2(theShelter[tshidx].x, -theShelter[tshidx].y))); - } - toRet.shelters.push(shToPushTmp); - } - for (let shzridx = 0; shzridx < gidBoundaries.sheltersZReducer.length; ++shzridx) { - const theShelter = gidBoundaries.sheltersZReducer[shzridx]; // An array of cc.v2 points. - let shzrToPushTmp = []; - for (let tshzridx = 0; tshzridx < theShelter.length; ++tshzridx) { - shzrToPushTmp.push(topLeftOfWholeTsxTileInMapNode.add(cc.v2(theShelter[tshzridx].x, -theShelter[tshzridx].y))); - } - toRet.sheltersZReducer.push(shzrToPushTmp); - } - continue; default: @@ -683,47 +628,6 @@ TileCollisionManager.prototype.initMapNodeByTiledBoundaries = function(mapScript frameAnimInType.push(animNode); } - for (let boundaryObj of extractedBoundaryObjs.shelterChainTails) { - const newShelter = cc.instantiate(mapScriptIns.polygonBoundaryShelterPrefab); - const newBoundaryOffsetInMapNode = cc.v2(boundaryObj[0].x, boundaryObj[0].y); - newShelter.setPosition(newBoundaryOffsetInMapNode); - newShelter.setAnchorPoint(cc.v2(0, 0)); - const newShelterColliderIns = newShelter.getComponent(cc.PolygonCollider); - newShelterColliderIns.points = []; - for (let p of boundaryObj) { - newShelterColliderIns.points.push(p.sub(newBoundaryOffsetInMapNode)); - } - newShelter.pTiledLayer = boundaryObj.pTiledLayer; - newShelter.tileDiscretePos = boundaryObj.tileDiscretePos; - if (null != boundaryObj.imageObject) { - newShelter.imageObject = boundaryObj.imageObject; - newShelter.tailOrHead = "tail"; - window.addToGlobalShelterChainVerticeMap(newShelter.imageObject.imageObjectNode); // Deliberately NOT adding at the "traversal of shelterChainHeads". - } - newShelter.boundaryObj = boundaryObj; - mapScriptIns.node.addChild(newShelter); - } - - for (let boundaryObj of extractedBoundaryObjs.shelterChainHeads) { - const newShelter = cc.instantiate(mapScriptIns.polygonBoundaryShelterPrefab); - const newBoundaryOffsetInMapNode = cc.v2(boundaryObj[0].x, boundaryObj[0].y); - newShelter.setPosition(newBoundaryOffsetInMapNode); - newShelter.setAnchorPoint(cc.v2(0, 0)); - const newShelterColliderIns = newShelter.getComponent(cc.PolygonCollider); - newShelterColliderIns.points = []; - for (let p of boundaryObj) { - newShelterColliderIns.points.push(p.sub(newBoundaryOffsetInMapNode)); - } - newShelter.pTiledLayer = boundaryObj.pTiledLayer; - newShelter.tileDiscretePos = boundaryObj.tileDiscretePos; - if (null != boundaryObj.imageObject) { - newShelter.imageObject = boundaryObj.imageObject; - newShelter.tailOrHead = "head"; - } - newShelter.boundaryObj = boundaryObj; - mapScriptIns.node.addChild(newShelter); - } - mapScriptIns.barrierColliders = []; for (let boundaryObj of extractedBoundaryObjs.barriers) { const newBarrier = cc.instantiate(mapScriptIns.polygonBoundaryBarrierPrefab); @@ -739,19 +643,6 @@ TileCollisionManager.prototype.initMapNodeByTiledBoundaries = function(mapScript mapScriptIns.node.addChild(newBarrier); } - for (let boundaryObj of extractedBoundaryObjs.sheltersZReducer) { - const newShelter = cc.instantiate(mapScriptIns.polygonBoundaryShelterZReducerPrefab); - const newBoundaryOffsetInMapNode = cc.v2(boundaryObj[0].x, boundaryObj[0].y); - newShelter.setPosition(newBoundaryOffsetInMapNode); - newShelter.setAnchorPoint(cc.v2(0, 0)); - const newShelterColliderIns = newShelter.getComponent(cc.PolygonCollider); - newShelterColliderIns.points = []; - for (let p of boundaryObj) { - newShelterColliderIns.points.push(p.sub(newBoundaryOffsetInMapNode)); - } - mapScriptIns.node.addChild(newShelter); - } - const allLayers = tiledMapIns.getLayers(); for (let layer of allLayers) { const layerType = layer.getProperty("type"); @@ -759,10 +650,6 @@ TileCollisionManager.prototype.initMapNodeByTiledBoundaries = function(mapScript case "barrier_and_shelter": setLocalZOrder(layer.node, 3); break; - case "shelter_preview": - layer.node.opacity = 100; - setLocalZOrder(layer.node, 500); - break; default: break; } diff --git a/frontend/assets/scripts/modules/Collisions.js b/frontend/assets/scripts/modules/Collisions.js new file mode 100644 index 0000000..a53753d --- /dev/null +++ b/frontend/assets/scripts/modules/Collisions.js @@ -0,0 +1 @@ +!function(_){var t={};function s(n){if(t[n])return t[n].exports;var e=t[n]={i:n,l:!1,exports:{}};return _[n].call(e.exports,e,e.exports,s),e.l=!0,e.exports}s.m=_,s.c=t,s.d=function(_,t,n){s.o(_,t)||Object.defineProperty(_,t,{enumerable:!0,get:n})},s.r=function(_){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(_,"__esModule",{value:!0})},s.t=function(_,t){if(1&t&&(_=s(_)),8&t)return _;if(4&t&&"object"==typeof _&&_&&_.__esModule)return _;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:_}),2&t&&"string"!=typeof _)for(var e in _)s.d(n,e,function(t){return _[t]}.bind(null,e));return n},s.n=function(_){var t=_&&_.__esModule?function(){return _.default}:function(){return _};return s.d(t,"a",t),t},s.o=function(_,t){return Object.prototype.hasOwnProperty.call(_,t)},s.p="",s(s.s=0)}([function(_,t,s){"use strict";s.r(t);const n=[];class e{constructor(){this._bvh_parent=null,this._bvh_branch=!0,this._bvh_left=null,this._bvh_right=null,this._bvh_sort=0,this._bvh_min_x=0,this._bvh_min_y=0,this._bvh_max_x=0,this._bvh_max_y=0}static getBranch(){return n.length?n.pop():new e}static releaseBranch(_){n.push(_)}static sortBranches(_,t){return _.sort>t.sort?-1:1}}class i{constructor(){this._hierarchy=null,this._bodies=[],this._dirty_branches=[]}insert(_,t=!1){if(!t){const t=_._bvh;if(t&&t!==this)throw new Error("Body belongs to another collision system");_._bvh=this,this._bodies.push(_)}const s=_._polygon,n=_.x,i=_.y;s&&(_._dirty_coords||_.x!==_._x||_.y!==_._y||_.angle!==_._angle||_.scale_x!==_._scale_x||_.scale_y!==_._scale_y)&&_._calculateCoords();const r=_._bvh_padding,h=s?0:_.radius*_.scale,o=(s?_._min_x:n-h)-r,l=(s?_._min_y:i-h)-r,a=(s?_._max_x:n+h)+r,c=(s?_._max_y:i+h)+r;_._bvh_min_x=o,_._bvh_min_y=l,_._bvh_max_x=a,_._bvh_max_y=c;let b=this._hierarchy,v=0;if(b)for(;;){if(!b._bvh_branch){const t=b._bvh_parent,s=b._bvh_min_x,n=b._bvh_min_y,i=b._bvh_max_x,r=b._bvh_max_y,h=b._bvh_parent=_._bvh_parent=e.getBranch();h._bvh_parent=t,h._bvh_left=b,h._bvh_right=_,h._bvh_sort=v++,h._bvh_min_x=oi?a:i,h._bvh_max_y=c>r?c:r,t?t._bvh_left===b?t._bvh_left=h:t._bvh_right=h:this._hierarchy=h;break}{const _=b._bvh_left,t=_._bvh_min_y,s=_._bvh_max_x,n=_._bvh_max_y,e=o<_._bvh_min_x?o:_._bvh_min_x,i=ls?a:s,h=c>n?c:n,u=(r-e)*(h-i)-(s-_._bvh_min_x)*(n-t),y=b._bvh_right,x=y._bvh_min_x,m=y._bvh_min_y,d=y._bvh_max_x,f=y._bvh_max_y,p=od?a:d,P=c>f?c:f,M=(w-p)*(P-g)-(d-x)*(f-m);b._bvh_sort=v++,b._bvh_min_x=ew?r:w,b._bvh_max_y=h>P?h:P,b=u<=M?_:y}}else this._hierarchy=_}remove(_,t=!1){if(!t){const t=_._bvh;if(t&&t!==this)throw new Error("Body belongs to another collision system");_._bvh=null,this._bodies.splice(this._bodies.indexOf(_),1)}if(this._hierarchy===_)return void(this._hierarchy=null);const s=_._bvh_parent,n=s._bvh_parent,i=s._bvh_left,r=i===_?s._bvh_right:i;if(r._bvh_parent=n,r._bvh_branch&&(r._bvh_sort=s._bvh_sort),n){n._bvh_left===s?n._bvh_left=r:n._bvh_right=r;let _=n;for(;_;){const t=_._bvh_left,s=t._bvh_min_x,n=t._bvh_min_y,e=t._bvh_max_x,i=t._bvh_max_y,r=_._bvh_right,h=r._bvh_min_x,o=r._bvh_min_y,l=r._bvh_max_x,a=r._bvh_max_y;_._bvh_min_x=sl?e:l,_._bvh_max_y=i>a?i:a,_=_._bvh_parent}}else this._hierarchy=r;e.releaseBranch(s)}update(){const _=this._bodies,t=_.length;for(let s=0;st._bvh_max_x||l>t._bvh_max_y}n&&(this.remove(t,!0),this.insert(t,!0))}}potentials(_){const t=[],s=_._bvh_min_x,n=_._bvh_min_y,e=_._bvh_max_x,i=_._bvh_max_y;let r=this._hierarchy,h=!0;if(!r||!r._bvh_branch)return t;for(;r;){if(h){h=!1;let _=r._bvh_branch?r._bvh_left:null;for(;_&&_._bvh_max_x>=s&&_._bvh_max_y>=n&&_._bvh_min_x<=e&&_._bvh_min_y<=i;)r=_,_=r._bvh_branch?r._bvh_left:null}const o=r._bvh_branch,l=o?r._bvh_right:null;if(l&&l._bvh_max_x>s&&l._bvh_max_y>n&&l._bvh_min_xu&&l>y}(_,t)||(e&&_._dirty_normals&&_._calculateNormals(),i&&t._dirty_normals&&t._calculateNormals(),r=e&&i?function(_,t,s=null){const n=_._coords.length,e=t._coords.length;if(2===n&&2===e){const n=_._coords,e=t._coords;return s&&(s.overlap=0),n[0]===e[0]&&n[1]===e[1]}const i=_._coords,r=t._coords,h=_._normals,o=t._normals;if(n>2)for(let _=0,t=1;_2)for(let _=0,t=1;_h*h)return!1;if(s){const _=Math.sqrt(o);s.a_in_b=n<=e&&_<=e-n,s.b_in_a=e<=n&&_<=n-e,s.overlap=h-_,s.overlap_x=i/_,s.overlap_y=r/_}return!0}(_,t,s)),s&&(s.collision=r),r}function o(_,t,s=null,n=!1){const e=_._coords,i=_._edges,r=_._normals,h=t.x,o=t.y,l=t.radius*t.scale,a=2*l,c=l*l,b=e.length;let v=!0,u=!0,y=null,x=0,m=0;if(2===b){const _=h-e[0],t=o-e[1],n=_*_+t*t;if(n>c)return!1;if(s){const s=Math.sqrt(n);y=l-s,x=_/s,m=t/s,u=!1}}else for(let _=0,t=1;_f*f+p*p?1:0;let P=!1,M=0,T=0,B=0;if(s&&v&&n*n+d*d>c&&(v=!1),w){const t=-1===w,r=t?0===_?b-2:_-2:_===b-2?0:_+2,a=r+1,v=h-e[r],y=o-e[a],x=i[r],m=i[a],f=v*x+y*m;if((f<0?-1:f>x*x+m*m?1:0)===-w){const _=t?n:v,e=t?d:y,i=_*_+e*e;if(i>c)return!1;if(s){const t=Math.sqrt(i);P=!0,M=l-t,T=_/t,B=e/t,u=!1}}}else{const e=r[_],i=r[t],h=n*e+d*i,o=h<0?-h:h;if(h>0&&o>l)return!1;s&&(P=!0,M=l-h,T=e,B=i,(u&&h>=0||MM)&&(y=M,x=T,m=B)}return s&&(s.a_in_b=n?u:v,s.b_in_a=n?v:u,s.overlap=y,s.overlap_x=n?-x:x,s.overlap_y=n?-m:m),!0}function l(_,t,s,n,e=null){const i=_.length,r=t.length;if(!i||!r)return!0;let h=null,o=null,l=null,a=null;for(let t=0,e=1;ti)&&(h=i),(null===o||oi)&&(l=i),(null===a||aa||oa)_=h-a,e.a_in_b=!1;else{const t=o-l,s=a-h;_=ti){const t=_<0?-1:1;e.overlap=i,e.overlap_x=s*t,e.overlap_y=n*t}}return!1}class a{constructor(_=0,t=0,s=0){this.x=_,this.y=t,this.padding=s,this._circle=!1,this._polygon=!1,this._point=!1,this._bvh=null,this._bvh_parent=null,this._bvh_branch=!1,this._bvh_padding=s,this._bvh_min_x=0,this._bvh_min_y=0,this._bvh_max_x=0,this._bvh_max_y=0}collides(_,t=null,s=!0){return h(this,_,t,s)}potentials(){const _=this._bvh;if(null===_)throw new Error("Body does not belong to a collision system");return _.potentials(this)}remove(){const _=this._bvh;_&&_.remove(this,!1)}createResult(){return new r}static createResult(){return new r}}class c extends a{constructor(_=0,t=0,s=0,n=1,e=0){super(_,t,e),this.radius=s,this.scale=n}draw(_){const t=this.x,s=this.y,n=this.radius*this.scale;_.moveTo(t+n,s),_.arc(t,s,n,0,2*Math.PI)}}class b extends a{constructor(_=0,t=0,s=[],n=0,e=1,i=1,r=0){super(_,t,r),this.angle=n,this.scale_x=e,this.scale_y=i,this._polygon=!0,this._x=_,this._y=t,this._angle=n,this._scale_x=e,this._scale_y=i,this._min_x=0,this._min_y=0,this._max_x=0,this._max_y=0,this._points=null,this._coords=null,this._edges=null,this._normals=null,this._dirty_coords=!0,this._dirty_normals=!0,b.prototype.setPoints.call(this,s)}draw(_){(this._dirty_coords||this.x!==this._x||this.y!==this._y||this.angle!==this._angle||this.scale_x!==this._scale_x||this.scale_y!==this._scale_y)&&this._calculateCoords();const t=this._coords;if(2===t.length)_.moveTo(t[0],t[1]),_.arc(t[0],t[1],1,0,2*Math.PI);else{_.moveTo(t[0],t[1]);for(let s=2;s4&&_.lineTo(t[0],t[1])}}setPoints(_){const t=_.length;this._points=new Float64Array(2*t),this._coords=new Float64Array(2*t),this._edges=new Float64Array(2*t),this._normals=new Float64Array(2*t);const s=this._points;for(let n=0,e=0,i=1;nl&&(l=h),uc&&(c=u))}this._x=_,this._y=t,this._angle=s,this._scale_x=n,this._scale_y=e,this._min_x=o,this._min_y=a,this._max_x=l,this._max_y=c,this._dirty_coords=!1,this._dirty_normals=!0}_calculateNormals(){const _=this._coords,t=this._edges,s=this._normals,n=_.length;for(let e=0,i=1;e