@labelbee/lb-annotation 1.27.0-alpha.7 → 1.27.0-alpha.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/_virtual/highlightWorker.js +1 -1
  2. package/dist/constant/keyCode.js +1 -1
  3. package/dist/constant/tool.js +1 -1
  4. package/dist/core/pointCloud/OrbitControls.js +1 -1
  5. package/dist/core/pointCloud/index.js +4 -2
  6. package/dist/core/pointCloud/matrix.js +1 -1
  7. package/dist/core/pointCloud/omniCamera.js +1 -1
  8. package/dist/core/toolOperation/ViewOperation.js +1 -1
  9. package/dist/core/toolOperation/basicToolOperation.js +1 -1
  10. package/dist/core/toolOperation/pointCloud2DRectOperation.js +1 -1
  11. package/dist/core/toolOperation/pointOperation.js +1 -1
  12. package/dist/core/toolOperation/polygonOperation.js +1 -1
  13. package/dist/core/toolOperation/rectOperation.js +2 -1
  14. package/dist/core/toolOperation/utils/reCalcRect.js +1 -0
  15. package/dist/types/constant/keyCode.d.ts +1 -0
  16. package/dist/types/constant/tool.d.ts +2 -1
  17. package/dist/types/core/pointCloud/index.d.ts +49 -3
  18. package/dist/types/core/toolOperation/ViewOperation.d.ts +22 -1
  19. package/dist/types/core/toolOperation/basicToolOperation.d.ts +1 -0
  20. package/dist/types/core/toolOperation/pointCloud2DRectOperation.d.ts +11 -2
  21. package/dist/types/core/toolOperation/pointOperation.d.ts +4 -0
  22. package/dist/types/core/toolOperation/polygonOperation.d.ts +2 -0
  23. package/dist/types/core/toolOperation/rectOperation.d.ts +22 -5
  24. package/dist/types/core/toolOperation/utils/reCalcRect.d.ts +9 -0
  25. package/dist/types/utils/MathUtils.d.ts +7 -0
  26. package/dist/types/utils/tool/AxisUtils.d.ts +3 -0
  27. package/dist/types/utils/tool/PolygonUtils.d.ts +13 -0
  28. package/dist/types/utils/tool/RectUtils.d.ts +3 -0
  29. package/dist/utils/MathUtils.js +1 -1
  30. package/dist/utils/tool/PolygonUtils.js +1 -1
  31. package/es/_virtual/highlightWorker.js +1 -1
  32. package/es/constant/keyCode.js +1 -1
  33. package/es/constant/tool.js +1 -1
  34. package/es/core/pointCloud/OrbitControls.js +1 -1
  35. package/es/core/pointCloud/index.js +4 -2
  36. package/es/core/pointCloud/matrix.js +1 -1
  37. package/es/core/pointCloud/omniCamera.js +1 -1
  38. package/es/core/toolOperation/ViewOperation.js +1 -1
  39. package/es/core/toolOperation/basicToolOperation.js +1 -1
  40. package/es/core/toolOperation/pointCloud2DRectOperation.js +1 -1
  41. package/es/core/toolOperation/pointOperation.js +1 -1
  42. package/es/core/toolOperation/polygonOperation.js +1 -1
  43. package/es/core/toolOperation/rectOperation.js +2 -1
  44. package/es/core/toolOperation/utils/reCalcRect.js +1 -0
  45. package/es/utils/MathUtils.js +2 -2
  46. package/es/utils/tool/PolygonUtils.js +1 -1
  47. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ var _=Object.defineProperty,d=Object.defineProperties,O=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,e=(o,n,s)=>n in o?_(o,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[n]=s,l=(o,n)=>{for(var s in n||(n={}))a.call(n,s)&&e(o,s,n[s]);if(p)for(var s of p(n))v.call(n,s)&&e(o,s,n[s]);return o},I=(o,n)=>d(o,O(n));const m=(o,n)=>{const s={x:(n.x+n.width)/2,y:(n.y+n.height)/2};let r=Infinity,i=[];for(const y of o){const x=Math.sqrt(Math.pow(s.x-y.x,2)+Math.pow(s.y-y.y,2));x<r?(r=x,i=[y]):x===r&&i.push(y)}return i},T=(o,n)=>[{x:o.x,y:o.y,position:0},{x:o.x+o.width,y:o.y,position:1},{x:o.x,y:o.y+o.height,position:2},{x:o.x+o.width,y:o.y+o.height,position:3}].filter(i=>i.x>=n.x&&i.x<=n.width+n.x&&i.y>=n.y&&i.y<=n.height+n.y),b=(o,n)=>{const s=o.x+o.width,r=o.y+o.height,i=n.x+n.width,y=n.y+n.height,x=o.x<=i&&s>=n.x&&o.y<=y&&r>=n.y,h=o.x<=n.x&&s>=i&&o.y<=n.y&&r>=y;return x||h},g=(o,n,s,r)=>{const i=T(o,n);if(i.length>0){const x=i.length>=3?i:m(i,n),h=x[0].position||0,f={0:t=>({x:t.x,y:t.y}),1:t=>({x:t.x-s,y:t.y}),2:t=>({x:t.x,y:t.y-r}),3:t=>({x:t.x-s,y:t.y-r})},{x:P,y:w}=f[h](x[0],s,r);return{width:s,height:r,x:P,y:w}}return b(o,n)?{width:s,height:r,x:(n.x+n.width-s)/2,y:(n.y+n.height-r)/2}:I(l({},o),{noChange:!0})};export{g as default};
@@ -1,2 +1,2 @@
1
- import z from"../_virtual/MathUtilsWorker.js";import{SEGMENT_NUMBER as E,DEFAULT_TEXT_MAX_WIDTH as R,DEFAULT_FONT as T,ELineTypes as S}from"../constant/tool.js";import{createSmoothCurvePointsFromPointList as v,isInPolygon as B}from"./tool/polygonTool.js";import O from"./tool/PolygonUtils.js";import P from"./VectorUtils.js";var U=Object.defineProperty,j=Object.defineProperties,N=Object.getOwnPropertyDescriptors,_=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,M=Math.pow,I=(n,o,t)=>o in n?U(n,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[o]=t,A=(n,o)=>{for(var t in o||(o={}))V.call(o,t)&&I(n,t,o[t]);if(_)for(var t of _(o))X.call(o,t)&&I(n,t,o[t]);return n},F=(n,o)=>j(n,N(o));class m{static tanAPlusB(o,t){return(o+t)/(1-o*t)}static sinAPlusB(o,t,i,e){return e*o+t*i}static cosAPlusB(o,t,i,e){return t*e-o*i}}var L;(function(n){n[n.Outside=0]="Outside",n[n.PartiallyInside=1]="PartiallyInside",n[n.FullyInside=2]="FullyInside"})(L||(L={}));function D(n,o,t){const i=[{x:t.x-t.width/2,y:t.y-t.height/2,z:t.z-t.depth/2},{x:t.x+t.width/2,y:t.y-t.height/2,z:t.z-t.depth/2},{x:t.x-t.width/2,y:t.y+t.height/2,z:t.z-t.depth/2},{x:t.x+t.width/2,y:t.y+t.height/2,z:t.z-t.depth/2},{x:t.x-t.width/2,y:t.y-t.height/2,z:t.z+t.depth/2},{x:t.x+t.width/2,y:t.y-t.height/2,z:t.z+t.depth/2},{x:t.x-t.width/2,y:t.y+t.height/2,z:t.z+t.depth/2},{x:t.x+t.width/2,y:t.y+t.height/2,z:t.z+t.depth/2}];let e=0;for(let s=0;s<i.length;s++)u.isPointInsideCube(i[s],n,o)&&e++;return e===0?0:e===8?2:1}const g=class{static getRotate(n){return n+90>=360?n+90-360:n+90}static getLineLength(n,o){return Math.sqrt(Math.pow(o.y-n.y,2)+Math.pow(o.x-n.x,2))}static getTextArea(n,o,t=R,i=T,e){if(typeof o!="string")return{width:0,height:0};const s=n.getContext("2d");s.font=i;let r=0;typeof e=="undefined"&&(e=n&&parseInt(window.getComputedStyle(n).lineHeight,10)||parseInt(window.getComputedStyle(document.body).lineHeight,10));const a=n&&parseInt(window.getComputedStyle(n).fontSize,10)||parseInt(window.getComputedStyle(document.body).fontSize,10)||0,c=o.split(`
2
- `);let y=0;for(let h=0;h<c.length;h++){const f=c[h].split("");let x="";for(let d=0;d<f.length;d++){const p=x+f[d],l=s.measureText(p).width;l>t&&d>0?(x=f[d],r+=e,y=t):(x=p,l>y&&(y=l))}h!==c.length-1&&(r+=e)}return{width:y,height:r+a,lineHeight:e,fontHeight:a}}static getLineCenterPoint(n){const[o,t]=n,i=P.getVector(o,t);return{x:o.x+i.x/2,y:o.y+i.y/2}}static getPerpendicularLine(n){if(n.length!==2)return;const[o,t]=n,i={x:t.x+t.y-o.y,y:t.y-(t.x-o.x)};return[t,i]}static getPerpendicularFootOfLine(n,o){if(n.length!==2)return n;const t=this.getPerpendicularLine(n);if(!t)return n;const[i,e]=t;return this.getFootOfPerpendicular(o,i,e).footPoint}static getQuadrangleFromTriangle(n){if(n.length!==3)return n;const[o,t,i]=n,e={x:i.x+o.x-t.x,y:i.y+o.y-t.y};return[o,t,i,e]}static getRectPerpendicularOffset(n,o,t){const[i,e]=t,s=this.getFootOfPerpendicular(n,i,e).footPoint,r=this.getFootOfPerpendicular(o,i,e).footPoint,a={x:s.x-r.x,y:s.y-r.y},c=P.add(o,a);return P.getVector(n,c)}static getArrayIndex(n,o){return n<0?o+n:n>=o?n-o:n}static getPointListFromPointOffset(n,o,t){const i=this.getArrayIndex(o-1,n.length),e=this.getArrayIndex(o+1,n.length),s=this.getArrayIndex(o-2,n.length),r=[...n];r[o]=P.add(r[o],t);const a=this.getFootOfPerpendicular(r[o],r[s],r[i]).footPoint,c=this.getFootOfPerpendicular(r[o],r[e],r[s]).footPoint;return r[i]=a,r[e]=c,r}static getRectCenterPoint(n){const[o,,t]=n;return{x:(o.x+t.x)/2,y:(o.y+t.y)/2}}static rotateRectPointList(n=5,o){const t=this.getRectCenterPoint(o),{PI:i}=Math,e=Math.sin(n*i/180),s=Math.cos(n*i/180);return o.map(r=>{const a=P.getVector(t,r),c=P.len(a),y=a.y/c,h=a.x/c;return{x:c*m.cosAPlusB(y,h,e,s)+t.x,y:c*m.sinAPlusB(y,h,e,s)+t.y}})}static getRectangleByRightAngle(n,o){if(o.length!==2)return o;const t=g.getPerpendicularFootOfLine(o,n);return g.getQuadrangleFromTriangle([...o,t])}static getRadiusFromQuadrangle(n){const[,o,t]=n,i=t.y-o.y,e=o.x-t.x,s=this.getLineLength(o,t),r=i/s,a=Math.acos(r);return e>0?Math.PI*2-a:a}static getCollectionPointByAnnotationDataPromise(n){const o=n.filter(e=>e.type==="point").map(e=>e.annotation),t=n.filter(e=>!!["polygon","line"].includes(e.type)).map(e=>e.type==="polygon"?F(A({},e.annotation),{pointList:O.concatBeginAndEnd(e.annotation.pointList)}):e.annotation),i=new z;return{promise:new Promise(function(s){i.postMessage({points:o,backgroundList:t}),i.onmessage=r=>{s(r.data),i.terminate()}}),close:()=>{i.terminate()}}}static getCollectionPointByAnnotationData(n){const o=[],t=new Set,i=n.filter(r=>r.type==="point").map(r=>r.annotation),e=n.filter(r=>!!["polygon","line"].includes(r.type)).map(r=>r.type==="polygon"?F(A({},r.annotation),{pointList:O.concatBeginAndEnd(r.annotation.pointList)}):r.annotation),s=(r,a)=>{const{dropFoot:c}=O.getClosestPoint(r,a,S.Line,1,{isClose:!1});if(c!==r){const y=`${c.x} + ${c.y}`;t.has(y)||o.push(r),t.add(y)}};return i.forEach(r=>{s(r,e)}),e.forEach(r=>{let a="";a=r.id,e.forEach((c,y)=>{if(c.id===a)return;const h=[...e];h.splice(y,1),c.pointList.forEach(f=>{s(f,h)})})}),{connectionPoints:o}}static getModifiedRectangleCoordinates(n,o,t){if(n.length!==4)throw new Error("Invalid number of coordinates. Four coordinates are required.");const i=n[0],e=n[1],s=n[2],r=Math.sqrt(M(e.x-i.x,2)+M(e.y-i.y,2)),a=Math.sqrt(M(s.x-e.x,2)+M(s.y-e.y,2)),c=o/r,y=t/a,h={x:i.x+(e.x-i.x)*c,y:i.y+(e.y-i.y)*c},f={x:h.x+(s.x-e.x)*y,y:h.y+(s.y-e.y)*y},x={x:i.x+(f.x-e.x),y:i.y+(f.y-e.y)};return[i,h,f,x]}static isPointInsideCube(n,o,t){const[i,e]=t;return!!(B({x:n.x,y:n.y},o)&&n.z>=i&&n.z<=e)}};let u=g;u.isInRange=(n,o)=>{const t=Math.min(...o),i=Math.max(...o),e=r=>r<=i&&r>=t;return(Array.isArray(n)?n:[n]).every(r=>e(r))},u.withinRange=(n,o)=>{const t=Math.min(...o),i=Math.max(...o);return n>i?i:n<t?t:n},u.calcViewportBoundaries=(n,o=!1,t=E,i=1)=>{if(!n)return{top:0,bottom:0,left:0,right:0};const e=20/i,s=[],r=[];let a=n;o&&(a=v(n,t)),a.forEach(({x:p,y:w})=>{s.push(p),r.push(w)});let c=Math.min(...s),y=Math.max(...s),h=Math.min(...r),f=Math.max(...r);const x=y-c,d=f-h;if(x<e){const p=(e-x)/2;c-=p,y+=p}if(d<e){const p=(e-d)/2;h-=p,f+=p}return{top:h,bottom:f,left:c,right:y}},u.getFootOfPerpendicular=(n,o,t,i=!1,e=!1)=>{let s={x:0,y:0};const r=o.x-t.x,a=o.y-t.y;if(Math.abs(r)<1e-8&&Math.abs(a)<1e-8)return s=o,s;let c=(n.x-o.x)*(o.x-t.x)+(n.y-o.y)*(o.y-t.y);c/=r*r+a*a,s.x=o.x+c*r,s.y=o.y+c*a;const y=g.getLineLength(n,s),h=2,f=Math.min(o.x,t.x),x=Math.max(o.x,t.x),d=Math.min(o.y,t.y),p=Math.max(o.y,t.y),w=!(g.isInRange(n.x,[f,x])||g.isInRange(n.y,[d,p])),l=n.x>x+h||n.x<f-h||n.y>p+h||n.y<d-h;return!e&&(i?w:l)?{footPoint:s,length:Infinity}:{footPoint:s,length:y}},u.calculatePointsInsideBox=n=>{const{indexMap:o,polygon:t,zScope:i,box:e}=n;let s=0;return o.forEach((r,a)=>{const c=a.split("@"),y=Number(c[0]),h=Number(c[1]),f=Number(c[2]),x={x:y-.5,y:h-.5,z:f-.5,width:1,height:1,depth:1},d=D(t,i,x);d===2&&(s+=r.length),(d===1||d===0&&(e.width<=1||e.height<=1))&&r.forEach(p=>{g.isPointInsideCube(p,t,i)&&s++})}),s};var W=u;export{m as Trigonometric,W as default};
1
+ import z from"../_virtual/MathUtilsWorker.js";import{SEGMENT_NUMBER as E,DEFAULT_TEXT_MAX_WIDTH as R,DEFAULT_FONT as T,ELineTypes as S}from"../constant/tool.js";import{createSmoothCurvePointsFromPointList as v,isInPolygon as B}from"./tool/polygonTool.js";import O from"./tool/PolygonUtils.js";import P from"./VectorUtils.js";var U=Object.defineProperty,j=Object.defineProperties,N=Object.getOwnPropertyDescriptors,_=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,M=Math.pow,F=(n,o,t)=>o in n?U(n,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[o]=t,I=(n,o)=>{for(var t in o||(o={}))V.call(o,t)&&F(n,t,o[t]);if(_)for(var t of _(o))X.call(o,t)&&F(n,t,o[t]);return n},A=(n,o)=>j(n,N(o));class m{static tanAPlusB(o,t){return(o+t)/(1-o*t)}static sinAPlusB(o,t,i,e){return e*o+t*i}static cosAPlusB(o,t,i,e){return t*e-o*i}}var L;(function(n){n[n.Outside=0]="Outside",n[n.PartiallyInside=1]="PartiallyInside",n[n.FullyInside=2]="FullyInside"})(L||(L={}));function D(n,o,t){const i=[{x:t.x-t.width/2,y:t.y-t.height/2,z:t.z-t.depth/2},{x:t.x+t.width/2,y:t.y-t.height/2,z:t.z-t.depth/2},{x:t.x-t.width/2,y:t.y+t.height/2,z:t.z-t.depth/2},{x:t.x+t.width/2,y:t.y+t.height/2,z:t.z-t.depth/2},{x:t.x-t.width/2,y:t.y-t.height/2,z:t.z+t.depth/2},{x:t.x+t.width/2,y:t.y-t.height/2,z:t.z+t.depth/2},{x:t.x-t.width/2,y:t.y+t.height/2,z:t.z+t.depth/2},{x:t.x+t.width/2,y:t.y+t.height/2,z:t.z+t.depth/2}];let e=0;for(let s=0;s<i.length;s++)u.isPointInsideCube(i[s],n,o)&&e++;return e===0?0:e===8?2:1}const p=class{static getRotate(n){return n+90>=360?n+90-360:n+90}static getLineLength(n,o){return Math.sqrt(Math.pow(o.y-n.y,2)+Math.pow(o.x-n.x,2))}static getTextArea(n,o,t=R,i=T,e){if(typeof o!="string")return{width:0,height:0};const s=n.getContext("2d");s.font=i;let r=0;typeof e=="undefined"&&(e=n&&parseInt(window.getComputedStyle(n).lineHeight,10)||parseInt(window.getComputedStyle(document.body).lineHeight,10));const a=n&&parseInt(window.getComputedStyle(n).fontSize,10)||parseInt(window.getComputedStyle(document.body).fontSize,10)||0,c=o.split(`
2
+ `);let y=0;for(let h=0;h<c.length;h++){const f=c[h].split("");let g="";for(let d=0;d<f.length;d++){const x=g+f[d],l=s.measureText(x).width;l>t&&d>0?(g=f[d],r+=e,y=t):(g=x,l>y&&(y=l))}h!==c.length-1&&(r+=e)}return{width:y,height:r+a,lineHeight:e,fontHeight:a}}static getLineCenterPoint(n){const[o,t]=n,i=P.getVector(o,t);return{x:o.x+i.x/2,y:o.y+i.y/2}}static getPerpendicularLine(n){if(n.length!==2)return;const[o,t]=n,i={x:t.x+t.y-o.y,y:t.y-(t.x-o.x)};return[t,i]}static getPerpendicularFootOfLine(n,o){if(n.length!==2)return n;const t=this.getPerpendicularLine(n);if(!t)return n;const[i,e]=t;return this.getFootOfPerpendicular(o,i,e).footPoint}static getQuadrangleFromTriangle(n){if(n.length!==3)return n;const[o,t,i]=n,e={x:i.x+o.x-t.x,y:i.y+o.y-t.y};return[o,t,i,e]}static getRectPerpendicularOffset(n,o,t){const[i,e]=t,s=this.getFootOfPerpendicular(n,i,e).footPoint,r=this.getFootOfPerpendicular(o,i,e).footPoint,a={x:s.x-r.x,y:s.y-r.y},c=P.add(o,a);return P.getVector(n,c)}static getArrayIndex(n,o){return n<0?o+n:n>=o?n-o:n}static getPointListFromPointOffset(n,o,t){const i=this.getArrayIndex(o-1,n.length),e=this.getArrayIndex(o+1,n.length),s=this.getArrayIndex(o-2,n.length),r=[...n];r[o]=P.add(r[o],t);const a=this.getFootOfPerpendicular(r[o],r[s],r[i]).footPoint,c=this.getFootOfPerpendicular(r[o],r[e],r[s]).footPoint;return r[i]=a,r[e]=c,r}static getRectCenterPoint(n){const[o,,t]=n;return{x:(o.x+t.x)/2,y:(o.y+t.y)/2}}static rotateRectPointList(n=5,o){const t=this.getRectCenterPoint(o),{PI:i}=Math,e=Math.sin(n*i/180),s=Math.cos(n*i/180);return o.map(r=>{const a=P.getVector(t,r),c=P.len(a),y=a.y/c,h=a.x/c;return{x:c*m.cosAPlusB(y,h,e,s)+t.x,y:c*m.sinAPlusB(y,h,e,s)+t.y}})}static getRectangleByRightAngle(n,o){if(o.length!==2)return o;const t=p.getPerpendicularFootOfLine(o,n);return p.getQuadrangleFromTriangle([...o,t])}static getRadiusFromQuadrangle(n){const[,o,t]=n,i=t.y-o.y,e=o.x-t.x,s=this.getLineLength(o,t),r=i/s,a=Math.acos(r);return e>0?Math.PI*2-a:a}static getCollectionPointByAnnotationDataPromise(n){const o=n.filter(e=>e.type==="point").map(e=>e.annotation),t=n.filter(e=>!!["polygon","line"].includes(e.type)).map(e=>e.type==="polygon"?A(I({},e.annotation),{pointList:O.concatBeginAndEnd(e.annotation.pointList)}):e.annotation),i=new z;return{promise:new Promise(function(s){i.postMessage({points:o,backgroundList:t}),i.onmessage=r=>{s(r.data),i.terminate()}}),close:()=>{i.terminate()}}}static getCollectionPointByAnnotationData(n){const o=[],t=new Set,i=n.filter(r=>r.type==="point").map(r=>r.annotation),e=n.filter(r=>!!["polygon","line"].includes(r.type)).map(r=>r.type==="polygon"?A(I({},r.annotation),{pointList:O.concatBeginAndEnd(r.annotation.pointList)}):r.annotation),s=(r,a)=>{const{dropFoot:c}=O.getClosestPoint(r,a,S.Line,1,{isClose:!1});if(c!==r){const y=`${c.x} + ${c.y}`;t.has(y)||o.push(r),t.add(y)}};return i.forEach(r=>{s(r,e)}),e.forEach(r=>{let a="";a=r.id,e.forEach((c,y)=>{if(c.id===a)return;const h=[...e];h.splice(y,1),c.pointList.forEach(f=>{s(f,h)})})}),{connectionPoints:o}}static getModifiedRectangleCoordinates(n,o,t){if(n.length!==4)throw new Error("Invalid number of coordinates. Four coordinates are required.");const i=n[0],e=n[1],s=n[2],r=Math.sqrt(M(e.x-i.x,2)+M(e.y-i.y,2)),a=Math.sqrt(M(s.x-e.x,2)+M(s.y-e.y,2)),c=o/r,y=t/a,h={x:i.x+(e.x-i.x)*c,y:i.y+(e.y-i.y)*c},f={x:h.x+(s.x-e.x)*y,y:h.y+(s.y-e.y)*y},g={x:i.x+(f.x-e.x),y:i.y+(f.y-e.y)};return[i,h,f,g]}static isPointInsideCube(n,o,t){const[i,e]=t;return!!(B({x:n.x,y:n.y},o)&&n.z>=i&&n.z<=e)}static getCurrentPosFromRectCenter(n,o,t){return{x:n.width/2-o.x*t,y:n.height/2-o.y*t}}};let u=p;u.isInRange=(n,o)=>{const t=Math.min(...o),i=Math.max(...o),e=r=>r<=i&&r>=t;return(Array.isArray(n)?n:[n]).every(r=>e(r))},u.withinRange=(n,o)=>{const t=Math.min(...o),i=Math.max(...o);return n>i?i:n<t?t:n},u.calcViewportBoundaries=(n,o=!1,t=E,i=1)=>{if(!n)return{top:0,bottom:0,left:0,right:0};const e=20/i,s=[],r=[];let a=n;o&&(a=v(n,t)),a.forEach(({x,y:w})=>{s.push(x),r.push(w)});let c=Math.min(...s),y=Math.max(...s),h=Math.min(...r),f=Math.max(...r);const g=y-c,d=f-h;if(g<e){const x=(e-g)/2;c-=x,y+=x}if(d<e){const x=(e-d)/2;h-=x,f+=x}return{top:h,bottom:f,left:c,right:y}},u.getFootOfPerpendicular=(n,o,t,i=!1,e=!1)=>{let s={x:0,y:0};const r=o.x-t.x,a=o.y-t.y;if(Math.abs(r)<1e-8&&Math.abs(a)<1e-8)return s=o,s;let c=(n.x-o.x)*(o.x-t.x)+(n.y-o.y)*(o.y-t.y);c/=r*r+a*a,s.x=o.x+c*r,s.y=o.y+c*a;const y=p.getLineLength(n,s),h=2,f=Math.min(o.x,t.x),g=Math.max(o.x,t.x),d=Math.min(o.y,t.y),x=Math.max(o.y,t.y),w=!(p.isInRange(n.x,[f,g])||p.isInRange(n.y,[d,x])),l=n.x>g+h||n.x<f-h||n.y>x+h||n.y<d-h;return!e&&(i?w:l)?{footPoint:s,length:Infinity}:{footPoint:s,length:y}},u.calculatePointsInsideBox=n=>{const{indexMap:o,polygon:t,zScope:i,box:e}=n;let s=0;return o.forEach((r,a)=>{const c=a.split("@"),y=Number(c[0]),h=Number(c[1]),f=Number(c[2]),g={x:y-.5,y:h-.5,z:f-.5,width:1,height:1,depth:1},d=D(t,i,g);d===2&&(s+=r.length),(d===1||d===0&&(e.width<=1||e.height<=1))&&r.forEach(x=>{p.isPointInsideCube(x,t,i)&&s++})}),s};var W=u;export{m as Trigonometric,W as default};
@@ -1 +1 @@
1
- import{polygon as A,difference as B,union as O}from"@turf/turf";import{ERotateDirection as F}from"../../constant/annotation.js";import N from"./CommonToolUtils.js";import{ELineTypes as y,SEGMENT_NUMBER as p}from"../../constant/tool.js";import D from"./AxisUtils.js";import L from"../MathUtils.js";import b from"./LineToolUtils.js";var z=Object.defineProperty,_=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,j=(M,t,e)=>t in M?z(M,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):M[t]=e,S=(M,t)=>{for(var e in t||(t={}))R.call(t,e)&&j(M,e,t[e]);if(_)for(var e of _(t))T.call(t,e)&&j(M,e,t[e]);return M};class h{static getHoverPolygonID(t,e,n=3,i=y.Line){let o="",r=Infinity;const l=D.axisArea(t,n);return e.forEach(s=>{s.pointList&&l.forEach(c=>{const u=this.calcPolygonSize(s.pointList);this.isInPolygon(c,s.pointList,i)&&u<r&&(o=s.id,r=u)})}),o}static calcPolygonSize(t=[]){if((t==null?void 0:t.length)<=2)return 0;const e=t.length,n=t.reduce((i,o,r,l)=>{const s=l[(r+1)%e];return i+o.x*s.y-s.x*o.y},0);return Math.abs(n)/2}static isInPolygon(t,e,n=y.Line){let i=0,o,r,l,s;e=[...e],n===y.Curve&&(e=this.createSmoothCurvePoints(e.reduce((u,d)=>[...u,d.x,d.y],[]),.5,!0,20)),[l]=e;const c=e.length;for(o=1;o<=c;o++)s=e[o%c],t.x>Math.min(l.x,s.x)&&t.x<=Math.max(l.x,s.x)&&t.y<=Math.max(l.y,s.y)&&l.x!==s.x&&(r=(t.x-l.x)*(s.y-l.y)/(s.x-l.x)+l.y,(l.y===s.y||t.y<=r)&&i++),l=s;return i%2!=0}static createSmoothCurvePointsFromPointList(t,e=p){return this.createSmoothCurvePoints(t.reduce((i,o)=>[...i,o.x,o.y],[]),.5,!1,e).map((i,o)=>{var r;const l=o/(p+1),s=Math.floor(l),c=(r=t[s])!=null?r:{};return S(s===l?S({},c):{specialEdge:c.specialEdge},i)})}static createSmoothCurvePoints(t,e=.5,n=!1,i=p){if(t.length<4)return t;const o=[],r=t.slice(0);let l,s,c,u,d,m,v,E,P,I,a,g,f;for(n?(r.unshift(t[t.length-1]),r.unshift(t[t.length-2]),r.unshift(t[t.length-1]),r.unshift(t[t.length-2]),r.push(t[0]),r.push(t[1])):(r.unshift(t[1]),r.unshift(t[0]),r.push(t[t.length-2]),r.push(t[t.length-1])),f=2;f<r.length-4;f+=2)for(c=(r[f+2]-r[f-2])*e,u=(r[f+4]-r[f-0])*e,d=(r[f+3]-r[f-1])*e,m=(r[f+5]-r[f+1])*e,g=0;g<=i;g++)a=g/i,v=2*Math.pow(a,3)-3*Math.pow(a,2)+1,E=-(2*Math.pow(a,3))+3*Math.pow(a,2),P=Math.pow(a,3)-2*Math.pow(a,2)+a,I=Math.pow(a,3)-Math.pow(a,2),l=v*r[f]+E*r[f+2]+P*c+I*u,s=v*r[f+1]+E*r[f+3]+P*d+I*m,o.push(l),o.push(s);const C=[];for(let x=0;x<o.length-1;x+=2)C.push({x:o[x],y:o[x+1]});if(n)for(let x=0;x<i+1;x++){const w=C.shift();C.push(w)}return C}static getPolygonByID(t,e){return t.find(n=>n.id===e)}static getPolygonByIDs(t,e){return e&&(e==null?void 0:e.length)>0?t.filter(n=>e.includes(n.id)):[]}static getHoverEdgeIndex(t,e,n=y.Line,i=3){let o=[...e];n===y.Curve?o=this.createSmoothCurvePoints(e.reduce((s,c)=>[...s,c.x,c.y],[]),.5,!0,p):n===y.Line&&o.push(o[0]);let r=-1,l=i;for(let s=0;s<o.length-1;s++){const{length:c}=L.getFootOfPerpendicular(t,o[s],o[s+1]);c<l&&(r=s,l=c)}return r===-1?-1:n===y.Curve?Math.floor(r/p):r}static getClosestPoint(t,e,n=y.Line,i=3,o){var r;let l=!1;const s=(r=o==null?void 0:o.isClose)!=null?r:!0;let c="",u=-1,d=Infinity,m=t;const v=20;let E=!1;return e.forEach(P=>{if(!E&&!!P.pointList)switch(n){case y.Line:N.findAllLine(P.pointList,s).forEach((a,g)=>{if(E)return;let{length:f,footPoint:C}=L.getFootOfPerpendicular(t,a.point1,a.point2);const x=L.getLineLength(a.point1,t),w=L.getLineLength(a.point2,t);x<i*2&&(C=a.point1,f=x,E=!0),w<i*2&&(C=a.point2,f=w,E=!0),f<d&&f<i&&(c=P.id,u=g,d=f,m=C,l=!0)});break;case y.Curve:{const I=this.createSmoothCurvePoints(P.pointList.reduce((a,g)=>[...a,g.x,g.y],[]),.5,s,v);for(let a=0;a<I.length-1;a++){const{length:g,footPoint:f}=L.getFootOfPerpendicular(t,I[a],I[a+1]);g<d&&g<i&&(c=P.id,u=Math.floor(a/(v+1)),d=g,m=f,l=!0)}}break}}),{dropFoot:m,closestEdgeIndex:u,closestPolygonID:c,hasClosed:l}}static isPointListInPolygon(t,e,n=y.Line){return t.every(i=>this.isInPolygon(i,e,n))}static isPointListOutSidePolygon(t,e,n=y.Line){return t.some(i=>!this.isInPolygon(i,e,n))}static getPolygonArea(t){let e=0;for(let n=0,i=t.length;n<i;n++){const o=t[n].x,r=t[n===t.length-1?0:n+1].y,l=t[n===t.length-1?0:n+1].x,s=t[n].y;e+=o*r*.5,e-=l*s*.5}return Math.abs(e)}static updatePolygonByRotate(t,e=1,n){let i=1;return t===F.Anticlockwise&&(i=-1),i*=e,L.rotateRectPointList(i,n)}static deletePolygonLastPoint(t,e,n,i){return n===i.length-1?t:[...t,{x:e[0],y:e[1]}]}static concatBeginAndEnd(t){return t.length<1?t:[...t,t[0]]}static segmentPolygonByPolygon(t,e){var n,i;try{let o=A([[...h.concatBeginAndEnd(t.map(l=>[l.x,l.y]))]]);return e.forEach(l=>{const s=A([[...h.concatBeginAndEnd(l.pointList.map(u=>[u.x,u.y]))]]),c=B(o,s);c&&(o=c)}),((i=(n=o==null?void 0:o.geometry)==null?void 0:n.coordinates.map(l=>{var s;return((s=o==null?void 0:o.geometry)==null?void 0:s.type)==="MultiPolygon"?l[0].reduce(h.deletePolygonLastPoint,[]):l.reduce(h.deletePolygonLastPoint,[])}))!=null?i:[]).reduce((l,s)=>{const c=s.length,u=s.filter((d,m)=>{const v=(m+1)%c;return!D.getIsInScope(d,s[v],1)});return u.length<3?l:[...l,u]},[])}catch(o){console.error(o)}}static getPolygonPointList(t,e){const n=e.find(i=>i.id===t);return n&&n.pointList&&n.pointList.length>0?n.pointList:[]}static getWrapPolygonIndex(t,e){return e.findIndex(n=>h.isPointListInPolygon(t,n.pointList))}static clipPolygonFromWrapPolygon(t,e){const n=h.isPolygonClosewise(e),i=h.isPolygonClosewise(t),o=h.getClosePointDistanceFromPolygon(t[0],e),r=e[o];let l=[...e.slice(0,o),r,...t,t[0],...e.slice(o,e.length)];return n===i&&(l=[...e.slice(0,o),r,t[0],...t.reverse(),...e.slice(o,e.length)]),l}static isPolygonClosewise(t){const e=t.length;let n,i,o,r=0,l;if(e<3)return 0;for(n=0;n<e;n++)i=(n+1)%e,o=(n+2)%e,l=(t[i].x-t[n].x)*(t[o].y-t[i].y),l-=(t[i].y-t[n].y)*(t[o].x-t[i].x),l<0?r--:l>0&&r++;return r>0?1:r<0?-1:0}static getClosePointDistanceFromPolygon(t,e){let n=Number.MAX_SAFE_INTEGER,i=-1;return e.forEach((o,r)=>{const l=b.calcDistance(t,o);l<n&&(n=l,i=r)}),i}static combinePolygonWithPolygon(t,e){var n,i;try{const o=A([[...h.concatBeginAndEnd(t.pointList.map(u=>[u.x,u.y]))]]),r=A([[...h.concatBeginAndEnd(e.pointList.map(u=>[u.x,u.y]))]]),l=O(o,r),s=[],c=t;if(((i=(n=l==null?void 0:l.geometry)==null?void 0:n.coordinates)==null?void 0:i.length)===1){s.push(e.id);const u=l==null?void 0:l.geometry.coordinates.map(d=>{var m;return((m=l==null?void 0:l.geometry)==null?void 0:m.type)==="MultiPolygon"?d[0].reduce(h.deletePolygonLastPoint,[]):d.reduce(h.deletePolygonLastPoint,[])})[0];c.pointList=u}return{newPolygon:c,unionList:s}}catch(o){console.error(o)}}static composePointList(t,e){let n=0,i=0,o=Number.MAX_VALUE;return t.forEach((r,l)=>{e.forEach((s,c)=>{const u=b.calcDistance(r,s);u<o&&(n=l+1,i=c+1,o=u)})}),[...t.slice(0,n),...e.slice(i,e.length),...e.slice(0,i),...t.slice(n,t.length)]}static composeSegmentPolygonList(t){var e,n;const i=[];for(let o=0;o<t.length;o++)for(let r=0;r<t.length;r++){const l=(e=t[o])==null?void 0:e.pointList,s=(n=t[r])==null?void 0:n.pointList;o!==r&&l&&s&&h.isPointListInPolygon(s,l)&&(t[o].pointList=h.composePointList(l,s),i.unshift(r))}return i.forEach(o=>{t.splice(o,1)}),t}}export{h as default};
1
+ import{polygon as S,difference as _,union as B}from"@turf/turf";import{ERotateDirection as F}from"../../constant/annotation.js";import H from"./CommonToolUtils.js";import{ELineTypes as m,SEGMENT_NUMBER as L}from"../../constant/tool.js";import O from"./AxisUtils.js";import M from"../MathUtils.js";import j from"./LineToolUtils.js";var N=Object.defineProperty,b=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable,D=(C,t,e)=>t in C?N(C,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):C[t]=e,A=(C,t)=>{for(var e in t||(t={}))z.call(t,e)&&D(C,e,t[e]);if(b)for(var e of b(t))R.call(t,e)&&D(C,e,t[e]);return C};class d{static getHoverPolygonID(t,e,n=3,i=m.Line){let o="",r=Infinity;const l=O.axisArea(t,n);return e.forEach(s=>{s.pointList&&l.forEach(c=>{const u=this.calcPolygonSize(s.pointList);this.isInPolygon(c,s.pointList,i)&&u<r&&(o=s.id,r=u)})}),o}static calcPolygonSize(t=[]){if((t==null?void 0:t.length)<=2)return 0;const e=t.length,n=t.reduce((i,o,r,l)=>{const s=l[(r+1)%e];return i+o.x*s.y-s.x*o.y},0);return Math.abs(n)/2}static isInPolygon(t,e,n=m.Line){return e=[...e],n===m.Curve&&(e=this.createSmoothCurvePoints(e.reduce((i,o)=>[...i,o.x,o.y],[]),.5,!0,20)),this.isPointInOrOnPolygon(t,e)}static isPointInOrOnPolygon(t,e,n=1e-9){const{x:i,y:o}=t;let r=!1;for(let l=0,s=e.length-1;l<e.length;s=l++){const{x:c,y:u}=e[l],{x:h,y:g}=e[s],P=i<=Math.max(c,h)&&i>=Math.min(c,h)&&o<=Math.max(u,g)&&o>=Math.min(u,g),x=(o-u)*(h-c)-(i-c)*(g-u);if(P&&Math.abs(x)<n)return!0;u>o!=g>o&&i<(h-c)*(o-u)/(g-u)+c&&(r=!r)}return r}static createSmoothCurvePointsFromPointList(t,e=L){return this.createSmoothCurvePoints(t.reduce((i,o)=>[...i,o.x,o.y],[]),.5,!1,e).map((i,o)=>{var r;const l=o/(L+1),s=Math.floor(l),c=(r=t[s])!=null?r:{};return A(s===l?A({},c):{specialEdge:c.specialEdge},i)})}static createSmoothCurvePoints(t,e=.5,n=!1,i=L){if(t.length<4)return t;const o=[],r=t.slice(0);let l,s,c,u,h,g,P,x,v,E,a,y,f;for(n?(r.unshift(t[t.length-1]),r.unshift(t[t.length-2]),r.unshift(t[t.length-1]),r.unshift(t[t.length-2]),r.push(t[0]),r.push(t[1])):(r.unshift(t[1]),r.unshift(t[0]),r.push(t[t.length-2]),r.push(t[t.length-1])),f=2;f<r.length-4;f+=2)for(c=(r[f+2]-r[f-2])*e,u=(r[f+4]-r[f-0])*e,h=(r[f+3]-r[f-1])*e,g=(r[f+5]-r[f+1])*e,y=0;y<=i;y++)a=y/i,P=2*Math.pow(a,3)-3*Math.pow(a,2)+1,x=-(2*Math.pow(a,3))+3*Math.pow(a,2),v=Math.pow(a,3)-2*Math.pow(a,2)+a,E=Math.pow(a,3)-Math.pow(a,2),l=P*r[f]+x*r[f+2]+v*c+E*u,s=P*r[f+1]+x*r[f+3]+v*h+E*g,o.push(l),o.push(s);const I=[];for(let p=0;p<o.length-1;p+=2)I.push({x:o[p],y:o[p+1]});if(n)for(let p=0;p<i+1;p++){const w=I.shift();I.push(w)}return I}static getPolygonByID(t,e){return t.find(n=>n.id===e)}static getPolygonByIDs(t,e){return e&&(e==null?void 0:e.length)>0?t.filter(n=>e.includes(n.id)):[]}static getHoverEdgeIndex(t,e,n=m.Line,i=5){let o=[...e];n===m.Curve?o=this.createSmoothCurvePoints(e.reduce((s,c)=>[...s,c.x,c.y],[]),.5,!0,L):n===m.Line&&o.push(o[0]);let r=-1,l=i;for(let s=0;s<o.length-1;s++){const{length:c}=M.getFootOfPerpendicular(t,o[s],o[s+1],!0);c<l&&(r=s,l=c)}return r===-1?-1:n===m.Curve?Math.floor(r/L):r}static getClosestPoint(t,e,n=m.Line,i=3,o){var r;let l=!1;const s=(r=o==null?void 0:o.isClose)!=null?r:!0;let c="",u=-1,h=Infinity,g=t;const P=20;let x=!1;return e.forEach(v=>{if(!x&&!!v.pointList)switch(n){case m.Line:H.findAllLine(v.pointList,s).forEach((a,y)=>{if(x)return;let{length:f,footPoint:I}=M.getFootOfPerpendicular(t,a.point1,a.point2);const p=M.getLineLength(a.point1,t),w=M.getLineLength(a.point2,t);p<i*2&&(I=a.point1,f=p,x=!0),w<i*2&&(I=a.point2,f=w,x=!0),f<h&&f<i&&(c=v.id,u=y,h=f,g=I,l=!0)});break;case m.Curve:{const E=this.createSmoothCurvePoints(v.pointList.reduce((a,y)=>[...a,y.x,y.y],[]),.5,s,P);for(let a=0;a<E.length-1;a++){const{length:y,footPoint:f}=M.getFootOfPerpendicular(t,E[a],E[a+1]);y<h&&y<i&&(c=v.id,u=Math.floor(a/(P+1)),h=y,g=f,l=!0)}}break}}),{dropFoot:g,closestEdgeIndex:u,closestPolygonID:c,hasClosed:l}}static isPointListInPolygon(t,e,n=m.Line){return t.every(i=>this.isInPolygon(i,e,n))}static isPointListOutSidePolygon(t,e,n=m.Line){return t.some(i=>!this.isInPolygon(i,e,n))}static getPolygonArea(t){let e=0;for(let n=0,i=t.length;n<i;n++){const o=t[n].x,r=t[n===t.length-1?0:n+1].y,l=t[n===t.length-1?0:n+1].x,s=t[n].y;e+=o*r*.5,e-=l*s*.5}return Math.abs(e)}static updatePolygonByRotate(t,e=1,n){let i=1;return t===F.Anticlockwise&&(i=-1),i*=e,M.rotateRectPointList(i,n)}static deletePolygonLastPoint(t,e,n,i){return n===i.length-1?t:[...t,{x:e[0],y:e[1]}]}static concatBeginAndEnd(t){return t.length<1?t:[...t,t[0]]}static segmentPolygonByPolygon(t,e){var n,i;try{let o=S([[...d.concatBeginAndEnd(t.map(l=>[l.x,l.y]))]]);return e.forEach(l=>{const s=S([[...d.concatBeginAndEnd(l.pointList.map(u=>[u.x,u.y]))]]),c=_(o,s);c&&(o=c)}),((i=(n=o==null?void 0:o.geometry)==null?void 0:n.coordinates.map(l=>{var s;return((s=o==null?void 0:o.geometry)==null?void 0:s.type)==="MultiPolygon"?l[0].reduce(d.deletePolygonLastPoint,[]):l.reduce(d.deletePolygonLastPoint,[])}))!=null?i:[]).reduce((l,s)=>{const c=s.length,u=s.filter((h,g)=>{const P=(g+1)%c;return!O.getIsInScope(h,s[P],1)});return u.length<3?l:[...l,u]},[])}catch(o){console.error(o)}}static getPolygonPointList(t,e){const n=e.find(i=>i.id===t);return n&&n.pointList&&n.pointList.length>0?n.pointList:[]}static getWrapPolygonIndex(t,e){return e.findIndex(n=>d.isPointListInPolygon(t,n.pointList))}static clipPolygonFromWrapPolygon(t,e){const n=d.isPolygonClosewise(e),i=d.isPolygonClosewise(t),o=d.getClosePointDistanceFromPolygon(t[0],e),r=e[o];let l=[...e.slice(0,o),r,...t,t[0],...e.slice(o,e.length)];return n===i&&(l=[...e.slice(0,o),r,t[0],...t.reverse(),...e.slice(o,e.length)]),l}static isPolygonClosewise(t){const e=t.length;let n,i,o,r=0,l;if(e<3)return 0;for(n=0;n<e;n++)i=(n+1)%e,o=(n+2)%e,l=(t[i].x-t[n].x)*(t[o].y-t[i].y),l-=(t[i].y-t[n].y)*(t[o].x-t[i].x),l<0?r--:l>0&&r++;return r>0?1:r<0?-1:0}static getClosePointDistanceFromPolygon(t,e){let n=Number.MAX_SAFE_INTEGER,i=-1;return e.forEach((o,r)=>{const l=j.calcDistance(t,o);l<n&&(n=l,i=r)}),i}static combinePolygonWithPolygon(t,e){var n,i;try{const o=S([[...d.concatBeginAndEnd(t.pointList.map(u=>[u.x,u.y]))]]),r=S([[...d.concatBeginAndEnd(e.pointList.map(u=>[u.x,u.y]))]]),l=B(o,r),s=[],c=t;if(((i=(n=l==null?void 0:l.geometry)==null?void 0:n.coordinates)==null?void 0:i.length)===1){s.push(e.id);const u=l==null?void 0:l.geometry.coordinates.map(h=>{var g;return((g=l==null?void 0:l.geometry)==null?void 0:g.type)==="MultiPolygon"?h[0].reduce(d.deletePolygonLastPoint,[]):h.reduce(d.deletePolygonLastPoint,[])})[0];c.pointList=u}return{newPolygon:c,unionList:s}}catch(o){console.error(o)}}static composePointList(t,e){let n=0,i=0,o=Number.MAX_VALUE;return t.forEach((r,l)=>{e.forEach((s,c)=>{const u=j.calcDistance(r,s);u<o&&(n=l+1,i=c+1,o=u)})}),[...t.slice(0,n),...e.slice(i,e.length),...e.slice(0,i),...t.slice(n,t.length)]}static composeSegmentPolygonList(t){var e,n;const i=[];for(let o=0;o<t.length;o++)for(let r=0;r<t.length;r++){const l=(e=t[o])==null?void 0:e.pointList,s=(n=t[r])==null?void 0:n.pointList;o!==r&&l&&s&&d.isPointListInPolygon(s,l)&&(t[o].pointList=d.composePointList(l,s),i.unshift(r))}return i.forEach(o=>{t.splice(o,1)}),t}static computeConvexHull(t){t.sort((o,r)=>o.x!==r.x?o.x-r.x:o.y-r.y);const e=(o,r,l)=>(r.x-o.x)*(l.y-o.y)-(r.y-o.y)*(l.x-o.x),n=[];for(const o of t){for(;n.length>=2&&e(n[n.length-2],n[n.length-1],o)<=0;)n.pop();n.push(o)}const i=[];for(let o=t.length-1;o>=0;o--){const r=t[o];for(;i.length>=2&&e(i[i.length-2],i[i.length-1],r)<=0;)i.pop();i.push(r)}return i.pop(),n.pop(),n.concat(i)}static createConvexHullGroup(t){const e={};return t.forEach(n=>{n.type==="line"&&(e[n.annotation.id]||(e[n.annotation.id]={points:[],convexHull:[]}),e[n.annotation.id].points.push(...n.annotation.pointList))}),Object.keys(e).forEach(n=>{e[n].convexHull=this.computeConvexHull(e[n].points)}),e}}export{d as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-annotation",
3
- "version": "1.27.0-alpha.7",
3
+ "version": "1.27.0-alpha.70",
4
4
  "description": "Annotation tool collection",
5
5
  "keywords": [
6
6
  "annotation",
@@ -94,7 +94,7 @@
94
94
  "typescript": "^4.2.3"
95
95
  },
96
96
  "dependencies": {
97
- "@labelbee/lb-utils": "1.19.0-alpha.3",
97
+ "@labelbee/lb-utils": "1.19.0-alpha.27",
98
98
  "@turf/turf": "5.1.6",
99
99
  "color-rgba": "^2.3.0",
100
100
  "lodash": "^4.17.20",