@scandit/web-datacapture-core
Version:
Scandit Data Capture SDK for the Web
1 lines • 468 B
JavaScript
function c(t,o){let e=o.x-t.x,n=o.y-t.y;return Math.hypot(e,n)}function h(t){return (c(t.topLeft,t.topRight)+c(t.bottomLeft,t.bottomRight))/2}function f(t){return (c(t.topRight,t.bottomRight)+c(t.bottomLeft,t.topLeft))/2}function i(t){let o=[t.topLeft,t.topRight,t.bottomRight,t.bottomLeft],e=0;for(let n=0;n<o.length;n++){let m=(n+1)%o.length;e+=o[n].x*o[m].y,e-=o[m].x*o[n].y;}return Math.abs(e)/2}export{i as calculateArea,f as calculateHeight,h as calculateWidth};