cornerstone-math
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -17,4 +17,5 @@ const path = require('path'); | ||
library: '[name]', | ||
libraryTarget: 'var', | ||
path: outputPath | ||
libraryTarget: 'umd', | ||
path: outputPath, | ||
umdNamedDefine: true | ||
}, | ||
@@ -21,0 +22,0 @@ devtool: 'source-map', |
@@ -1,4 +0,13 @@ | ||
/*! cornerstone-math - 0.1.4 - 2017-05-19 | (c) 2017 Chris Hafey | https://github.com/chafey/cornerstoneTools */ | ||
var cornerstoneMath = | ||
/******/ (function(modules) { // webpackBootstrap | ||
/*! cornerstone-math - 0.1.5 - 2017-05-22 | (c) 2017 Chris Hafey | https://github.com/chafey/cornerstoneTools */ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(); | ||
else if(typeof define === 'function' && define.amd) | ||
define("cornerstoneMath", [], factory); | ||
else if(typeof exports === 'object') | ||
exports["cornerstoneMath"] = factory(); | ||
else | ||
root["cornerstoneMath"] = factory(); | ||
})(this, function() { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
@@ -2056,2 +2065,3 @@ /******/ var installedModules = {}; | ||
/******/ ]); | ||
}); | ||
//# sourceMappingURL=cornerstoneMath.js.map |
@@ -1,3 +0,3 @@ | ||
/*! cornerstone-math - 0.1.4 - 2017-05-19 | (c) 2017 Chris Hafey | https://github.com/chafey/cornerstoneTools */ | ||
var cornerstoneMath=function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=9)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),r=function(t){return t&&t.__esModule?t:{default:t}}(i),o=n(1),s=function(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0};s.prototype={constructor:s,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("DEPRECATED: Vector3's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},sub:function(t,e){return void 0!==e?(console.warn("DEPRECATED: Vector3's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("DEPRECATED: Vector3's .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyAxisAngle:function(){var t=void 0;return function(e,n){return void 0===t&&(t=new r.default),this.applyQuaternion(t.setFromAxisAngle(e,n)),this}}(),applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i+r[12],this.y=r[1]*e+r[5]*n+r[9]*i+r[13],this.z=r[2]*e+r[6]*n+r[10]*i+r[14],this},applyProjection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,s=t.z,a=t.w,h=a*e+o*i-s*n,u=a*n+s*e-r*i,c=a*i+r*n-o*e,l=-r*e-o*n-s*i;return this.x=h*a+l*-r+u*-s-c*-o,this.y=u*a+l*-o+c*-r-h*-s,this.z=c*a+l*-s+h*-o-u*-r,this},transformDirection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize(),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){if(0!==t){var e=1/t;this.x*=e,this.y*=e,this.z*=e}else this.x=0,this.y=0,this.z=0;return this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this.z>t.z&&(this.z=t.z),this},max:function(t){return this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y),this.z<t.z&&(this.z=t.z),this},clamp:function(t,e){return this.x<t.x?this.x=t.x:this.x>e.x&&(this.x=e.x),this.y<t.y?this.y=t.y:this.y>e.y&&(this.y=e.y),this.z<t.z?this.z=t.z:this.z>e.z&&(this.z=e.z),this},clampScalar:function(){var t=void 0,e=void 0;return function(n,i){return void 0===t&&(t=new s,e=new s),t.set(n,n,n),e.set(i,i,i),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.multiplyScalar(-1)},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},cross:function(t,e){if(void 0!==e)return console.warn("DEPRECATED: Vector3's .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,i=this.y,r=this.z;return this.x=i*t.z-r*t.y,this.y=r*t.x-n*t.z,this.z=n*t.y-i*t.x,this},crossVectors:function(t,e){var n=t.x,i=t.y,r=t.z,o=e.x,s=e.y,a=e.z;return this.x=i*a-r*s,this.y=r*o-n*a,this.z=n*s-i*o,this},projectOnVector:function(){var t=void 0,e=void 0;return function(n){return void 0===t&&(t=new s),t.copy(n).normalize(),e=this.dot(t),this.copy(t).multiplyScalar(e)}}(),projectOnPlane:function(){var t=void 0;return function(e){return void 0===t&&(t=new s),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=void 0;return function(e){return void 0===t&&(t=new s),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/(this.length()*t.length());return Math.acos((0,o.clamp)(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},setFromMatrixPosition:function(t){return this.x=t.elements[12],this.y=t.elements[13],this.z=t.elements[14],this},setFromMatrixScale:function(t){var e=this.set(t.elements[0],t.elements[1],t.elements[2]).length(),n=this.set(t.elements[4],t.elements[5],t.elements[6]).length(),i=this.set(t.elements[8],t.elements[9],t.elements[10]).length();return this.x=e,this.y=n,this.z=i,this},setFromMatrixColumn:function(t,e){var n=4*t,i=e.elements;return this.x=i[n],this.y=i[n+1],this.z=i[n+2],this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t){return this.x=t[0],this.y=t[1],this.z=t[2],this},toArray:function(){return[this.x,this.y,this.z]},clone:function(){return new s(this.x,this.y,this.z)}},e.default=s},function(t,e,n){"use strict";function i(t,e,n){return t<e?e:t>n?n:t}function r(t){return t*(Math.PI/180)}function o(t){return t*(180/Math.PI)}function s(t){return"number"==typeof t?t?t<0?-1:1:t===t?0:NaN:NaN}Object.defineProperty(e,"__esModule",{value:!0}),e.clamp=i,e.degToRad=r,e.radToDeg=o,e.sign=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t,e,n,i){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==i?i:1};i.prototype.setFromAxisAngle=function(t,e){var n=e/2,i=Math.sin(n);return this.x=t.x*i,this.y=t.y*i,this.z=t.z*i,this.w=Math.cos(n),this},i.prototype.multiplyQuaternions=function(t,e){var n=t.x,i=t.y,r=t.z,o=t.w,s=e.x,a=e.y,h=e.z,u=e.w;return this.x=n*u+o*s+i*h-r*a,this.y=i*u+o*a+r*s-n*h,this.z=r*u+o*h+n*a-i*s,this.w=o*u-n*s-i*a-r*h,this},i.prototype.setFromRotationMatrix=function(t){var e=t.elements,n=e[0],i=e[4],r=e[8],o=e[1],s=e[5],a=e[9],h=e[2],u=e[6],c=e[10],l=n+s+c,f=void 0;return l>0?(f=.5/Math.sqrt(l+1),this.w=.25/f,this.x=(u-a)*f,this.y=(r-h)*f,this.z=(o-i)*f):n>s&&n>c?(f=2*Math.sqrt(1+n-s-c),this.w=(u-a)/f,this.x=.25*f,this.y=(i+o)/f,this.z=(r+h)/f):s>c?(f=2*Math.sqrt(1+s-n-c),this.w=(r-h)/f,this.x=(i+o)/f,this.y=.25*f,this.z=(a+u)/f):(f=2*Math.sqrt(1+c-n-s),this.w=(o-i)/f,this.x=(r+h)/f,this.y=(a+u)/f,this.z=.25*f),this},e.default=i},function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(e,n){i(this,t),this.start=void 0!==e?e:new cornerstoneMath.Vector3,this.end=void 0!==n?n:new cornerstoneMath.Vector3}return r(t,[{key:"set",value:function(t,e){return this.start.copy(t),this.end.copy(e),this}},{key:"copy",value:function(t){return this.start.copy(t.start),this.end.copy(t.end),this}},{key:"center",value:function(t){return(t||new cornerstoneMath.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(t){return(t||new cornerstoneMath.Vector3).subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(t,e){var n=e||new cornerstoneMath.Vector3;return this.delta(n).multiplyScalar(t).add(this.start)}},{key:"closestPointToPointParameter",value:function(){var t=new cornerstoneMath.Vector3,e=new cornerstoneMath.Vector3;return function(n,i){t.subVectors(n,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),o=e.dot(t),s=o/r;return i&&(s=cornerstoneMath.Math.clamp(s,0,1)),s}}},{key:"closestPointToPoint",value:function(t,e,n){var i=this.closestPointToPointParameter(t,e),r=n||new cornerstoneMath.Vector3;return this.delta(r).multiplyScalar(i).add(this.start)}},{key:"applyMatrix4",value:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}},{key:"equals",value:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},{key:"clone",value:function(){return(new cornerstoneMath.Line3).copy(this)}},{key:"intersectLine",value:function(t){var e=this.end.clone().sub(this.start),n=t.end.clone().sub(t.start),i=t.start.clone().sub(this.start),r=e.clone().cross(n),o=i.clone().cross(n);if(0!==i.dot(e)){var s=o.dot(r)/r.lengthSq();if(!(s>1||isNaN(s))){var a=this.start.clone().add(e.clone().multiplyScalar(s));return a.clone().sub(t.start).lengthSq()+a.clone().sub(t.end).lengthSq()<=t.distanceSq()?a:void 0}}}}]),t}();e.default=o},function(t,e,n){"use strict";function i(t){return t*t}function r(t,e){return i(t.x-e.x)+i(t.y-e.y)}function o(t,e){var n=r(t.start,t.end);if(0===n)return r(e,t.start);var i=((e.x-t.start.x)*(t.end.x-t.start.x)+(e.y-t.start.y)*(t.end.y-t.start.y))/n;return i<0?r(e,t.start):i>1?r(e,t.end):r(e,{x:t.start.x+i*(t.end.x-t.start.x),y:t.start.y+i*(t.end.y-t.start.y)})}function s(t,e){return Math.sqrt(o(t,e))}function a(t,e){var n={},i=t.start.x,r=t.start.y,o=t.end.x,s=t.end.y,a=e.start.x,h=e.start.y,u=e.end.x,c=e.end.y,l=void 0,f=void 0,y=void 0,d=void 0,p=void 0,x=void 0,m=void 0,v=void 0,g=void 0,b=void 0,z=void 0,M=void 0;if(l=s-r,y=i-o,p=o*r-i*s,g=l*a+y*h+p,b=l*u+y*c+p,(0===g||0===b||cornerstoneMath.sign(g)!==cornerstoneMath.sign(b))&&(f=c-h,d=a-u,x=u*h-a*c,m=f*i+d*r+x,v=f*o+d*s+x,0===m||0===v||cornerstoneMath.sign(m)!==cornerstoneMath.sign(v))){z=l*d-f*y,M=y*x-d*p;var w=parseFloat(M/z);M=f*p-l*x;var P=parseFloat(M/z);return n.x=w,n.y=P,n}}Object.defineProperty(e,"__esModule",{value:!0});var h={distanceToPoint:s,intersectLine:a};e.default=h},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=function(t){return t&&t.__esModule?t:{default:t}}(i),o=function(t,e,n,i,r,o,s,a,h,u,c,l,f,y,d,p){this.elements=new Float32Array(16);var x=this.elements;x[0]=void 0!==t?t:1,x[4]=e||0,x[8]=n||0,x[12]=i||0,x[1]=r||0,x[5]=void 0!==o?o:1,x[9]=s||0,x[13]=a||0,x[2]=h||0,x[6]=u||0,x[10]=void 0!==c?c:1,x[14]=l||0,x[3]=f||0,x[7]=y||0,x[11]=d||0,x[15]=void 0!==p?p:1};o.prototype.makeRotationFromQuaternion=function(t){var e=this.elements,n=t.x,i=t.y,r=t.z,o=t.w,s=n+n,a=i+i,h=r+r,u=n*s,c=n*a,l=n*h,f=i*a,y=i*h,d=r*h,p=o*s,x=o*a,m=o*h;return e[0]=1-(f+d),e[4]=c-m,e[8]=l+x,e[1]=c+m,e[5]=1-(u+d),e[9]=y-p,e[2]=l-x,e[6]=y+p,e[10]=1-(u+f),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},o.prototype.multiplyMatrices=function(t,e){var n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[4],a=n[8],h=n[12],u=n[1],c=n[5],l=n[9],f=n[13],y=n[2],d=n[6],p=n[10],x=n[14],m=n[3],v=n[7],g=n[11],b=n[15],z=i[0],M=i[4],w=i[8],P=i[12],R=i[1],L=i[5],S=i[9],T=i[13],V=i[2],j=i[6],O=i[10],_=i[14],q=i[3],E=i[7],k=i[11],A=i[15];return r[0]=o*z+s*R+a*V+h*q,r[4]=o*M+s*L+a*j+h*E,r[8]=o*w+s*S+a*O+h*k,r[12]=o*P+s*T+a*_+h*A,r[1]=u*z+c*R+l*V+f*q,r[5]=u*M+c*L+l*j+f*E,r[9]=u*w+c*S+l*O+f*k,r[13]=u*P+c*T+l*_+f*A,r[2]=y*z+d*R+p*V+x*q,r[6]=y*M+d*L+p*j+x*E,r[10]=y*w+d*S+p*O+x*k,r[14]=y*P+d*T+p*_+x*A,r[3]=m*z+v*R+g*V+b*q,r[7]=m*M+v*L+g*j+b*E,r[11]=m*w+v*S+g*O+b*k,r[15]=m*P+v*T+g*_+b*A,this},o.prototype.multiply=function(t,e){return void 0!==e?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},o.prototype.getInverse=function(t,e){var n=this.elements,i=t.elements,r=i[0],o=i[4],s=i[8],a=i[12],h=i[1],u=i[5],c=i[9],l=i[13],f=i[2],y=i[6],d=i[10],p=i[14],x=i[3],m=i[7],v=i[11],g=i[15];n[0]=c*p*m-l*d*m+l*y*v-u*p*v-c*y*g+u*d*g,n[4]=a*d*m-s*p*m-a*y*v+o*p*v+s*y*g-o*d*g,n[8]=s*l*m-a*c*m+a*u*v-o*l*v-s*u*g+o*c*g,n[12]=a*c*y-s*l*y-a*u*d+o*l*d+s*u*p-o*c*p,n[1]=l*d*x-c*p*x-l*f*v+h*p*v+c*f*g-h*d*g,n[5]=s*p*x-a*d*x+a*f*v-r*p*v-s*f*g+r*d*g,n[9]=a*c*x-s*l*x-a*h*v+r*l*v+s*h*g-r*c*g,n[13]=s*l*f-a*c*f+a*h*d-r*l*d-s*h*p+r*c*p,n[2]=u*p*x-l*y*x+l*f*m-h*p*m-u*f*g+h*y*g,n[6]=a*y*x-o*p*x-a*f*m+r*p*m+o*f*g-r*y*g,n[10]=o*l*x-a*u*x+a*h*m-r*l*m-o*h*g+r*u*g,n[14]=a*u*f-o*l*f-a*h*y+r*l*y+o*h*p-r*u*p,n[3]=c*y*x-u*d*x-c*f*m+h*d*m+u*f*v-h*y*v,n[7]=o*d*x-s*y*x+s*f*m-r*d*m-o*f*v+r*y*v,n[11]=s*u*x-o*c*x-s*h*m+r*c*m+o*h*v-r*u*v,n[15]=o*c*f-s*u*f+s*h*y-r*c*y-o*h*d+r*u*d;var b=r*n[0]+h*n[4]+f*n[8]+x*n[12];if(0===b){var z="Matrix4.getInverse(): can't invert matrix, determinant is 0";if(e)throw new Error(z);return console.warn(z),this.identity(),this}return this.multiplyScalar(1/b),this},o.prototype.applyToVector3Array=function(){var t=new r.default;return function(e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length);for(var r=0,o=n;r<i;r+=3,o+=3)t.x=e[o],t.y=e[o+1],t.z=e[o+2],t.applyMatrix4(this),e[o]=t.x,e[o+1]=t.y,e[o+2]=t.z;return e}},o.prototype.makeTranslation=function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},o.prototype.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},o.prototype.set=function(t,e,n,i,r,o,s,a,h,u,c,l,f,y,d,p){var x=this.elements;return x[0]=t,x[4]=e,x[8]=n,x[12]=i,x[1]=r,x[5]=o,x[9]=s,x[13]=a,x[2]=h,x[6]=u,x[10]=c,x[14]=l,x[3]=f,x[7]=y,x[11]=d,x[15]=p,this},o.prototype.makeScale=function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=function(t){return t&&t.__esModule?t:{default:t}}(i),o=function(t,e){this.normal=void 0!==t?t:new r.default(1,0,0),this.constant=void 0!==e?e:0};o.prototype={constructor:o,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new r.default,e=new r.default;return function(n,i,r){var o=t.subVectors(r,i).cross(e.subVectors(n,i)).normalize();return this.setFromNormalAndCoplanarPoint(o,n),this}}(),copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var n=this.distanceToPoint(t);return(e||new r.default).copy(this.normal).multiplyScalar(n)},isIntersectionLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectLine:function(){var t=new r.default;return function(e,n){var i=n||new r.default,o=e.delta(t),s=this.normal.dot(o);if(0!==s){var a=-(e.start.dot(this.normal)+this.constant)/s;if(!(a<0||a>1))return i.copy(o).multiplyScalar(a).add(e.start)}else if(0===this.distanceToPoint(e.start))return i.copy(e.start)}}(),intersectPlane:function(t){var e=this.normal.clone().cross(t.normal),n=new r.default,i={origin:n,direction:e};if(this.normal.clone().cross(t.normal).length<1e-10)return i.direction=new r.default,i;var o=this.constant,s=t.constant,a=this.normal.clone().dot(t.normal),h=-(o-s*a)/(1-a*a),u=-(s-o*a)/(1-a*a);return i.origin=this.normal.clone().multiplyScalar(h).add(t.normal.clone().multiplyScalar(u)),i},coplanarPoint:function(t){return(t||new r.default).copy(this.normal).multiplyScalar(-this.constant)},translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant},clone:function(){return(new o).copy(this)}},e.default=o},function(t,e,n){"use strict";function i(t){return{x:t.pageX,y:t.pageY}}function r(t,e){return{x:t.x-e.x,y:t.y-e.y}}function o(t){return{x:t.x,y:t.y}}function s(t,e){return Math.sqrt(a(t,e))}function a(t,e){var n=r(t,e);return n.x*n.x+n.y*n.y}function h(t,e){return!(t.x<e.left||t.x>e.left+e.width||t.y<e.top||t.y>e.top+e.height)}function u(t,e){var n=[],i=void 0;return t.forEach(function(t,r){var o=cornerstoneMath.point.distance(t,e);n.push(o),i=0===r?o:Math.min(o,i)}),t[n.indexOf(i)]}Object.defineProperty(e,"__esModule",{value:!0});var c={subtract:r,copy:o,pageToPoint:i,distance:s,distanceSquared:a,insideRect:h,findClosestPoint:u};e.default=c},function(t,e,n){"use strict";function i(t){return[{start:{x:t.left,y:t.top},end:{x:t.left+t.width,y:t.top}},{start:{x:t.left+t.width,y:t.top},end:{x:t.left+t.width,y:t.top+t.height}},{start:{x:t.left+t.width,y:t.top+t.height},end:{x:t.left,y:t.top+t.height}},{start:{x:t.left,y:t.top+t.height},end:{x:t.left,y:t.top}}]}function r(t,e){var n=655535;return i(t).forEach(function(t){var i=cornerstoneMath.lineSegment.distanceToPoint(t,e);i<n&&(n=i)}),n}function o(t){return{topLeft:{x:t.left,y:t.top},bottomRight:{x:t.left+t.width,y:t.top+t.height}}}function s(t,e){var n=void 0,i=void 0,r=o(t),s=o(e);return n=t.width>=0?e.width>=0?!(r.bottomRight.x<=s.topLeft.x||s.bottomRight.x<=r.topLeft.x):!(r.bottomRight.x<=s.bottomRight.x||s.topLeft.x<=r.topLeft.x):e.width>=0?!(r.topLeft.x<=s.topLeft.x||s.bottomRight.x<=r.bottomRight.x):!(r.topLeft.x<=s.bottomRight.x||s.topLeft.x<=r.bottomRight.x),i=t.height>=0?e.height>=0?!(r.bottomRight.y<=s.topLeft.y||s.bottomRight.y<=r.topLeft.y):!(r.bottomRight.y<=s.bottomRight.y||s.topLeft.y<=r.topLeft.y):e.height>=0?!(r.topLeft.y<=s.topLeft.y||s.bottomRight.y<=r.bottomRight.y):!(r.topLeft.y<=s.bottomRight.y||s.top<=r.bottomRight.y),n&&i}function a(t,e){var n={topLeft:{},bottomRight:{}};if(s(t,e)){var i=o(t),r=o(e);return t.width>=0?e.width>=0?(n.topLeft.x=Math.max(i.topLeft.x,r.topLeft.x),n.bottomRight.x=Math.min(i.bottomRight.x,r.bottomRight.x)):(n.topLeft.x=Math.max(i.topLeft.x,r.bottomRight.x),n.bottomRight.x=Math.min(i.bottomRight.x,r.topLeft.x)):e.width>=0?(n.topLeft.x=Math.min(i.topLeft.x,r.bottomRight.x),n.bottomRight.x=Math.max(i.bottomRight.x,r.topLeft.x)):(n.topLeft.x=Math.min(i.topLeft.x,r.topLeft.x),n.bottomRight.x=Math.max(i.bottomRight.x,r.bottomRight.x)),t.height>=0?e.height>=0?(n.topLeft.y=Math.max(i.topLeft.y,r.topLeft.y),n.bottomRight.y=Math.min(i.bottomRight.y,r.bottomRight.y)):(n.topLeft.y=Math.max(i.topLeft.y,r.bottomRight.y),n.bottomRight.y=Math.min(i.bottomRight.y,r.topLeft.y)):e.height>=0?(n.topLeft.y=Math.min(i.topLeft.y,r.bottomRight.y),n.bottomRight.y=Math.max(i.bottomRight.y,r.topLeft.y)):(n.topLeft.y=Math.min(i.topLeft.y,r.topLeft.y),n.bottomRight.y=Math.max(i.bottomRight.y,r.bottomRight.y)),n}}Object.defineProperty(e,"__esModule",{value:!0});var h={distanceToPoint:r,getIntersectionRect:a};e.default=h},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=n(3);Object.defineProperty(e,"Line3",{enumerable:!0,get:function(){return i(r).default}});var o=n(4);Object.defineProperty(e,"lineSegment",{enumerable:!0,get:function(){return i(o).default}});var s=n(1);Object.defineProperty(e,"clamp",{enumerable:!0,get:function(){return s.clamp}}),Object.defineProperty(e,"degToRad",{enumerable:!0,get:function(){return s.degToRad}}),Object.defineProperty(e,"radToDeg",{enumerable:!0,get:function(){return s.radToDeg}}),Object.defineProperty(e,"sign",{enumerable:!0,get:function(){return s.sign}});var a=n(5);Object.defineProperty(e,"Matrix4",{enumerable:!0,get:function(){return i(a).default}});var h=n(6);Object.defineProperty(e,"plane",{enumerable:!0,get:function(){return i(h).default}});var u=n(7);Object.defineProperty(e,"point",{enumerable:!0,get:function(){return i(u).default}});var c=n(2);Object.defineProperty(e,"quaternion",{enumerable:!0,get:function(){return i(c).default}});var l=n(8);Object.defineProperty(e,"rect",{enumerable:!0,get:function(){return i(l).default}});var f=n(0);Object.defineProperty(e,"Vector3",{enumerable:!0,get:function(){return i(f).default}})}]); | ||
/*! cornerstone-math - 0.1.5 - 2017-05-22 | (c) 2017 Chris Hafey | https://github.com/chafey/cornerstoneTools */ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cornerstoneMath",[],e):"object"==typeof exports?exports.cornerstoneMath=e():t.cornerstoneMath=e()}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=9)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),r=function(t){return t&&t.__esModule?t:{default:t}}(i),o=n(1),s=function(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0};s.prototype={constructor:s,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("DEPRECATED: Vector3's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},sub:function(t,e){return void 0!==e?(console.warn("DEPRECATED: Vector3's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("DEPRECATED: Vector3's .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyAxisAngle:function(){var t=void 0;return function(e,n){return void 0===t&&(t=new r.default),this.applyQuaternion(t.setFromAxisAngle(e,n)),this}}(),applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i+r[12],this.y=r[1]*e+r[5]*n+r[9]*i+r[13],this.z=r[2]*e+r[6]*n+r[10]*i+r[14],this},applyProjection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,s=t.z,a=t.w,h=a*e+o*i-s*n,u=a*n+s*e-r*i,c=a*i+r*n-o*e,l=-r*e-o*n-s*i;return this.x=h*a+l*-r+u*-s-c*-o,this.y=u*a+l*-o+c*-r-h*-s,this.z=c*a+l*-s+h*-o-u*-r,this},transformDirection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize(),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){if(0!==t){var e=1/t;this.x*=e,this.y*=e,this.z*=e}else this.x=0,this.y=0,this.z=0;return this},min:function(t){return this.x>t.x&&(this.x=t.x),this.y>t.y&&(this.y=t.y),this.z>t.z&&(this.z=t.z),this},max:function(t){return this.x<t.x&&(this.x=t.x),this.y<t.y&&(this.y=t.y),this.z<t.z&&(this.z=t.z),this},clamp:function(t,e){return this.x<t.x?this.x=t.x:this.x>e.x&&(this.x=e.x),this.y<t.y?this.y=t.y:this.y>e.y&&(this.y=e.y),this.z<t.z?this.z=t.z:this.z>e.z&&(this.z=e.z),this},clampScalar:function(){var t=void 0,e=void 0;return function(n,i){return void 0===t&&(t=new s,e=new s),t.set(n,n,n),e.set(i,i,i),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.multiplyScalar(-1)},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){var e=this.length();return 0!==e&&t!==e&&this.multiplyScalar(t/e),this},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},cross:function(t,e){if(void 0!==e)return console.warn("DEPRECATED: Vector3's .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,i=this.y,r=this.z;return this.x=i*t.z-r*t.y,this.y=r*t.x-n*t.z,this.z=n*t.y-i*t.x,this},crossVectors:function(t,e){var n=t.x,i=t.y,r=t.z,o=e.x,s=e.y,a=e.z;return this.x=i*a-r*s,this.y=r*o-n*a,this.z=n*s-i*o,this},projectOnVector:function(){var t=void 0,e=void 0;return function(n){return void 0===t&&(t=new s),t.copy(n).normalize(),e=this.dot(t),this.copy(t).multiplyScalar(e)}}(),projectOnPlane:function(){var t=void 0;return function(e){return void 0===t&&(t=new s),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=void 0;return function(e){return void 0===t&&(t=new s),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/(this.length()*t.length());return Math.acos((0,o.clamp)(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},setFromMatrixPosition:function(t){return this.x=t.elements[12],this.y=t.elements[13],this.z=t.elements[14],this},setFromMatrixScale:function(t){var e=this.set(t.elements[0],t.elements[1],t.elements[2]).length(),n=this.set(t.elements[4],t.elements[5],t.elements[6]).length(),i=this.set(t.elements[8],t.elements[9],t.elements[10]).length();return this.x=e,this.y=n,this.z=i,this},setFromMatrixColumn:function(t,e){var n=4*t,i=e.elements;return this.x=i[n],this.y=i[n+1],this.z=i[n+2],this},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t){return this.x=t[0],this.y=t[1],this.z=t[2],this},toArray:function(){return[this.x,this.y,this.z]},clone:function(){return new s(this.x,this.y,this.z)}},e.default=s},function(t,e,n){"use strict";function i(t,e,n){return t<e?e:t>n?n:t}function r(t){return t*(Math.PI/180)}function o(t){return t*(180/Math.PI)}function s(t){return"number"==typeof t?t?t<0?-1:1:t===t?0:NaN:NaN}Object.defineProperty(e,"__esModule",{value:!0}),e.clamp=i,e.degToRad=r,e.radToDeg=o,e.sign=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(t,e,n,i){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==i?i:1};i.prototype.setFromAxisAngle=function(t,e){var n=e/2,i=Math.sin(n);return this.x=t.x*i,this.y=t.y*i,this.z=t.z*i,this.w=Math.cos(n),this},i.prototype.multiplyQuaternions=function(t,e){var n=t.x,i=t.y,r=t.z,o=t.w,s=e.x,a=e.y,h=e.z,u=e.w;return this.x=n*u+o*s+i*h-r*a,this.y=i*u+o*a+r*s-n*h,this.z=r*u+o*h+n*a-i*s,this.w=o*u-n*s-i*a-r*h,this},i.prototype.setFromRotationMatrix=function(t){var e=t.elements,n=e[0],i=e[4],r=e[8],o=e[1],s=e[5],a=e[9],h=e[2],u=e[6],c=e[10],l=n+s+c,f=void 0;return l>0?(f=.5/Math.sqrt(l+1),this.w=.25/f,this.x=(u-a)*f,this.y=(r-h)*f,this.z=(o-i)*f):n>s&&n>c?(f=2*Math.sqrt(1+n-s-c),this.w=(u-a)/f,this.x=.25*f,this.y=(i+o)/f,this.z=(r+h)/f):s>c?(f=2*Math.sqrt(1+s-n-c),this.w=(r-h)/f,this.x=(i+o)/f,this.y=.25*f,this.z=(a+u)/f):(f=2*Math.sqrt(1+c-n-s),this.w=(o-i)/f,this.x=(r+h)/f,this.y=(a+u)/f,this.z=.25*f),this},e.default=i},function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(e,n){i(this,t),this.start=void 0!==e?e:new cornerstoneMath.Vector3,this.end=void 0!==n?n:new cornerstoneMath.Vector3}return r(t,[{key:"set",value:function(t,e){return this.start.copy(t),this.end.copy(e),this}},{key:"copy",value:function(t){return this.start.copy(t.start),this.end.copy(t.end),this}},{key:"center",value:function(t){return(t||new cornerstoneMath.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(t){return(t||new cornerstoneMath.Vector3).subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(t,e){var n=e||new cornerstoneMath.Vector3;return this.delta(n).multiplyScalar(t).add(this.start)}},{key:"closestPointToPointParameter",value:function(){var t=new cornerstoneMath.Vector3,e=new cornerstoneMath.Vector3;return function(n,i){t.subVectors(n,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),o=e.dot(t),s=o/r;return i&&(s=cornerstoneMath.Math.clamp(s,0,1)),s}}},{key:"closestPointToPoint",value:function(t,e,n){var i=this.closestPointToPointParameter(t,e),r=n||new cornerstoneMath.Vector3;return this.delta(r).multiplyScalar(i).add(this.start)}},{key:"applyMatrix4",value:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}},{key:"equals",value:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},{key:"clone",value:function(){return(new cornerstoneMath.Line3).copy(this)}},{key:"intersectLine",value:function(t){var e=this.end.clone().sub(this.start),n=t.end.clone().sub(t.start),i=t.start.clone().sub(this.start),r=e.clone().cross(n),o=i.clone().cross(n);if(0!==i.dot(e)){var s=o.dot(r)/r.lengthSq();if(!(s>1||isNaN(s))){var a=this.start.clone().add(e.clone().multiplyScalar(s));return a.clone().sub(t.start).lengthSq()+a.clone().sub(t.end).lengthSq()<=t.distanceSq()?a:void 0}}}}]),t}();e.default=o},function(t,e,n){"use strict";function i(t){return t*t}function r(t,e){return i(t.x-e.x)+i(t.y-e.y)}function o(t,e){var n=r(t.start,t.end);if(0===n)return r(e,t.start);var i=((e.x-t.start.x)*(t.end.x-t.start.x)+(e.y-t.start.y)*(t.end.y-t.start.y))/n;return i<0?r(e,t.start):i>1?r(e,t.end):r(e,{x:t.start.x+i*(t.end.x-t.start.x),y:t.start.y+i*(t.end.y-t.start.y)})}function s(t,e){return Math.sqrt(o(t,e))}function a(t,e){var n={},i=t.start.x,r=t.start.y,o=t.end.x,s=t.end.y,a=e.start.x,h=e.start.y,u=e.end.x,c=e.end.y,l=void 0,f=void 0,y=void 0,d=void 0,p=void 0,x=void 0,m=void 0,v=void 0,g=void 0,b=void 0,z=void 0,M=void 0;if(l=s-r,y=i-o,p=o*r-i*s,g=l*a+y*h+p,b=l*u+y*c+p,(0===g||0===b||cornerstoneMath.sign(g)!==cornerstoneMath.sign(b))&&(f=c-h,d=a-u,x=u*h-a*c,m=f*i+d*r+x,v=f*o+d*s+x,0===m||0===v||cornerstoneMath.sign(m)!==cornerstoneMath.sign(v))){z=l*d-f*y,M=y*x-d*p;var w=parseFloat(M/z);M=f*p-l*x;var P=parseFloat(M/z);return n.x=w,n.y=P,n}}Object.defineProperty(e,"__esModule",{value:!0});var h={distanceToPoint:s,intersectLine:a};e.default=h},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=function(t){return t&&t.__esModule?t:{default:t}}(i),o=function(t,e,n,i,r,o,s,a,h,u,c,l,f,y,d,p){this.elements=new Float32Array(16);var x=this.elements;x[0]=void 0!==t?t:1,x[4]=e||0,x[8]=n||0,x[12]=i||0,x[1]=r||0,x[5]=void 0!==o?o:1,x[9]=s||0,x[13]=a||0,x[2]=h||0,x[6]=u||0,x[10]=void 0!==c?c:1,x[14]=l||0,x[3]=f||0,x[7]=y||0,x[11]=d||0,x[15]=void 0!==p?p:1};o.prototype.makeRotationFromQuaternion=function(t){var e=this.elements,n=t.x,i=t.y,r=t.z,o=t.w,s=n+n,a=i+i,h=r+r,u=n*s,c=n*a,l=n*h,f=i*a,y=i*h,d=r*h,p=o*s,x=o*a,m=o*h;return e[0]=1-(f+d),e[4]=c-m,e[8]=l+x,e[1]=c+m,e[5]=1-(u+d),e[9]=y-p,e[2]=l-x,e[6]=y+p,e[10]=1-(u+f),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},o.prototype.multiplyMatrices=function(t,e){var n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[4],a=n[8],h=n[12],u=n[1],c=n[5],l=n[9],f=n[13],y=n[2],d=n[6],p=n[10],x=n[14],m=n[3],v=n[7],g=n[11],b=n[15],z=i[0],M=i[4],w=i[8],P=i[12],R=i[1],L=i[5],S=i[9],T=i[13],V=i[2],j=i[6],O=i[10],_=i[14],q=i[3],E=i[7],k=i[11],A=i[15];return r[0]=o*z+s*R+a*V+h*q,r[4]=o*M+s*L+a*j+h*E,r[8]=o*w+s*S+a*O+h*k,r[12]=o*P+s*T+a*_+h*A,r[1]=u*z+c*R+l*V+f*q,r[5]=u*M+c*L+l*j+f*E,r[9]=u*w+c*S+l*O+f*k,r[13]=u*P+c*T+l*_+f*A,r[2]=y*z+d*R+p*V+x*q,r[6]=y*M+d*L+p*j+x*E,r[10]=y*w+d*S+p*O+x*k,r[14]=y*P+d*T+p*_+x*A,r[3]=m*z+v*R+g*V+b*q,r[7]=m*M+v*L+g*j+b*E,r[11]=m*w+v*S+g*O+b*k,r[15]=m*P+v*T+g*_+b*A,this},o.prototype.multiply=function(t,e){return void 0!==e?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},o.prototype.getInverse=function(t,e){var n=this.elements,i=t.elements,r=i[0],o=i[4],s=i[8],a=i[12],h=i[1],u=i[5],c=i[9],l=i[13],f=i[2],y=i[6],d=i[10],p=i[14],x=i[3],m=i[7],v=i[11],g=i[15];n[0]=c*p*m-l*d*m+l*y*v-u*p*v-c*y*g+u*d*g,n[4]=a*d*m-s*p*m-a*y*v+o*p*v+s*y*g-o*d*g,n[8]=s*l*m-a*c*m+a*u*v-o*l*v-s*u*g+o*c*g,n[12]=a*c*y-s*l*y-a*u*d+o*l*d+s*u*p-o*c*p,n[1]=l*d*x-c*p*x-l*f*v+h*p*v+c*f*g-h*d*g,n[5]=s*p*x-a*d*x+a*f*v-r*p*v-s*f*g+r*d*g,n[9]=a*c*x-s*l*x-a*h*v+r*l*v+s*h*g-r*c*g,n[13]=s*l*f-a*c*f+a*h*d-r*l*d-s*h*p+r*c*p,n[2]=u*p*x-l*y*x+l*f*m-h*p*m-u*f*g+h*y*g,n[6]=a*y*x-o*p*x-a*f*m+r*p*m+o*f*g-r*y*g,n[10]=o*l*x-a*u*x+a*h*m-r*l*m-o*h*g+r*u*g,n[14]=a*u*f-o*l*f-a*h*y+r*l*y+o*h*p-r*u*p,n[3]=c*y*x-u*d*x-c*f*m+h*d*m+u*f*v-h*y*v,n[7]=o*d*x-s*y*x+s*f*m-r*d*m-o*f*v+r*y*v,n[11]=s*u*x-o*c*x-s*h*m+r*c*m+o*h*v-r*u*v,n[15]=o*c*f-s*u*f+s*h*y-r*c*y-o*h*d+r*u*d;var b=r*n[0]+h*n[4]+f*n[8]+x*n[12];if(0===b){var z="Matrix4.getInverse(): can't invert matrix, determinant is 0";if(e)throw new Error(z);return console.warn(z),this.identity(),this}return this.multiplyScalar(1/b),this},o.prototype.applyToVector3Array=function(){var t=new r.default;return function(e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length);for(var r=0,o=n;r<i;r+=3,o+=3)t.x=e[o],t.y=e[o+1],t.z=e[o+2],t.applyMatrix4(this),e[o]=t.x,e[o+1]=t.y,e[o+2]=t.z;return e}},o.prototype.makeTranslation=function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},o.prototype.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},o.prototype.set=function(t,e,n,i,r,o,s,a,h,u,c,l,f,y,d,p){var x=this.elements;return x[0]=t,x[4]=e,x[8]=n,x[12]=i,x[1]=r,x[5]=o,x[9]=s,x[13]=a,x[2]=h,x[6]=u,x[10]=c,x[14]=l,x[3]=f,x[7]=y,x[11]=d,x[15]=p,this},o.prototype.makeScale=function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=function(t){return t&&t.__esModule?t:{default:t}}(i),o=function(t,e){this.normal=void 0!==t?t:new r.default(1,0,0),this.constant=void 0!==e?e:0};o.prototype={constructor:o,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new r.default,e=new r.default;return function(n,i,r){var o=t.subVectors(r,i).cross(e.subVectors(n,i)).normalize();return this.setFromNormalAndCoplanarPoint(o,n),this}}(),copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var n=this.distanceToPoint(t);return(e||new r.default).copy(this.normal).multiplyScalar(n)},isIntersectionLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectLine:function(){var t=new r.default;return function(e,n){var i=n||new r.default,o=e.delta(t),s=this.normal.dot(o);if(0!==s){var a=-(e.start.dot(this.normal)+this.constant)/s;if(!(a<0||a>1))return i.copy(o).multiplyScalar(a).add(e.start)}else if(0===this.distanceToPoint(e.start))return i.copy(e.start)}}(),intersectPlane:function(t){var e=this.normal.clone().cross(t.normal),n=new r.default,i={origin:n,direction:e};if(this.normal.clone().cross(t.normal).length<1e-10)return i.direction=new r.default,i;var o=this.constant,s=t.constant,a=this.normal.clone().dot(t.normal),h=-(o-s*a)/(1-a*a),u=-(s-o*a)/(1-a*a);return i.origin=this.normal.clone().multiplyScalar(h).add(t.normal.clone().multiplyScalar(u)),i},coplanarPoint:function(t){return(t||new r.default).copy(this.normal).multiplyScalar(-this.constant)},translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant},clone:function(){return(new o).copy(this)}},e.default=o},function(t,e,n){"use strict";function i(t){return{x:t.pageX,y:t.pageY}}function r(t,e){return{x:t.x-e.x,y:t.y-e.y}}function o(t){return{x:t.x,y:t.y}}function s(t,e){return Math.sqrt(a(t,e))}function a(t,e){var n=r(t,e);return n.x*n.x+n.y*n.y}function h(t,e){return!(t.x<e.left||t.x>e.left+e.width||t.y<e.top||t.y>e.top+e.height)}function u(t,e){var n=[],i=void 0;return t.forEach(function(t,r){var o=cornerstoneMath.point.distance(t,e);n.push(o),i=0===r?o:Math.min(o,i)}),t[n.indexOf(i)]}Object.defineProperty(e,"__esModule",{value:!0});var c={subtract:r,copy:o,pageToPoint:i,distance:s,distanceSquared:a,insideRect:h,findClosestPoint:u};e.default=c},function(t,e,n){"use strict";function i(t){return[{start:{x:t.left,y:t.top},end:{x:t.left+t.width,y:t.top}},{start:{x:t.left+t.width,y:t.top},end:{x:t.left+t.width,y:t.top+t.height}},{start:{x:t.left+t.width,y:t.top+t.height},end:{x:t.left,y:t.top+t.height}},{start:{x:t.left,y:t.top+t.height},end:{x:t.left,y:t.top}}]}function r(t,e){var n=655535;return i(t).forEach(function(t){var i=cornerstoneMath.lineSegment.distanceToPoint(t,e);i<n&&(n=i)}),n}function o(t){return{topLeft:{x:t.left,y:t.top},bottomRight:{x:t.left+t.width,y:t.top+t.height}}}function s(t,e){var n=void 0,i=void 0,r=o(t),s=o(e);return n=t.width>=0?e.width>=0?!(r.bottomRight.x<=s.topLeft.x||s.bottomRight.x<=r.topLeft.x):!(r.bottomRight.x<=s.bottomRight.x||s.topLeft.x<=r.topLeft.x):e.width>=0?!(r.topLeft.x<=s.topLeft.x||s.bottomRight.x<=r.bottomRight.x):!(r.topLeft.x<=s.bottomRight.x||s.topLeft.x<=r.bottomRight.x),i=t.height>=0?e.height>=0?!(r.bottomRight.y<=s.topLeft.y||s.bottomRight.y<=r.topLeft.y):!(r.bottomRight.y<=s.bottomRight.y||s.topLeft.y<=r.topLeft.y):e.height>=0?!(r.topLeft.y<=s.topLeft.y||s.bottomRight.y<=r.bottomRight.y):!(r.topLeft.y<=s.bottomRight.y||s.top<=r.bottomRight.y),n&&i}function a(t,e){var n={topLeft:{},bottomRight:{}};if(s(t,e)){var i=o(t),r=o(e);return t.width>=0?e.width>=0?(n.topLeft.x=Math.max(i.topLeft.x,r.topLeft.x),n.bottomRight.x=Math.min(i.bottomRight.x,r.bottomRight.x)):(n.topLeft.x=Math.max(i.topLeft.x,r.bottomRight.x),n.bottomRight.x=Math.min(i.bottomRight.x,r.topLeft.x)):e.width>=0?(n.topLeft.x=Math.min(i.topLeft.x,r.bottomRight.x),n.bottomRight.x=Math.max(i.bottomRight.x,r.topLeft.x)):(n.topLeft.x=Math.min(i.topLeft.x,r.topLeft.x),n.bottomRight.x=Math.max(i.bottomRight.x,r.bottomRight.x)),t.height>=0?e.height>=0?(n.topLeft.y=Math.max(i.topLeft.y,r.topLeft.y),n.bottomRight.y=Math.min(i.bottomRight.y,r.bottomRight.y)):(n.topLeft.y=Math.max(i.topLeft.y,r.bottomRight.y),n.bottomRight.y=Math.min(i.bottomRight.y,r.topLeft.y)):e.height>=0?(n.topLeft.y=Math.min(i.topLeft.y,r.bottomRight.y),n.bottomRight.y=Math.max(i.bottomRight.y,r.topLeft.y)):(n.topLeft.y=Math.min(i.topLeft.y,r.topLeft.y),n.bottomRight.y=Math.max(i.bottomRight.y,r.bottomRight.y)),n}}Object.defineProperty(e,"__esModule",{value:!0});var h={distanceToPoint:r,getIntersectionRect:a};e.default=h},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var r=n(3);Object.defineProperty(e,"Line3",{enumerable:!0,get:function(){return i(r).default}});var o=n(4);Object.defineProperty(e,"lineSegment",{enumerable:!0,get:function(){return i(o).default}});var s=n(1);Object.defineProperty(e,"clamp",{enumerable:!0,get:function(){return s.clamp}}),Object.defineProperty(e,"degToRad",{enumerable:!0,get:function(){return s.degToRad}}),Object.defineProperty(e,"radToDeg",{enumerable:!0,get:function(){return s.radToDeg}}),Object.defineProperty(e,"sign",{enumerable:!0,get:function(){return s.sign}});var a=n(5);Object.defineProperty(e,"Matrix4",{enumerable:!0,get:function(){return i(a).default}});var h=n(6);Object.defineProperty(e,"plane",{enumerable:!0,get:function(){return i(h).default}});var u=n(7);Object.defineProperty(e,"point",{enumerable:!0,get:function(){return i(u).default}});var c=n(2);Object.defineProperty(e,"quaternion",{enumerable:!0,get:function(){return i(c).default}});var l=n(8);Object.defineProperty(e,"rect",{enumerable:!0,get:function(){return i(l).default}});var f=n(0);Object.defineProperty(e,"Vector3",{enumerable:!0,get:function(){return i(f).default}})}])}); | ||
//# sourceMappingURL=cornerstoneMath.min.js.map |
132
package.json
{ | ||
"name": "cornerstone-math", | ||
"version": "0.1.4", | ||
"description": "Math and computation geometry functionality for cornerstone", | ||
"keywords": [ | ||
"DICOM", | ||
"medical", | ||
"imaging", | ||
"cornerstone", | ||
"math", | ||
"computation geometry" | ||
], | ||
"author": "Chris Hafey", | ||
"homepage": "https://github.com/chafey/cornerstoneMath", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/chafey/cornerstoneMath.git" | ||
}, | ||
"scripts": { | ||
"eslint": "eslint -c .eslintrc.js src", | ||
"eslint-quiet": "eslint -c .eslintrc.js --quiet src", | ||
"eslint-fix": "eslint -c .eslintrc.js --fix src", | ||
"clean": "npm run clean:dist && npm run clean:coverage", | ||
"clean:dist": "shx rm -rf dist", | ||
"clean:docs": "shx rm -rf documentation", | ||
"clean:coverage": "shx rm -rf coverage", | ||
"doc": "npm run doc:generate && opn documentation/index.html", | ||
"doc:generate": "npm run clean:docs && jsdoc -c .jsdocrc", | ||
"version": "node -p -e \"'export default \\'' + require('./package.json').version + '\\';'\" > src/version.js", | ||
"build": "npm run test && npm run version && npm run webpack && npm run doc:generate", | ||
"webpack": "npm run clean:dist && npm run webpack:prod && npm run webpack:dev", | ||
"webpack:dev": "ENV=dev webpack --progress --config ./config/webpack", | ||
"webpack:prod": "ENV=prod webpack --progress --config ./config/webpack", | ||
"webpack:watch": "webpack --progress --debug --watch --config ./config/webpack", | ||
"watch": "npm run webpack:watch", | ||
"start": "npm run webpack", | ||
"test": "npm run test:phantom", | ||
"test:watch": "karma start config/karma/karma-watch.js", | ||
"test:phantom": "karma start config/karma/karma-phantom.js", | ||
"test:chrome": "karma start config/karma/karma-chrome.js", | ||
"test:firefox": "karma start config/karma/karma-firefox.js", | ||
"test:all": "npm run test:phantom && npm run test:chrome && npm run test:firefox" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.24.1", | ||
"babel-loader": "^6.4.1", | ||
"babel-preset-env": "^1.3.2", | ||
"chai": "^3.5.0", | ||
"docdash": "^0.4.0", | ||
"eslint": "^3.19.0", | ||
"eslint-loader": "^1.7.1", | ||
"istanbul-instrumenter-loader": "^2.0.0", | ||
"jsdoc": "^3.4.3", | ||
"karma": "^1.6.0", | ||
"karma-chrome-launcher": "^2.0.0", | ||
"karma-coverage": "^1.1.1", | ||
"karma-firefox-launcher": "^1.0.1", | ||
"karma-mocha": "^1.3.0", | ||
"karma-phantomjs-launcher": "^1.0.4", | ||
"karma-webpack": "^2.0.3", | ||
"mocha": "^3.2.0", | ||
"opn-cli": "^3.1.0", | ||
"shx": "^0.2.2", | ||
"webpack": "^2.4.1" | ||
} | ||
"name": "cornerstone-math", | ||
"version": "0.1.5", | ||
"description": "Math and computation geometry functionality for cornerstone", | ||
"main": "./dist/cornerstoneMath.min.js", | ||
"keywords": [ | ||
"DICOM", | ||
"medical", | ||
"imaging", | ||
"cornerstone", | ||
"math", | ||
"computation geometry" | ||
], | ||
"author": "Chris Hafey", | ||
"homepage": "https://github.com/chafey/cornerstoneMath", | ||
"license": "MIT", | ||
"module": "src/index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/chafey/cornerstoneMath.git" | ||
}, | ||
"scripts": { | ||
"eslint": "eslint -c .eslintrc.js src", | ||
"eslint-quiet": "eslint -c .eslintrc.js --quiet src", | ||
"eslint-fix": "eslint -c .eslintrc.js --fix src", | ||
"clean": "npm run clean:dist && npm run clean:coverage", | ||
"clean:dist": "shx rm -rf dist", | ||
"clean:docs": "shx rm -rf documentation", | ||
"clean:coverage": "shx rm -rf coverage", | ||
"doc": "npm run doc:generate && opn documentation/index.html", | ||
"doc:generate": "npm run clean:docs && jsdoc -c .jsdocrc", | ||
"version": "node -p -e \"'export default \\'' + require('./package.json').version + '\\';'\" > src/version.js", | ||
"build": "npm run test && npm run version && npm run webpack && npm run doc:generate", | ||
"webpack": "npm run clean:dist && npm run webpack:prod && npm run webpack:dev", | ||
"webpack:dev": "ENV=dev webpack --progress --config ./config/webpack", | ||
"webpack:prod": "ENV=prod webpack --progress --config ./config/webpack", | ||
"webpack:watch": "webpack --progress --debug --watch --config ./config/webpack", | ||
"watch": "npm run webpack:watch", | ||
"start": "npm run webpack", | ||
"test": "npm run test:phantom", | ||
"test:watch": "karma start config/karma/karma-watch.js", | ||
"test:phantom": "karma start config/karma/karma-phantom.js", | ||
"test:chrome": "karma start config/karma/karma-chrome.js", | ||
"test:firefox": "karma start config/karma/karma-firefox.js", | ||
"test:all": "npm run test:phantom && npm run test:chrome && npm run test:firefox" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.24.1", | ||
"babel-loader": "^6.4.1", | ||
"babel-preset-env": "^1.3.2", | ||
"chai": "^3.5.0", | ||
"docdash": "^0.4.0", | ||
"eslint": "^3.19.0", | ||
"eslint-loader": "^1.7.1", | ||
"istanbul-instrumenter-loader": "^2.0.0", | ||
"jsdoc": "^3.4.3", | ||
"karma": "^1.6.0", | ||
"karma-chrome-launcher": "^2.0.0", | ||
"karma-coverage": "^1.1.1", | ||
"karma-firefox-launcher": "^1.0.1", | ||
"karma-mocha": "^1.3.0", | ||
"karma-phantomjs-launcher": "^1.0.4", | ||
"karma-webpack": "^2.0.3", | ||
"mocha": "^3.2.0", | ||
"opn-cli": "^3.1.0", | ||
"shx": "^0.2.2", | ||
"webpack": "^2.4.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
515312
2129