Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vertexvis/geometry

Package Overview
Dependencies
Maintainers
5
Versions
632
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vertexvis/geometry - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

27

dist/bundle.cjs.js

@@ -5,2 +5,4 @@ 'use strict';

var tslib = require('tslib');
/**

@@ -117,25 +119,2 @@ * Returns a new `Point` with the given horizontal and vertical position.

/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
function create$1() {

@@ -424,3 +403,3 @@ var args = [];

}
var boxes = __spreadArrays([box], rest);
var boxes = tslib.__spreadArrays([box], rest);
return boxes.reduce(function (a, b) {

@@ -427,0 +406,0 @@ return create$2(min(a.min, b.min), max(a.max, b.max));

@@ -1,17 +0,2 @@

"use strict";function t(t,n){return void 0===t&&(t=0),void 0===n&&(n=0),{x:t,y:n}}function n(t,n){return{x:t.x-n.x,y:t.y-n.y}}function r(t,n){return{x:t.x+n.x,y:t.y+n.y}}function e(t,n){return t.x===n.x&&t.y===n.y}Object.defineProperty(exports,"__esModule",{value:!0});var i=Object.freeze({__proto__:null,create:t,polar:function(n,r){var e=o(r);return t(Math.cos(a(e))*n,Math.sin(a(e))*n)},distance:function(t,r){var e=n(t,r);return Math.sqrt(e.x*e.x+e.y*e.y)},subtract:n,add:r,isEqual:e,negate:function(n){return t(-n.x,-n.y)},scale:function(t,n,r){return{x:t.x*n,y:t.y*r}}}),o=function(t){return(t+3600)%360},u=function(t){return t*(180/Math.PI)},a=function(t){return t*(Math.PI/180)},c=Object.freeze({__proto__:null,fromPoints:function(t,r){var e=n(r,t),i=Math.atan2(e.y,e.x);return o(u(i)-270)},normalize:o,toDegrees:u,toRadians:a});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function h(){for(var t=0,n=0,r=arguments.length;n<r;n++)t+=arguments[n].length;var e=Array(t),i=0;for(n=0;n<r;n++)for(var o=arguments[n],u=0,a=o.length;u<a;u++,i++)e[i]=o[u];return e}function f(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 1===t.length?{x:t[0].x||0,y:t[0].y||0,z:t[0].z||0}:3===t.length?{x:t[0],y:t[1],z:t[2]}:{x:0,y:0,z:0}}var x=function(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z)},y=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return n.reduce((function(t,n){return{x:t.x+n.x,y:t.y+n.y,z:t.z+n.z}}),t)},d=function(t,n){return{x:n.x*t,y:n.y*t,z:n.z*t}},s=function(t,n){return t.x*n.x+t.y*n.y+t.z*n.z},l=function(t,n){return f(Math.max(t.x,n.x),Math.max(t.y,n.y),Math.max(t.z,n.z))},z=function(t,n){return f(Math.min(t.x,n.x),Math.min(t.y,n.y),Math.min(t.z,n.z))},g=Object.freeze({__proto__:null,create:f,isValid:function(t){return[t.x,t.y,t.z].every((function(t){return isFinite(t)&&!isNaN(t)}))},fromArray:function(t){return f(t[0],t[1],t[2])},toArray:function(t){return[t.x,t.y,t.z]},right:function(){return f(1,0,0)},up:function(){return f(0,1,0)},forward:function(){return f(0,0,-1)},left:function(){return f(-1,0,0)},down:function(){return f(0,-1,0)},back:function(){return f(0,0,1)},origin:function(){return f(0,0,0)},normalize:function(t){var n=x(t);return{x:t.x/n,y:t.y/n,z:t.z/n}},magnitude:x,cross:function(t,n){return{x:t.y*n.z-t.z*n.y,y:t.z*n.x-t.x*n.z,z:t.x*n.y-t.y*n.x}},add:y,subtract:function(t,n){return{x:t.x-n.x,y:t.y-n.y,z:t.z-n.z}},multiply:function(t,n){return{x:t.x*n.x,y:t.y*n.y,z:t.z*n.z}},scale:d,dot:s,angleTo:function(t,n){var r=s(t,n)/(x(t)*x(n));return Math.acos(r)},projection:function(t,n){return d(s(t,n)/x(t),t)},rotateAboutAxis:function(t,n,r,e){if(0!==t){var i=n.x,o=n.y,u=n.z,a=e.x,c=e.y,h=e.z,f=r.x,x=r.y,y=r.z;return{x:(a*(x*x+y*y)-f*(c*x+h*y-f*i-x*o-y*u))*(1-Math.cos(t))+i*Math.cos(t)+(-h*x+c*y-y*o+x*u)*Math.sin(t),y:(c*(f*f+y*y)-x*(a*f+h*y-f*i-x*o-y*u))*(1-Math.cos(t))+o*Math.cos(t)+(h*f-a*y+y*i-f*u)*Math.sin(t),z:(h*(f*f+x*x)-y*(a*f+c*x-f*i-x*o-y*u))*(1-Math.cos(t))+u*Math.cos(t)+(-c*f+a*x-x*i+f*o)*Math.sin(t)}}return n},distance:function(t,n){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2)+Math.pow(t.z-n.z,2))},isEqual:function(t,n){return t.x===n.x&&t.y===n.y&&t.z===n.z},max:l,min:z}),m=function(t,n){return{min:t,max:n}};function M(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var e=h([t],n);return e.reduce((function(t,n){return m(z(t.min,n.min),l(t.max,n.max))}))}var w=Object.freeze({__proto__:null,create:m,fromVectors:function(t){return M.apply(void 0,t.map((function(t){return m(t,t)})))},center:function(t){return d(.5,y(t.min,t.max))},union:M}),p=function(t,n,r,e){return{x:t,y:n,width:r,height:e}},v=function(t,n){return p(t.x,t.y,n.width,n.height)},_=function(t,r){var e=Math.min(t.width/r.width,t.height/r.height),i=E(e,r),o=n(j(t),F(i));return v(o,i)},b=function(t,r){var e=Math.max(t.width/r.width,t.height/r.height),i=E(e,r),o=n(j(t),F(i));return v(o,i)},j=function(t){return{x:t.x+t.width/2,y:t.y+t.height/2}},O=function(n){return t(n.x,n.y)},q=Object.freeze({__proto__:null,create:p,fromDimensions:function(t){return p(0,0,t.width,t.height)},fromPointAndDimensions:v,fromPoints:function(t,n){var r=Math.min(t.x,n.x),e=Math.min(t.y,n.y),i=Math.max(t.x,n.x),o=Math.max(t.y,n.y);return p(r,e,i-r,o-e)},containFit:_,cropFit:b,isEqual:function(t,n){return e(t,n)&&A(t,n)},offset:function(t,n){return v(r(O(n),t),n)},center:j,topLeft:O,bottomRight:function(n){return t(n.x+n.width,n.y+n.height)},isPortrait:function(t){return t.width<t.height},isLandscape:function(t){return t.width>t.height},isSquare:function(t){return t.width===t.height}}),P=function(t,n){return{width:t,height:n}},A=function(t,n){return t.width===n.width&&t.height===n.height},R=function(t,n,r){return{width:r.width*t,height:r.height*n}},E=function(t,n){return R(t,t,n)},F=function(t){return{x:t.width/2,y:t.height/2}};function V(n,r){return void 0===r&&(r=t()),v(r,n)}var D=Object.freeze({__proto__:null,create:P,square:function(t){return P(t,t)},isEqual:A,scale:R,proportionalScale:E,trim:function(t,n){return{width:Math.min(t.width,n.width),height:Math.min(t.height,n.height)}},containFit:function(t,n){var r=_(V(t),V(n));return{width:r.width,height:r.height}},cropFit:function(t,n){var r=b(V(t),V(n));return{width:r.width,height:r.height}},round:function(t){return{width:Math.round(t.width),height:Math.round(t.height)}},center:F,aspectRatio:function(t){return t.width/t.height},fitToRatio:function(t,n){return n.width>=n.height*t?P(n.height*t,n.height):P(n.width,n.width/t)},toRectangle:V}),B=function(t,n,r,e,i,o){return void 0===t&&(t=1),void 0===n&&(n=0),void 0===r&&(r=0),void 0===e&&(e=1),void 0===i&&(i=0),void 0===o&&(o=0),{a:t,b:n,c:r,d:e,tx:i,ty:o}},I=function(){return B()},L=function(t,n){var r=a(t),e=Math.cos(r),i=Math.sin(r),o=n.a*e+n.c*i,u=n.b*e+n.d*i,c=n.a*-i+n.c*e,h=n.b*-i+n.d*e;return B(o,u,c,h,n.tx,n.ty)},N=function(t,n,r){var e=r.a*t+r.c*n+r.tx,i=r.b*t+r.d*n+r.ty;return B(r.a,r.b,r.c,r.d,e,i)},S=Object.freeze({__proto__:null,create:B,identity:I,translation:function(t,n){return N(t,n,I())},rotation:function(t){return L(t,I())},rotate:L,translate:N,transformPoint:function(n,r){return t(n.a*r.x+n.c*r.y+n.tx,n.b*r.x+n.d*r.y+n.ty)}}),T=function(t,n,r,e){return{x:t,y:n,z:r,w:e}},k=Object.freeze({__proto__:null,create:T}),C=Object.freeze({__proto__:null,create:function(t){if(16!==t.length)throw new Error("Must have 16 items");return t},multiplyVector3:function(t,n){var r=n.x,e=n.y,i=n.z,o=t[0]*r+t[1]*e+t[2]*i+t[3],u=t[4]*r+t[5]*e+t[6]*i+t[7],a=t[8]*r+t[9]*e+t[10]*i+t[11],c=t[12]*r+t[13]*e+t[14]*i+t[15];return T(o,u,a,c)}});exports.Angle=c,exports.BoundingBox=w,exports.Dimensions=D,exports.Matrix=S,exports.Matrix4=C,exports.Point=i,exports.Rectangle=q,exports.Vector3=g,exports.Vector4=k;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib");function n(t,n){return void 0===t&&(t=0),void 0===n&&(n=0),{x:t,y:n}}function r(t,n){return{x:t.x-n.x,y:t.y-n.y}}function e(t,n){return{x:t.x+n.x,y:t.y+n.y}}function i(t,n){return t.x===n.x&&t.y===n.y}var o=Object.freeze({__proto__:null,create:n,polar:function(t,r){var e=u(r);return n(Math.cos(c(e))*t,Math.sin(c(e))*t)},distance:function(t,n){var e=r(t,n);return Math.sqrt(e.x*e.x+e.y*e.y)},subtract:r,add:e,isEqual:i,negate:function(t){return n(-t.x,-t.y)},scale:function(t,n,r){return{x:t.x*n,y:t.y*r}}}),u=function(t){return(t+3600)%360},a=function(t){return t*(180/Math.PI)},c=function(t){return t*(Math.PI/180)},h=Object.freeze({__proto__:null,fromPoints:function(t,n){var e=r(n,t),i=Math.atan2(e.y,e.x);return u(a(i)-270)},normalize:u,toDegrees:a,toRadians:c});function f(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 1===t.length?{x:t[0].x||0,y:t[0].y||0,z:t[0].z||0}:3===t.length?{x:t[0],y:t[1],z:t[2]}:{x:0,y:0,z:0}}var x=function(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z)},y=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return n.reduce((function(t,n){return{x:t.x+n.x,y:t.y+n.y,z:t.z+n.z}}),t)},s=function(t,n){return{x:n.x*t,y:n.y*t,z:n.z*t}},d=function(t,n){return t.x*n.x+t.y*n.y+t.z*n.z},z=function(t,n){return f(Math.max(t.x,n.x),Math.max(t.y,n.y),Math.max(t.z,n.z))},l=function(t,n){return f(Math.min(t.x,n.x),Math.min(t.y,n.y),Math.min(t.z,n.z))},g=Object.freeze({__proto__:null,create:f,isValid:function(t){return[t.x,t.y,t.z].every((function(t){return isFinite(t)&&!isNaN(t)}))},fromArray:function(t){return f(t[0],t[1],t[2])},toArray:function(t){return[t.x,t.y,t.z]},right:function(){return f(1,0,0)},up:function(){return f(0,1,0)},forward:function(){return f(0,0,-1)},left:function(){return f(-1,0,0)},down:function(){return f(0,-1,0)},back:function(){return f(0,0,1)},origin:function(){return f(0,0,0)},normalize:function(t){var n=x(t);return{x:t.x/n,y:t.y/n,z:t.z/n}},magnitude:x,cross:function(t,n){return{x:t.y*n.z-t.z*n.y,y:t.z*n.x-t.x*n.z,z:t.x*n.y-t.y*n.x}},add:y,subtract:function(t,n){return{x:t.x-n.x,y:t.y-n.y,z:t.z-n.z}},multiply:function(t,n){return{x:t.x*n.x,y:t.y*n.y,z:t.z*n.z}},scale:s,dot:d,angleTo:function(t,n){var r=d(t,n)/(x(t)*x(n));return Math.acos(r)},projection:function(t,n){return s(d(t,n)/x(t),t)},rotateAboutAxis:function(t,n,r,e){if(0!==t){var i=n.x,o=n.y,u=n.z,a=e.x,c=e.y,h=e.z,f=r.x,x=r.y,y=r.z;return{x:(a*(x*x+y*y)-f*(c*x+h*y-f*i-x*o-y*u))*(1-Math.cos(t))+i*Math.cos(t)+(-h*x+c*y-y*o+x*u)*Math.sin(t),y:(c*(f*f+y*y)-x*(a*f+h*y-f*i-x*o-y*u))*(1-Math.cos(t))+o*Math.cos(t)+(h*f-a*y+y*i-f*u)*Math.sin(t),z:(h*(f*f+x*x)-y*(a*f+c*x-f*i-x*o-y*u))*(1-Math.cos(t))+u*Math.cos(t)+(-c*f+a*x-x*i+f*o)*Math.sin(t)}}return n},distance:function(t,n){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2)+Math.pow(t.z-n.z,2))},isEqual:function(t,n){return t.x===n.x&&t.y===n.y&&t.z===n.z},max:z,min:l}),m=function(t,n){return{min:t,max:n}};function M(n){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];var i=t.__spreadArrays([n],r);return i.reduce((function(t,n){return m(l(t.min,n.min),z(t.max,n.max))}))}var _=Object.freeze({__proto__:null,create:m,fromVectors:function(t){return M.apply(void 0,t.map((function(t){return m(t,t)})))},center:function(t){return s(.5,y(t.min,t.max))},union:M}),p=function(t,n,r,e){return{x:t,y:n,width:r,height:e}},w=function(t,n){return p(t.x,t.y,n.width,n.height)},v=function(t,n){var e=Math.min(t.width/n.width,t.height/n.height),i=E(e,n),o=r(j(t),F(i));return w(o,i)},b=function(t,n){var e=Math.max(t.width/n.width,t.height/n.height),i=E(e,n),o=r(j(t),F(i));return w(o,i)},j=function(t){return{x:t.x+t.width/2,y:t.y+t.height/2}},q=function(t){return n(t.x,t.y)},O=Object.freeze({__proto__:null,create:p,fromDimensions:function(t){return p(0,0,t.width,t.height)},fromPointAndDimensions:w,fromPoints:function(t,n){var r=Math.min(t.x,n.x),e=Math.min(t.y,n.y),i=Math.max(t.x,n.x),o=Math.max(t.y,n.y);return p(r,e,i-r,o-e)},containFit:v,cropFit:b,isEqual:function(t,n){return i(t,n)&&A(t,n)},offset:function(t,n){return w(e(q(n),t),n)},center:j,topLeft:q,bottomRight:function(t){return n(t.x+t.width,t.y+t.height)},isPortrait:function(t){return t.width<t.height},isLandscape:function(t){return t.width>t.height},isSquare:function(t){return t.width===t.height}}),P=function(t,n){return{width:t,height:n}},A=function(t,n){return t.width===n.width&&t.height===n.height},R=function(t,n,r){return{width:r.width*t,height:r.height*n}},E=function(t,n){return R(t,t,n)},F=function(t){return{x:t.width/2,y:t.height/2}};function V(t,r){return void 0===r&&(r=n()),w(r,t)}var D=Object.freeze({__proto__:null,create:P,square:function(t){return P(t,t)},isEqual:A,scale:R,proportionalScale:E,trim:function(t,n){return{width:Math.min(t.width,n.width),height:Math.min(t.height,n.height)}},containFit:function(t,n){var r=v(V(t),V(n));return{width:r.width,height:r.height}},cropFit:function(t,n){var r=b(V(t),V(n));return{width:r.width,height:r.height}},round:function(t){return{width:Math.round(t.width),height:Math.round(t.height)}},center:F,aspectRatio:function(t){return t.width/t.height},fitToRatio:function(t,n){return n.width>=n.height*t?P(n.height*t,n.height):P(n.width,n.width/t)},toRectangle:V}),B=function(t,n,r,e,i,o){return void 0===t&&(t=1),void 0===n&&(n=0),void 0===r&&(r=0),void 0===e&&(e=1),void 0===i&&(i=0),void 0===o&&(o=0),{a:t,b:n,c:r,d:e,tx:i,ty:o}},I=function(){return B()},L=function(t,n){var r=c(t),e=Math.cos(r),i=Math.sin(r),o=n.a*e+n.c*i,u=n.b*e+n.d*i,a=n.a*-i+n.c*e,h=n.b*-i+n.d*e;return B(o,u,a,h,n.tx,n.ty)},N=function(t,n,r){var e=r.a*t+r.c*n+r.tx,i=r.b*t+r.d*n+r.ty;return B(r.a,r.b,r.c,r.d,e,i)},S=Object.freeze({__proto__:null,create:B,identity:I,translation:function(t,n){return N(t,n,I())},rotation:function(t){return L(t,I())},rotate:L,translate:N,transformPoint:function(t,r){return n(t.a*r.x+t.c*r.y+t.tx,t.b*r.x+t.d*r.y+t.ty)}}),T=function(t,n,r,e){return{x:t,y:n,z:r,w:e}},k=Object.freeze({__proto__:null,create:T}),C=Object.freeze({__proto__:null,create:function(t){if(16!==t.length)throw new Error("Must have 16 items");return t},multiplyVector3:function(t,n){var r=n.x,e=n.y,i=n.z,o=t[0]*r+t[1]*e+t[2]*i+t[3],u=t[4]*r+t[5]*e+t[6]*i+t[7],a=t[8]*r+t[9]*e+t[10]*i+t[11],c=t[12]*r+t[13]*e+t[14]*i+t[15];return T(o,u,a,c)}});exports.Angle=h,exports.BoundingBox=_,exports.Dimensions=D,exports.Matrix=S,exports.Matrix4=C,exports.Point=o,exports.Rectangle=O,exports.Vector3=g,exports.Vector4=k;
//# sourceMappingURL=bundle.cjs.min.js.map

@@ -0,1 +1,3 @@

import { __spreadArrays } from 'tslib';
/**

@@ -112,25 +114,2 @@ * Returns a new `Point` with the given horizontal and vertical position.

/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
function create$1() {

@@ -137,0 +116,0 @@ var args = [];

@@ -1,17 +0,2 @@

function t(t,n){return void 0===t&&(t=0),void 0===n&&(n=0),{x:t,y:n}}function n(t,n){return{x:t.x-n.x,y:t.y-n.y}}function r(t,n){return{x:t.x+n.x,y:t.y+n.y}}function i(t,n){return t.x===n.x&&t.y===n.y}var e=Object.freeze({__proto__:null,create:t,polar:function(n,r){var i=u(r);return t(Math.cos(a(i))*n,Math.sin(a(i))*n)},distance:function(t,r){var i=n(t,r);return Math.sqrt(i.x*i.x+i.y*i.y)},subtract:n,add:r,isEqual:i,negate:function(n){return t(-n.x,-n.y)},scale:function(t,n,r){return{x:t.x*n,y:t.y*r}}}),u=function(t){return(t+3600)%360},o=function(t){return t*(180/Math.PI)},a=function(t){return t*(Math.PI/180)},h=Object.freeze({__proto__:null,fromPoints:function(t,r){var i=n(r,t),e=Math.atan2(i.y,i.x);return u(o(e)-270)},normalize:u,toDegrees:o,toRadians:a});
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function c(){for(var t=0,n=0,r=arguments.length;n<r;n++)t+=arguments[n].length;var i=Array(t),e=0;for(n=0;n<r;n++)for(var u=arguments[n],o=0,a=u.length;o<a;o++,e++)i[e]=u[o];return i}function f(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 1===t.length?{x:t[0].x||0,y:t[0].y||0,z:t[0].z||0}:3===t.length?{x:t[0],y:t[1],z:t[2]}:{x:0,y:0,z:0}}var x=function(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z)},y=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return n.reduce((function(t,n){return{x:t.x+n.x,y:t.y+n.y,z:t.z+n.z}}),t)},d=function(t,n){return{x:n.x*t,y:n.y*t,z:n.z*t}},s=function(t,n){return t.x*n.x+t.y*n.y+t.z*n.z},z=function(t,n){return f(Math.max(t.x,n.x),Math.max(t.y,n.y),Math.max(t.z,n.z))},l=function(t,n){return f(Math.min(t.x,n.x),Math.min(t.y,n.y),Math.min(t.z,n.z))},g=Object.freeze({__proto__:null,create:f,isValid:function(t){return[t.x,t.y,t.z].every((function(t){return isFinite(t)&&!isNaN(t)}))},fromArray:function(t){return f(t[0],t[1],t[2])},toArray:function(t){return[t.x,t.y,t.z]},right:function(){return f(1,0,0)},up:function(){return f(0,1,0)},forward:function(){return f(0,0,-1)},left:function(){return f(-1,0,0)},down:function(){return f(0,-1,0)},back:function(){return f(0,0,1)},origin:function(){return f(0,0,0)},normalize:function(t){var n=x(t);return{x:t.x/n,y:t.y/n,z:t.z/n}},magnitude:x,cross:function(t,n){return{x:t.y*n.z-t.z*n.y,y:t.z*n.x-t.x*n.z,z:t.x*n.y-t.y*n.x}},add:y,subtract:function(t,n){return{x:t.x-n.x,y:t.y-n.y,z:t.z-n.z}},multiply:function(t,n){return{x:t.x*n.x,y:t.y*n.y,z:t.z*n.z}},scale:d,dot:s,angleTo:function(t,n){var r=s(t,n)/(x(t)*x(n));return Math.acos(r)},projection:function(t,n){return d(s(t,n)/x(t),t)},rotateAboutAxis:function(t,n,r,i){if(0!==t){var e=n.x,u=n.y,o=n.z,a=i.x,h=i.y,c=i.z,f=r.x,x=r.y,y=r.z;return{x:(a*(x*x+y*y)-f*(h*x+c*y-f*e-x*u-y*o))*(1-Math.cos(t))+e*Math.cos(t)+(-c*x+h*y-y*u+x*o)*Math.sin(t),y:(h*(f*f+y*y)-x*(a*f+c*y-f*e-x*u-y*o))*(1-Math.cos(t))+u*Math.cos(t)+(c*f-a*y+y*e-f*o)*Math.sin(t),z:(c*(f*f+x*x)-y*(a*f+h*x-f*e-x*u-y*o))*(1-Math.cos(t))+o*Math.cos(t)+(-h*f+a*x-x*e+f*u)*Math.sin(t)}}return n},distance:function(t,n){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2)+Math.pow(t.z-n.z,2))},isEqual:function(t,n){return t.x===n.x&&t.y===n.y&&t.z===n.z},max:z,min:l}),m=function(t,n){return{min:t,max:n}};function M(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=c([t],n);return i.reduce((function(t,n){return m(l(t.min,n.min),z(t.max,n.max))}))}var w=Object.freeze({__proto__:null,create:m,fromVectors:function(t){return M.apply(void 0,t.map((function(t){return m(t,t)})))},center:function(t){return d(.5,y(t.min,t.max))},union:M}),v=function(t,n,r,i){return{x:t,y:n,width:r,height:i}},_=function(t,n){return v(t.x,t.y,n.width,n.height)},p=function(t,r){var i=Math.min(t.width/r.width,t.height/r.height),e=E(i,r),u=n(j(t),F(e));return _(u,e)},b=function(t,r){var i=Math.max(t.width/r.width,t.height/r.height),e=E(i,r),u=n(j(t),F(e));return _(u,e)},j=function(t){return{x:t.x+t.width/2,y:t.y+t.height/2}},q=function(n){return t(n.x,n.y)},O=Object.freeze({__proto__:null,create:v,fromDimensions:function(t){return v(0,0,t.width,t.height)},fromPointAndDimensions:_,fromPoints:function(t,n){var r=Math.min(t.x,n.x),i=Math.min(t.y,n.y),e=Math.max(t.x,n.x),u=Math.max(t.y,n.y);return v(r,i,e-r,u-i)},containFit:p,cropFit:b,isEqual:function(t,n){return i(t,n)&&A(t,n)},offset:function(t,n){return _(r(q(n),t),n)},center:j,topLeft:q,bottomRight:function(n){return t(n.x+n.width,n.y+n.height)},isPortrait:function(t){return t.width<t.height},isLandscape:function(t){return t.width>t.height},isSquare:function(t){return t.width===t.height}}),P=function(t,n){return{width:t,height:n}},A=function(t,n){return t.width===n.width&&t.height===n.height},R=function(t,n,r){return{width:r.width*t,height:r.height*n}},E=function(t,n){return R(t,t,n)},F=function(t){return{x:t.width/2,y:t.height/2}};function V(n,r){return void 0===r&&(r=t()),_(r,n)}var D=Object.freeze({__proto__:null,create:P,square:function(t){return P(t,t)},isEqual:A,scale:R,proportionalScale:E,trim:function(t,n){return{width:Math.min(t.width,n.width),height:Math.min(t.height,n.height)}},containFit:function(t,n){var r=p(V(t),V(n));return{width:r.width,height:r.height}},cropFit:function(t,n){var r=b(V(t),V(n));return{width:r.width,height:r.height}},round:function(t){return{width:Math.round(t.width),height:Math.round(t.height)}},center:F,aspectRatio:function(t){return t.width/t.height},fitToRatio:function(t,n){return n.width>=n.height*t?P(n.height*t,n.height):P(n.width,n.width/t)},toRectangle:V}),B=function(t,n,r,i,e,u){return void 0===t&&(t=1),void 0===n&&(n=0),void 0===r&&(r=0),void 0===i&&(i=1),void 0===e&&(e=0),void 0===u&&(u=0),{a:t,b:n,c:r,d:i,tx:e,ty:u}},I=function(){return B()},L=function(t,n){var r=a(t),i=Math.cos(r),e=Math.sin(r),u=n.a*i+n.c*e,o=n.b*i+n.d*e,h=n.a*-e+n.c*i,c=n.b*-e+n.d*i;return B(u,o,h,c,n.tx,n.ty)},N=function(t,n,r){var i=r.a*t+r.c*n+r.tx,e=r.b*t+r.d*n+r.ty;return B(r.a,r.b,r.c,r.d,i,e)},S=Object.freeze({__proto__:null,create:B,identity:I,translation:function(t,n){return N(t,n,I())},rotation:function(t){return L(t,I())},rotate:L,translate:N,transformPoint:function(n,r){return t(n.a*r.x+n.c*r.y+n.tx,n.b*r.x+n.d*r.y+n.ty)}}),T=function(t,n,r,i){return{x:t,y:n,z:r,w:i}},k=Object.freeze({__proto__:null,create:T}),C=Object.freeze({__proto__:null,create:function(t){if(16!==t.length)throw new Error("Must have 16 items");return t},multiplyVector3:function(t,n){var r=n.x,i=n.y,e=n.z,u=t[0]*r+t[1]*i+t[2]*e+t[3],o=t[4]*r+t[5]*i+t[6]*e+t[7],a=t[8]*r+t[9]*i+t[10]*e+t[11],h=t[12]*r+t[13]*i+t[14]*e+t[15];return T(u,o,a,h)}});export{h as Angle,w as BoundingBox,D as Dimensions,S as Matrix,C as Matrix4,e as Point,O as Rectangle,g as Vector3,k as Vector4};
import{__spreadArrays as t}from"tslib";function n(t,n){return void 0===t&&(t=0),void 0===n&&(n=0),{x:t,y:n}}function r(t,n){return{x:t.x-n.x,y:t.y-n.y}}function i(t,n){return{x:t.x+n.x,y:t.y+n.y}}function e(t,n){return t.x===n.x&&t.y===n.y}var u=Object.freeze({__proto__:null,create:n,polar:function(t,r){var i=o(r);return n(Math.cos(c(i))*t,Math.sin(c(i))*t)},distance:function(t,n){var i=r(t,n);return Math.sqrt(i.x*i.x+i.y*i.y)},subtract:r,add:i,isEqual:e,negate:function(t){return n(-t.x,-t.y)},scale:function(t,n,r){return{x:t.x*n,y:t.y*r}}}),o=function(t){return(t+3600)%360},a=function(t){return t*(180/Math.PI)},c=function(t){return t*(Math.PI/180)},h=Object.freeze({__proto__:null,fromPoints:function(t,n){var i=r(n,t),e=Math.atan2(i.y,i.x);return o(a(e)-270)},normalize:o,toDegrees:a,toRadians:c});function f(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 1===t.length?{x:t[0].x||0,y:t[0].y||0,z:t[0].z||0}:3===t.length?{x:t[0],y:t[1],z:t[2]}:{x:0,y:0,z:0}}var x=function(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z)},y=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return n.reduce((function(t,n){return{x:t.x+n.x,y:t.y+n.y,z:t.z+n.z}}),t)},d=function(t,n){return{x:n.x*t,y:n.y*t,z:n.z*t}},s=function(t,n){return t.x*n.x+t.y*n.y+t.z*n.z},z=function(t,n){return f(Math.max(t.x,n.x),Math.max(t.y,n.y),Math.max(t.z,n.z))},l=function(t,n){return f(Math.min(t.x,n.x),Math.min(t.y,n.y),Math.min(t.z,n.z))},g=Object.freeze({__proto__:null,create:f,isValid:function(t){return[t.x,t.y,t.z].every((function(t){return isFinite(t)&&!isNaN(t)}))},fromArray:function(t){return f(t[0],t[1],t[2])},toArray:function(t){return[t.x,t.y,t.z]},right:function(){return f(1,0,0)},up:function(){return f(0,1,0)},forward:function(){return f(0,0,-1)},left:function(){return f(-1,0,0)},down:function(){return f(0,-1,0)},back:function(){return f(0,0,1)},origin:function(){return f(0,0,0)},normalize:function(t){var n=x(t);return{x:t.x/n,y:t.y/n,z:t.z/n}},magnitude:x,cross:function(t,n){return{x:t.y*n.z-t.z*n.y,y:t.z*n.x-t.x*n.z,z:t.x*n.y-t.y*n.x}},add:y,subtract:function(t,n){return{x:t.x-n.x,y:t.y-n.y,z:t.z-n.z}},multiply:function(t,n){return{x:t.x*n.x,y:t.y*n.y,z:t.z*n.z}},scale:d,dot:s,angleTo:function(t,n){var r=s(t,n)/(x(t)*x(n));return Math.acos(r)},projection:function(t,n){return d(s(t,n)/x(t),t)},rotateAboutAxis:function(t,n,r,i){if(0!==t){var e=n.x,u=n.y,o=n.z,a=i.x,c=i.y,h=i.z,f=r.x,x=r.y,y=r.z;return{x:(a*(x*x+y*y)-f*(c*x+h*y-f*e-x*u-y*o))*(1-Math.cos(t))+e*Math.cos(t)+(-h*x+c*y-y*u+x*o)*Math.sin(t),y:(c*(f*f+y*y)-x*(a*f+h*y-f*e-x*u-y*o))*(1-Math.cos(t))+u*Math.cos(t)+(h*f-a*y+y*e-f*o)*Math.sin(t),z:(h*(f*f+x*x)-y*(a*f+c*x-f*e-x*u-y*o))*(1-Math.cos(t))+o*Math.cos(t)+(-c*f+a*x-x*e+f*u)*Math.sin(t)}}return n},distance:function(t,n){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2)+Math.pow(t.z-n.z,2))},isEqual:function(t,n){return t.x===n.x&&t.y===n.y&&t.z===n.z},max:z,min:l}),m=function(t,n){return{min:t,max:n}};function M(n){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var e=t([n],r);return e.reduce((function(t,n){return m(l(t.min,n.min),z(t.max,n.max))}))}var w=Object.freeze({__proto__:null,create:m,fromVectors:function(t){return M.apply(void 0,t.map((function(t){return m(t,t)})))},center:function(t){return d(.5,y(t.min,t.max))},union:M}),_=function(t,n,r,i){return{x:t,y:n,width:r,height:i}},v=function(t,n){return _(t.x,t.y,n.width,n.height)},p=function(t,n){var i=Math.min(t.width/n.width,t.height/n.height),e=E(i,n),u=r(j(t),F(e));return v(u,e)},b=function(t,n){var i=Math.max(t.width/n.width,t.height/n.height),e=E(i,n),u=r(j(t),F(e));return v(u,e)},j=function(t){return{x:t.x+t.width/2,y:t.y+t.height/2}},q=function(t){return n(t.x,t.y)},O=Object.freeze({__proto__:null,create:_,fromDimensions:function(t){return _(0,0,t.width,t.height)},fromPointAndDimensions:v,fromPoints:function(t,n){var r=Math.min(t.x,n.x),i=Math.min(t.y,n.y),e=Math.max(t.x,n.x),u=Math.max(t.y,n.y);return _(r,i,e-r,u-i)},containFit:p,cropFit:b,isEqual:function(t,n){return e(t,n)&&A(t,n)},offset:function(t,n){return v(i(q(n),t),n)},center:j,topLeft:q,bottomRight:function(t){return n(t.x+t.width,t.y+t.height)},isPortrait:function(t){return t.width<t.height},isLandscape:function(t){return t.width>t.height},isSquare:function(t){return t.width===t.height}}),P=function(t,n){return{width:t,height:n}},A=function(t,n){return t.width===n.width&&t.height===n.height},R=function(t,n,r){return{width:r.width*t,height:r.height*n}},E=function(t,n){return R(t,t,n)},F=function(t){return{x:t.width/2,y:t.height/2}};function V(t,r){return void 0===r&&(r=n()),v(r,t)}var D=Object.freeze({__proto__:null,create:P,square:function(t){return P(t,t)},isEqual:A,scale:R,proportionalScale:E,trim:function(t,n){return{width:Math.min(t.width,n.width),height:Math.min(t.height,n.height)}},containFit:function(t,n){var r=p(V(t),V(n));return{width:r.width,height:r.height}},cropFit:function(t,n){var r=b(V(t),V(n));return{width:r.width,height:r.height}},round:function(t){return{width:Math.round(t.width),height:Math.round(t.height)}},center:F,aspectRatio:function(t){return t.width/t.height},fitToRatio:function(t,n){return n.width>=n.height*t?P(n.height*t,n.height):P(n.width,n.width/t)},toRectangle:V}),B=function(t,n,r,i,e,u){return void 0===t&&(t=1),void 0===n&&(n=0),void 0===r&&(r=0),void 0===i&&(i=1),void 0===e&&(e=0),void 0===u&&(u=0),{a:t,b:n,c:r,d:i,tx:e,ty:u}},I=function(){return B()},L=function(t,n){var r=c(t),i=Math.cos(r),e=Math.sin(r),u=n.a*i+n.c*e,o=n.b*i+n.d*e,a=n.a*-e+n.c*i,h=n.b*-e+n.d*i;return B(u,o,a,h,n.tx,n.ty)},N=function(t,n,r){var i=r.a*t+r.c*n+r.tx,e=r.b*t+r.d*n+r.ty;return B(r.a,r.b,r.c,r.d,i,e)},S=Object.freeze({__proto__:null,create:B,identity:I,translation:function(t,n){return N(t,n,I())},rotation:function(t){return L(t,I())},rotate:L,translate:N,transformPoint:function(t,r){return n(t.a*r.x+t.c*r.y+t.tx,t.b*r.x+t.d*r.y+t.ty)}}),T=function(t,n,r,i){return{x:t,y:n,z:r,w:i}},k=Object.freeze({__proto__:null,create:T}),C=Object.freeze({__proto__:null,create:function(t){if(16!==t.length)throw new Error("Must have 16 items");return t},multiplyVector3:function(t,n){var r=n.x,i=n.y,e=n.z,u=t[0]*r+t[1]*i+t[2]*e+t[3],o=t[4]*r+t[5]*i+t[6]*e+t[7],a=t[8]*r+t[9]*i+t[10]*e+t[11],c=t[12]*r+t[13]*i+t[14]*e+t[15];return T(u,o,a,c)}});export{h as Angle,w as BoundingBox,D as Dimensions,S as Matrix,C as Matrix4,u as Point,O as Rectangle,g as Vector3,k as Vector4};
//# sourceMappingURL=bundle.esm.min.js.map

12

package.json
{
"name": "@vertexvis/geometry",
"version": "0.6.0",
"version": "0.6.1",
"description": "Library for 2D and 3D geometric types.",

@@ -22,3 +22,3 @@ "author": "Dan Schultz (https://github.com/danschultz)",

"prebuild": "yarn clean",
"build": "./node_modules/@vertexvis/build-tools/bin/build-web.sh",
"build": "rollup --config ./rollup.config.js --silent",
"format": "yarn lint --fix",

@@ -32,12 +32,12 @@ "lint": "eslint --ext .ts,.tsx,.js,.jsx --ignore-path ../../.gitignore .",

"@types/jest": "^24.0.23",
"@vertexvis/build-tools": "0.7.3",
"@vertexvis/eslint-config-vertexvis-typescript": "0.2.2",
"@vertexvis/jest-config-vertexvis": "0.4.2",
"@vertexvis/typescript-config-vertexvis": "1.0.2",
"@vertexvis/jest-config-vertexvis": "0.4.4",
"@vertexwebsdk/build": "0.6.1",
"eslint": "^6.1.0",
"jest": "^24.9.0",
"rollup": "^1.19.4",
"ts-jest": "^24.0.2",
"typescript": "^3.7.4"
},
"gitHead": "e950afff87f090332726c7a1e7a139bacd6da507"
"gitHead": "515783203b4bece966e9e3514bc53d891903e477"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc