From b1a21feea181bc030e47e28b190a03d0df02d930 Mon Sep 17 00:00:00 2001 From: howard Date: Mon, 22 Mar 2021 20:55:44 -0700 Subject: [PATCH] semi workin arc --- dist/.nojekyll | 0 dist/bundle.js | 16 +- dist/index.html | 2 +- dist/solver.wasm | Bin 135384 -> 135384 bytes package-lock.json | 803 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 4 +- src/Sketcher.js | 366 ++++++++++++++------- src/index.js | 38 +-- wasm/solver.c | 4 +- 9 files changed, 1094 insertions(+), 139 deletions(-) create mode 100644 dist/.nojekyll diff --git a/dist/.nojekyll b/dist/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/dist/bundle.js b/dist/bundle.js index 9b4f6d8..f2d14e8 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -796,7 +796,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \****************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Path\": () => (/* binding */ Path)\n/* harmony export */ });\n/* harmony import */ var _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../math/Vector2.js */ \"./node_modules/three/src/math/Vector2.js\");\n/* harmony import */ var _CurvePath_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CurvePath.js */ \"./node_modules/three/src/extras/core/CurvePath.js\");\n/* harmony import */ var _curves_EllipseCurve_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../curves/EllipseCurve.js */ \"./node_modules/three/src/extras/curves/EllipseCurve.js\");\n/* harmony import */ var _curves_SplineCurve_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../curves/SplineCurve.js */ \"./node_modules/three/src/extras/curves/SplineCurve.js\");\n/* harmony import */ var _curves_CubicBezierCurve_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../curves/CubicBezierCurve.js */ \"./node_modules/three/src/extras/curves/CubicBezierCurve.js\");\n/* harmony import */ var _curves_QuadraticBezierCurve_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../curves/QuadraticBezierCurve.js */ \"./node_modules/three/src/extras/curves/QuadraticBezierCurve.js\");\n/* harmony import */ var _curves_LineCurve_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../curves/LineCurve.js */ \"./node_modules/three/src/extras/curves/LineCurve.js\");\n\n\n\n\n\n\n\n\nclass Path extends _CurvePath_js__WEBPACK_IMPORTED_MODULE_1__.CurvePath {\n\n\tconstructor( points ) {\n\n\t\tsuper();\n\t\tthis.type = 'Path';\n\n\t\tthis.currentPoint = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\n\t\tif ( points ) {\n\n\t\t\tthis.setFromPoints( points );\n\n\t\t}\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.moveTo( points[ 0 ].x, points[ 0 ].y );\n\n\t\tfor ( let i = 1, l = points.length; i < l; i ++ ) {\n\n\t\t\tthis.lineTo( points[ i ].x, points[ i ].y );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying?\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tconst curve = new _curves_LineCurve_js__WEBPACK_IMPORTED_MODULE_2__.LineCurve( this.currentPoint.clone(), new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2( x, y ) );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tconst curve = new _curves_QuadraticBezierCurve_js__WEBPACK_IMPORTED_MODULE_3__.QuadraticBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2( aCPx, aCPy ),\n\t\t\tnew _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tconst curve = new _curves_CubicBezierCurve_js__WEBPACK_IMPORTED_MODULE_4__.CubicBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2( aCP1x, aCP1y ),\n\t\t\tnew _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2( aCP2x, aCP2y ),\n\t\t\tnew _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts /*Array of Vector*/ ) {\n\n\t\tconst npts = [ this.currentPoint.clone() ].concat( pts );\n\n\t\tconst curve = new _curves_SplineCurve_js__WEBPACK_IMPORTED_MODULE_5__.SplineCurve( npts );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.copy( pts[ pts.length - 1 ] );\n\n\t\treturn this;\n\n\t}\n\n\tarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absarc( aX + x0, aY + y0, aRadius,\n\t\t\taStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tabsarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\treturn this;\n\n\t}\n\n\tabsellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst curve = new _curves_EllipseCurve_js__WEBPACK_IMPORTED_MODULE_6__.EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\tif ( this.curves.length > 0 ) {\n\n\t\t\t// if a previous curve is present, attempt to join\n\t\t\tconst firstPoint = curve.getPoint( 0 );\n\n\t\t\tif ( ! firstPoint.equals( this.currentPoint ) ) {\n\n\t\t\t\tthis.lineTo( firstPoint.x, firstPoint.y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.curves.push( curve );\n\n\t\tconst lastPoint = curve.getPoint( 1 );\n\t\tthis.currentPoint.copy( lastPoint );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.currentPoint.copy( source.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.currentPoint = this.currentPoint.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.currentPoint.fromArray( json.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n}\n\n\n\n\n\n//# sourceURL=webpack:///./node_modules/three/src/extras/core/Path.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Path\": () => (/* binding */ Path)\n/* harmony export */ });\n/* harmony import */ var _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../math/Vector2.js */ \"./node_modules/three/src/math/Vector2.js\");\n/* harmony import */ var _CurvePath_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CurvePath.js */ \"./node_modules/three/src/extras/core/CurvePath.js\");\n/* harmony import */ var _curves_EllipseCurve_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../curves/EllipseCurve.js */ \"./node_modules/three/src/extras/curves/EllipseCurve.js\");\n/* harmony import */ var _curves_SplineCurve_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../curves/SplineCurve.js */ \"./node_modules/three/src/extras/curves/SplineCurve.js\");\n/* harmony import */ var _curves_CubicBezierCurve_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../curves/CubicBezierCurve.js */ \"./node_modules/three/src/extras/curves/CubicBezierCurve.js\");\n/* harmony import */ var _curves_QuadraticBezierCurve_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../curves/QuadraticBezierCurve.js */ \"./node_modules/three/src/extras/curves/QuadraticBezierCurve.js\");\n/* harmony import */ var _curves_LineCurve_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../curves/LineCurve.js */ \"./node_modules/three/src/extras/curves/LineCurve.js\");\n\n\n\n\n\n\n\n\nclass Path extends _CurvePath_js__WEBPACK_IMPORTED_MODULE_1__.CurvePath {\n\n\tconstructor( points ) {\n\n\t\tsuper();\n\t\tthis.type = 'Path';\n\n\t\tthis.currentPoint = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n\n\t\tif ( points ) {\n\n\t\t\tthis.setFromPoints( points );\n\n\t\t}\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.moveTo( points[ 0 ].x, points[ 0 ].y );\n\n\t\tfor ( let i = 1, l = points.length; i < l; i ++ ) {\n\n\t\t\tthis.lineTo( points[ i ].x, points[ i ].y );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying?\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tconst curve = new _curves_LineCurve_js__WEBPACK_IMPORTED_MODULE_6__.LineCurve( this.currentPoint.clone(), new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2( x, y ) );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tconst curve = new _curves_QuadraticBezierCurve_js__WEBPACK_IMPORTED_MODULE_5__.QuadraticBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2( aCPx, aCPy ),\n\t\t\tnew _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tconst curve = new _curves_CubicBezierCurve_js__WEBPACK_IMPORTED_MODULE_4__.CubicBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2( aCP1x, aCP1y ),\n\t\t\tnew _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2( aCP2x, aCP2y ),\n\t\t\tnew _math_Vector2_js__WEBPACK_IMPORTED_MODULE_0__.Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts /*Array of Vector*/ ) {\n\n\t\tconst npts = [ this.currentPoint.clone() ].concat( pts );\n\n\t\tconst curve = new _curves_SplineCurve_js__WEBPACK_IMPORTED_MODULE_3__.SplineCurve( npts );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.copy( pts[ pts.length - 1 ] );\n\n\t\treturn this;\n\n\t}\n\n\tarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absarc( aX + x0, aY + y0, aRadius,\n\t\t\taStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tabsarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\treturn this;\n\n\t}\n\n\tabsellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst curve = new _curves_EllipseCurve_js__WEBPACK_IMPORTED_MODULE_2__.EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\tif ( this.curves.length > 0 ) {\n\n\t\t\t// if a previous curve is present, attempt to join\n\t\t\tconst firstPoint = curve.getPoint( 0 );\n\n\t\t\tif ( ! firstPoint.equals( this.currentPoint ) ) {\n\n\t\t\t\tthis.lineTo( firstPoint.x, firstPoint.y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.curves.push( curve );\n\n\t\tconst lastPoint = curve.getPoint( 1 );\n\t\tthis.currentPoint.copy( lastPoint );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.currentPoint.copy( source.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.currentPoint = this.currentPoint.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.currentPoint.fromArray( json.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n}\n\n\n\n\n\n//# sourceURL=webpack:///./node_modules/three/src/extras/core/Path.js?"); /***/ }), @@ -846,7 +846,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \******************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CubicBezierCurve\": () => (/* binding */ CubicBezierCurve)\n/* harmony export */ });\n/* harmony import */ var _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Curve.js */ \"./node_modules/three/src/extras/core/Curve.js\");\n/* harmony import */ var _core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Interpolations.js */ \"./node_modules/three/src/extras/core/Interpolations.js\");\n/* harmony import */ var _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../math/Vector2.js */ \"./node_modules/three/src/math/Vector2.js\");\n\n\n\n\nclass CubicBezierCurve extends _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__.Curve {\n\n\tconstructor( v0 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__.Vector2(), v1 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__.Vector2(), v2 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__.Vector2(), v3 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__.Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubicBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__.Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__.CubicBezier)( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__.CubicBezier)( t, v0.y, v1.y, v2.y, v3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nCubicBezierCurve.prototype.isCubicBezierCurve = true;\n\n\n\n\n//# sourceURL=webpack:///./node_modules/three/src/extras/curves/CubicBezierCurve.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CubicBezierCurve\": () => (/* binding */ CubicBezierCurve)\n/* harmony export */ });\n/* harmony import */ var _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Curve.js */ \"./node_modules/three/src/extras/core/Curve.js\");\n/* harmony import */ var _core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Interpolations.js */ \"./node_modules/three/src/extras/core/Interpolations.js\");\n/* harmony import */ var _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../math/Vector2.js */ \"./node_modules/three/src/math/Vector2.js\");\n\n\n\n\nclass CubicBezierCurve extends _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__.Curve {\n\n\tconstructor( v0 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__.Vector2(), v1 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__.Vector2(), v2 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__.Vector2(), v3 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__.Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubicBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__.Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__.CubicBezier)( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__.CubicBezier)( t, v0.y, v1.y, v2.y, v3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nCubicBezierCurve.prototype.isCubicBezierCurve = true;\n\n\n\n\n//# sourceURL=webpack:///./node_modules/three/src/extras/curves/CubicBezierCurve.js?"); /***/ }), @@ -856,7 +856,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \*******************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CubicBezierCurve3\": () => (/* binding */ CubicBezierCurve3)\n/* harmony export */ });\n/* harmony import */ var _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Curve.js */ \"./node_modules/three/src/extras/core/Curve.js\");\n/* harmony import */ var _core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Interpolations.js */ \"./node_modules/three/src/extras/core/Interpolations.js\");\n/* harmony import */ var _math_Vector3_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../math/Vector3.js */ \"./node_modules/three/src/math/Vector3.js\");\n\n\n\n\nclass CubicBezierCurve3 extends _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__.Curve {\n\n\tconstructor( v0 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_1__.Vector3(), v1 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_1__.Vector3(), v2 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_1__.Vector3(), v3 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_1__.Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubicBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_1__.Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__.CubicBezier)( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__.CubicBezier)( t, v0.y, v1.y, v2.y, v3.y ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__.CubicBezier)( t, v0.z, v1.z, v2.z, v3.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nCubicBezierCurve3.prototype.isCubicBezierCurve3 = true;\n\n\n\n\n//# sourceURL=webpack:///./node_modules/three/src/extras/curves/CubicBezierCurve3.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CubicBezierCurve3\": () => (/* binding */ CubicBezierCurve3)\n/* harmony export */ });\n/* harmony import */ var _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Curve.js */ \"./node_modules/three/src/extras/core/Curve.js\");\n/* harmony import */ var _core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Interpolations.js */ \"./node_modules/three/src/extras/core/Interpolations.js\");\n/* harmony import */ var _math_Vector3_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../math/Vector3.js */ \"./node_modules/three/src/math/Vector3.js\");\n\n\n\n\nclass CubicBezierCurve3 extends _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__.Curve {\n\n\tconstructor( v0 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_2__.Vector3(), v1 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_2__.Vector3(), v2 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_2__.Vector3(), v3 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_2__.Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubicBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_2__.Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__.CubicBezier)( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__.CubicBezier)( t, v0.y, v1.y, v2.y, v3.y ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__.CubicBezier)( t, v0.z, v1.z, v2.z, v3.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nCubicBezierCurve3.prototype.isCubicBezierCurve3 = true;\n\n\n\n\n//# sourceURL=webpack:///./node_modules/three/src/extras/curves/CubicBezierCurve3.js?"); /***/ }), @@ -906,7 +906,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \**********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"QuadraticBezierCurve\": () => (/* binding */ QuadraticBezierCurve)\n/* harmony export */ });\n/* harmony import */ var _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Curve.js */ \"./node_modules/three/src/extras/core/Curve.js\");\n/* harmony import */ var _core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Interpolations.js */ \"./node_modules/three/src/extras/core/Interpolations.js\");\n/* harmony import */ var _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../math/Vector2.js */ \"./node_modules/three/src/math/Vector2.js\");\n\n\n\n\nclass QuadraticBezierCurve extends _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__.Curve {\n\n\tconstructor( v0 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__.Vector2(), v1 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__.Vector2(), v2 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__.Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'QuadraticBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__.Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__.QuadraticBezier)( t, v0.x, v1.x, v2.x ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__.QuadraticBezier)( t, v0.y, v1.y, v2.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nQuadraticBezierCurve.prototype.isQuadraticBezierCurve = true;\n\n\n\n\n//# sourceURL=webpack:///./node_modules/three/src/extras/curves/QuadraticBezierCurve.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"QuadraticBezierCurve\": () => (/* binding */ QuadraticBezierCurve)\n/* harmony export */ });\n/* harmony import */ var _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Curve.js */ \"./node_modules/three/src/extras/core/Curve.js\");\n/* harmony import */ var _core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Interpolations.js */ \"./node_modules/three/src/extras/core/Interpolations.js\");\n/* harmony import */ var _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../math/Vector2.js */ \"./node_modules/three/src/math/Vector2.js\");\n\n\n\n\nclass QuadraticBezierCurve extends _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__.Curve {\n\n\tconstructor( v0 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__.Vector2(), v1 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__.Vector2(), v2 = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__.Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'QuadraticBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__.Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__.QuadraticBezier)( t, v0.x, v1.x, v2.x ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__.QuadraticBezier)( t, v0.y, v1.y, v2.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nQuadraticBezierCurve.prototype.isQuadraticBezierCurve = true;\n\n\n\n\n//# sourceURL=webpack:///./node_modules/three/src/extras/curves/QuadraticBezierCurve.js?"); /***/ }), @@ -916,7 +916,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \***********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"QuadraticBezierCurve3\": () => (/* binding */ QuadraticBezierCurve3)\n/* harmony export */ });\n/* harmony import */ var _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Curve.js */ \"./node_modules/three/src/extras/core/Curve.js\");\n/* harmony import */ var _core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Interpolations.js */ \"./node_modules/three/src/extras/core/Interpolations.js\");\n/* harmony import */ var _math_Vector3_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../math/Vector3.js */ \"./node_modules/three/src/math/Vector3.js\");\n\n\n\n\nclass QuadraticBezierCurve3 extends _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__.Curve {\n\n\tconstructor( v0 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_1__.Vector3(), v1 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_1__.Vector3(), v2 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_1__.Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'QuadraticBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_1__.Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__.QuadraticBezier)( t, v0.x, v1.x, v2.x ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__.QuadraticBezier)( t, v0.y, v1.y, v2.y ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__.QuadraticBezier)( t, v0.z, v1.z, v2.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nQuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true;\n\n\n\n\n//# sourceURL=webpack:///./node_modules/three/src/extras/curves/QuadraticBezierCurve3.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"QuadraticBezierCurve3\": () => (/* binding */ QuadraticBezierCurve3)\n/* harmony export */ });\n/* harmony import */ var _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Curve.js */ \"./node_modules/three/src/extras/core/Curve.js\");\n/* harmony import */ var _core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Interpolations.js */ \"./node_modules/three/src/extras/core/Interpolations.js\");\n/* harmony import */ var _math_Vector3_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../math/Vector3.js */ \"./node_modules/three/src/math/Vector3.js\");\n\n\n\n\nclass QuadraticBezierCurve3 extends _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__.Curve {\n\n\tconstructor( v0 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_2__.Vector3(), v1 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_2__.Vector3(), v2 = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_2__.Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'QuadraticBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new _math_Vector3_js__WEBPACK_IMPORTED_MODULE_2__.Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__.QuadraticBezier)( t, v0.x, v1.x, v2.x ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__.QuadraticBezier)( t, v0.y, v1.y, v2.y ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__.QuadraticBezier)( t, v0.z, v1.z, v2.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nQuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true;\n\n\n\n\n//# sourceURL=webpack:///./node_modules/three/src/extras/curves/QuadraticBezierCurve3.js?"); /***/ }), @@ -926,7 +926,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \*************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"SplineCurve\": () => (/* binding */ SplineCurve)\n/* harmony export */ });\n/* harmony import */ var _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Curve.js */ \"./node_modules/three/src/extras/core/Curve.js\");\n/* harmony import */ var _core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Interpolations.js */ \"./node_modules/three/src/extras/core/Interpolations.js\");\n/* harmony import */ var _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../math/Vector2.js */ \"./node_modules/three/src/math/Vector2.js\");\n\n\n\n\nclass SplineCurve extends _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__.Curve {\n\n\tconstructor( points = [] ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'SplineCurve';\n\n\t\tthis.points = points;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__.Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst p = ( points.length - 1 ) * t;\n\n\t\tconst intPoint = Math.floor( p );\n\t\tconst weight = p - intPoint;\n\n\t\tconst p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\n\t\tconst p1 = points[ intPoint ];\n\t\tconst p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\n\t\tconst p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\n\n\t\tpoint.set(\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__.CatmullRom)( weight, p0.x, p1.x, p2.x, p3.x ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_2__.CatmullRom)( weight, p0.y, p1.y, p2.y, p3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_1__.Vector2().fromArray( point ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nSplineCurve.prototype.isSplineCurve = true;\n\n\n\n\n//# sourceURL=webpack:///./node_modules/three/src/extras/curves/SplineCurve.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"SplineCurve\": () => (/* binding */ SplineCurve)\n/* harmony export */ });\n/* harmony import */ var _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Curve.js */ \"./node_modules/three/src/extras/core/Curve.js\");\n/* harmony import */ var _core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Interpolations.js */ \"./node_modules/three/src/extras/core/Interpolations.js\");\n/* harmony import */ var _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../math/Vector2.js */ \"./node_modules/three/src/math/Vector2.js\");\n\n\n\n\nclass SplineCurve extends _core_Curve_js__WEBPACK_IMPORTED_MODULE_0__.Curve {\n\n\tconstructor( points = [] ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'SplineCurve';\n\n\t\tthis.points = points;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__.Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst p = ( points.length - 1 ) * t;\n\n\t\tconst intPoint = Math.floor( p );\n\t\tconst weight = p - intPoint;\n\n\t\tconst p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\n\t\tconst p1 = points[ intPoint ];\n\t\tconst p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\n\t\tconst p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\n\n\t\tpoint.set(\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__.CatmullRom)( weight, p0.x, p1.x, p2.x, p3.x ),\n\t\t\t(0,_core_Interpolations_js__WEBPACK_IMPORTED_MODULE_1__.CatmullRom)( weight, p0.y, p1.y, p2.y, p3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new _math_Vector2_js__WEBPACK_IMPORTED_MODULE_2__.Vector2().fromArray( point ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nSplineCurve.prototype.isSplineCurve = true;\n\n\n\n\n//# sourceURL=webpack:///./node_modules/three/src/extras/curves/SplineCurve.js?"); /***/ }), @@ -4026,7 +4026,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \*************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Sketcher\": () => (/* binding */ Sketcher)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../node_modules/three/src/Three */ \"./node_modules/three/src/Three.js\");\n\n\n\n\n\nclass Sketcher extends _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Group {\n constructor(camera, domElement, plane) {\n super()\n this.camera = camera;\n this.domElement = domElement;\n this.scene = scene;\n this.plane = plane;\n this.matrixAutoUpdate = false;\n this.sketchNormal = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Vector3(0, 0, 1)\n this.orientSketcher(plane)\n\n\n this.add(new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.PlaneHelper(this.plane, 1, 0xffff00));\n\n\n this.linesGroup = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Group()\n this.linesArr = this.linesGroup.children\n this.pointsGroup = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Group()\n this.ptsArr = this.pointsGroup.children\n this.add(this.linesGroup)\n this.add(this.pointsGroup)\n\n window.lg = this.linesArr\n window.pg = this.ptsArr\n\n this.pickThreshold = 100\n this.grabbedObject = null\n\n this.lineMaterial = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial({\n linewidth: 3,\n color: 0x555,\n })\n this.pointMaterial = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial({\n color: 0xAAA,\n size: 3,\n })\n\n this.pointStart = this.pointStart.bind(this);\n this.pointEnd = this.pointEnd.bind(this);\n this.move = this.move.bind(this);\n this.keyHandler = this.keyHandler.bind(this);\n this.picker = this.picker.bind(this);\n this.grabbedMove = this.grabbedMove.bind(this);\n this.grabEnd = this.grabEnd.bind(this);\n this.raycaster = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Raycaster();\n\n\n window.addEventListener('keydown', this.keyHandler)\n domElement.addEventListener('pointerdown', this.picker)\n\n\n this.mode = \"\"\n\n\n }\n\n orientSketcher() {\n\n const theta = this.sketchNormal.angleTo(this.plane.normal)\n const axis = this.sketchNormal.clone().cross(this.plane.normal).normalize()\n const rot = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().makeRotationAxis(axis, theta)\n const trans = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().makeTranslation(0, 0, this.plane.constant)\n\n this.matrix = rot.multiply(trans) // world matrix will auto update in next render\n this.inverse = this.matrix.clone().invert()\n\n }\n\n keyHandler(e) {\n switch (e.key) {\n case 'Escape':\n this.clear()\n this.mode = \"\"\n break;\n case 'l':\n this.addLine()\n this.mode = \"line\"\n break;\n case 'b':\n this.solve()\n break;\n case '=':\n this.plane.applyMatrix4(new three__WEBPACK_IMPORTED_MODULE_1__.Matrix4().makeRotationY(0.1))\n this.orientSketcher()\n\n this.dispatchEvent({ type: 'change' })\n break;\n case '-':\n this.plane.applyMatrix4(new three__WEBPACK_IMPORTED_MODULE_1__.Matrix4().makeRotationY(-0.1))\n this.orientSketcher()\n\n this.dispatchEvent({ type: 'change' })\n break;\n }\n }\n\n\n picker(e) {\n if (this.mode || e.buttons != 1) return\n this.raycaster.setFromCamera(\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Vector2(\n (e.clientX / window.innerWidth) * 2 - 1,\n - (e.clientY / window.innerHeight) * 2 + 1\n ),\n this.camera\n );\n\n // console.log(this.ptsArr)\n const candidates = this.raycaster.intersectObjects(this.ptsArr)\n // console.log(candidates)\n\n\n if (!candidates.length) return;\n\n let minDist = candidates[0].distanceToRay\n let idx = 0\n\n for (let i = 1; i < candidates.length; i++) {\n if (candidates.distanceToRay < minDist) {\n minDist = candidates.distanceToRay\n idx = i\n }\n }\n\n if (minDist < this.pickThreshold) {\n this.grabPtIdx = this.ptsArr.indexOf(\n candidates[idx].object\n )\n } else {\n return\n }\n\n this.domElement.addEventListener('pointermove', this.grabbedMove);\n this.domElement.addEventListener('pointerup', this.grabEnd);\n }\n\n grabbedMove(e) {\n const mouseLoc = this.getLocation(e);\n\n this.moveLinePt(this.grabPtIdx, mouseLoc)\n\n this.dispatchEvent({ type: 'change' })\n }\n\n moveLinePt(ptIdx, absPos) {\n this.ptsArr[ptIdx].geometry.attributes.position.set(absPos);\n this.solve()\n // this.ptsArr[ptIdx].geometry.attributes.position.needsUpdate = true;\n\n // const lineIdx = Math.floor(ptIdx / 2)\n // const endPtIdx = (ptIdx % 2) * 3\n // this.linesArr[lineIdx].geometry.attributes.position.set(absPos, endPtIdx)\n // this.linesArr[lineIdx].geometry.attributes.position.needsUpdate = true;\n }\n\n grabEnd() {\n this.domElement.removeEventListener('pointermove', this.grabbedMove)\n this.domElement.removeEventListener('pointerup', this.grabEnd)\n this.ptsArr[this.grabPtIdx].geometry.computeBoundingSphere()\n // this.grabbedObject = null\n }\n\n\n addLine() {\n this.domElement.addEventListener('pointerdown', this.pointStart)\n }\n\n clear() {\n if (this.mode == \"\") return\n\n this.domElement.removeEventListener('pointerdown', this.pointStart)\n this.domElement.removeEventListener('pointermove', this.move);\n this.domElement.removeEventListener('pointerdown', this.pointEnd);\n this.domElement.removeEventListener('pointerdown', this.pointEnd);\n\n const lastLine = this.linesArr[this.linesArr.length - 1]\n this.linesGroup.remove(lastLine)\n lastLine.geometry.dispose()\n\n const lastPoints = this.ptsArr.slice(this.ptsArr.length - 2)\n this.pointsGroup.remove(...lastPoints)\n lastPoints.forEach(obj => obj.geometry.dispose())\n\n this.dispatchEvent({ type: 'change' })\n }\n\n getLocation(e) {\n this.raycaster.setFromCamera(\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Vector2(\n (e.clientX / window.innerWidth) * 2 - 1,\n - (e.clientY / window.innerHeight) * 2 + 1\n ),\n this.camera\n );\n // return this.worldToLocal(this.raycaster.ray.intersectPlane(this.plane)).toArray()\n return this.raycaster.ray.intersectPlane(this.plane).applyMatrix4(this.inverse).toArray()\n }\n\n pointStart(e) {\n if (e.buttons !== 1) return\n const mouseLoc = this.getLocation(e);\n\n this.lineGeom = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry()\n this.lineGeom.setAttribute('position',\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(\n new Float32Array(6), 3\n )\n );\n this.lineGeom.attributes.position.set(mouseLoc)\n this.line = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.LineSegments(this.lineGeom, this.lineMaterial);\n this.line.frustumCulled = false;\n this.linesGroup.add(this.line)\n\n this.p1Geom = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry()\n this.p1Geom.setAttribute('position',\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(\n new Float32Array(3), 3\n )\n );\n this.p1Geom.attributes.position.set(mouseLoc)\n this.p1 = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Points(this.p1Geom, this.pointMaterial);\n this.pointsGroup.add(this.p1)\n\n this.p2Geom = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry()\n this.p2Geom.setAttribute('position',\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(\n new Float32Array(3), 3\n )\n );\n this.p2 = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Points(this.p2Geom, this.pointMaterial);\n this.pointsGroup.add(this.p2)\n\n this.domElement.removeEventListener('pointerdown', this.pointStart)\n this.domElement.addEventListener('pointermove', this.move)\n this.domElement.addEventListener('pointerdown', this.pointEnd)\n }\n\n\n move(e) {\n const mouseLoc = this.getLocation(e);\n this.lineGeom.attributes.position.set(mouseLoc, 3)\n\n this.lineGeom.attributes.position.needsUpdate = true;\n this.p2Geom.attributes.position.set(mouseLoc);\n this.p2Geom.attributes.position.needsUpdate = true;\n this.p2Geom.computeBoundingSphere();\n this.dispatchEvent({ type: 'change' })\n }\n\n pointEnd(e) {\n if (e.buttons !== 1) return;\n this.domElement.removeEventListener('pointermove', this.move);\n this.domElement.removeEventListener('pointerdown', this.pointEnd);\n\n\n this.pointStart(e)\n }\n\n solve() {\n let ptsBuf = new Float32Array(this.ptsArr.length * 2)\n for (let i = 0, p = 0; i < this.ptsArr.length; i++) {\n ptsBuf[p++] = this.ptsArr[i].geometry.attributes.position.array[0]\n ptsBuf[p++] = this.ptsArr[i].geometry.attributes.position.array[1]\n }\n\n\n buffer = Module._malloc(ptsBuf.length * ptsBuf.BYTES_PER_ELEMENT)\n Module.HEAPF32.set(ptsBuf, buffer >> 2)\n Module[\"_solver\"](this.ptsArr.length / 2, buffer)\n\n\n let ptr = buffer >> 2;\n\n\n for (let i = 0; i < ptsBuf.length; i += 4) {\n const pt1_pos = this.ptsArr[i >> 1].geometry.attributes.position;\n const pt2_pos = this.ptsArr[(i >> 1) + 1].geometry.attributes.position;\n const line_pos = this.linesArr[i >> 2].geometry.attributes.position;\n\n pt1_pos.array[0] = Module.HEAPF32[ptr]\n line_pos.array[0] = Module.HEAPF32[ptr++]\n\n pt1_pos.array[1] = Module.HEAPF32[ptr]\n line_pos.array[1] = Module.HEAPF32[ptr++]\n\n pt2_pos.array[0] = Module.HEAPF32[ptr]\n line_pos.array[3] = Module.HEAPF32[ptr++]\n\n pt2_pos.array[1] = Module.HEAPF32[ptr]\n line_pos.array[4] = Module.HEAPF32[ptr++]\n\n pt1_pos.needsUpdate = true;\n pt2_pos.needsUpdate = true;\n line_pos.needsUpdate = true;\n }\n\n this.dispatchEvent({ type: 'change' })\n\n Module._free(buffer)\n }\n\n}\n\n\n\n\n\n//# sourceURL=webpack:///./src/Sketcher.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Sketcher\": () => (/* binding */ Sketcher)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ \"./node_modules/three/build/three.module.js\");\n/* harmony import */ var _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../node_modules/three/src/Three */ \"./node_modules/three/src/Three.js\");\n\n\n\n\n\nconst factor = Math.tan(Math.PI / 3)\n\nfunction get2PtArc(p1, p2, divisions = 36) {\n\n const dx = p2[0] - p1[0]\n const dy = p2[1] - p1[1]\n const dist = Math.sqrt(dx ** 2 + dy ** 2)\n const angle = (Math.atan2(dy, dx) - Math.PI / 2) % (2 * Math.PI)\n let a1 = angle - Math.PI / 6\n let a2 = angle + Math.PI / 6\n\n a1 = a1 < 0 ? a1 + 2 * Math.PI : a1\n a2 = a2 < 0 ? a2 + 2 * Math.PI : a1\n const cx = (p1[0] + p2[0] - dy * factor) / 2\n const cy = (p1[1] + p2[1] + dx * factor) / 2\n\n const radius = dist\n const deltaAngle = Math.PI / 3\n let points = new Float32Array((divisions + 1) * 3)\n\n for (let d = 0; d <= divisions; d++) {\n const angle = a1 + (d / divisions) * deltaAngle;\n points[3 * d] = cx + radius * Math.cos(angle);\n points[3 * d + 1] = cy + radius * Math.sin(angle);\n }\n return [points, [cx, cy]];\n}\n\n\nclass Sketcher extends _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Group {\n constructor(camera, domElement, plane) {\n super()\n this.camera = camera;\n this.domElement = domElement;\n this.plane = plane;\n this.matrixAutoUpdate = false;\n this.sketchNormal = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Vector3(0, 0, 1)\n this.orientSketcher(plane)\n\n this.add(new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.PlaneHelper(this.plane, 1, 0xffff00));\n\n this.pointsGroup = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Group() //0\n this.add(this.pointsGroup)\n\n this.arcPtsGroup = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Group() //1\n this.add(this.arcPtsGroup)\n\n this.linesGroup = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Group() //2\n this.add(this.linesGroup)\n\n this.arcsGroup = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Group() //3\n this.add(this.arcsGroup)\n\n this.linesArr = this.linesGroup.children\n this.ptsArr = this.pointsGroup.children\n this.arcPtsArr = this.arcPtsGroup.children\n this.arcsArr = this.arcsGroup.children\n\n\n window.lg = this.linesArr\n window.pg = this.ptsArr\n\n this.colorPt = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Color('white')\n this.selected = new Set()\n\n\n this.lineMaterial = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial({\n linewidth: 3,\n color: 0x555555,\n })\n this.pointMaterial = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial({\n color: 0x555555,\n size: 3,\n })\n\n\n this.onKeyPress = this.onKeyPress.bind(this);\n\n this.onClick_1 = this.onClick_1.bind(this);\n this.onClick_2 = this.onClick_2.bind(this);\n this.beforeClick_2 = this.beforeClick_2.bind(this);\n this.beforeClick_3 = this.beforeClick_3.bind(this);\n this.onPick = this.onPick.bind(this);\n this.onHover = this.onHover.bind(this);\n this.onDrag = this.onDrag.bind(this);\n this.onRelease = this.onRelease.bind(this);\n\n this.raycaster = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Raycaster();\n this.raycaster.params.Line.threshold = 0.4;\n this.raycaster.params.Points.threshold = 0.2;\n\n this.pickThreshold = 0.1\n\n window.addEventListener('keydown', this.onKeyPress)\n domElement.addEventListener('pointerdown', this.onPick)\n domElement.addEventListener('pointermove', this.onHover)\n\n\n this.mode = \"\"\n\n this.contraints = []\n this.contraintsVal = []\n\n }\n\n orientSketcher() {\n\n const theta = this.sketchNormal.angleTo(this.plane.normal)\n const axis = this.sketchNormal.clone().cross(this.plane.normal).normalize()\n const rot = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().makeRotationAxis(axis, theta)\n const trans = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Matrix4().makeTranslation(0, 0, this.plane.constant)\n\n this.matrix = rot.multiply(trans) // world matrix will auto update in next render\n this.inverse = this.matrix.clone().invert()\n\n }\n\n onKeyPress(e) {\n switch (e.key) {\n case 'Escape':\n this.clear()\n this.mode = \"\"\n break;\n case 'l':\n this.domElement.addEventListener('pointerdown', this.onClick_1)\n this.mode = \"line\"\n break;\n case 'a':\n this.domElement.addEventListener('pointerdown', this.onClick_1)\n this.mode = \"arc\"\n break;\n case 'd':\n this.delete()\n break;\n case '=':\n this.plane.applyMatrix4(new three__WEBPACK_IMPORTED_MODULE_1__.Matrix4().makeRotationY(0.1))\n this.orientSketcher()\n this.dispatchEvent({ type: 'change' })\n break;\n case '-':\n this.plane.applyMatrix4(new three__WEBPACK_IMPORTED_MODULE_1__.Matrix4().makeRotationY(-0.1))\n this.orientSketcher()\n this.dispatchEvent({ type: 'change' })\n break;\n }\n }\n\n\n onHover(e) {\n if (this.mode || e.buttons) return\n\n if (this.hovered && !this.selected.has(this.hovered)) {\n this.hovered.material.color.set(0x555555)\n }\n\n this.raycaster.setFromCamera(\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Vector2(\n (e.clientX / window.innerWidth) * 2 - 1,\n - (e.clientY / window.innerHeight) * 2 + 1\n ),\n this.camera\n );\n\n const hoverPts = this.raycaster.intersectObjects(this.ptsArr)\n\n if (hoverPts.length) {\n let minDist = hoverPts[0].distanceToRay\n let idx = 0\n\n for (let i = 1; i < hoverPts.length; i++) {\n if (hoverPts[i].distanceToRay <= minDist) {\n minDist = hoverPts[i].distanceToRay\n idx = i\n }\n }\n\n hoverPts[idx].object.material.color.set(0xff0000)\n this.hovered = hoverPts[idx].object\n this.dispatchEvent({ type: 'change' })\n return\n }\n\n const hoverLines = this.raycaster.intersectObjects(this.linesArr)\n if (hoverLines.length) {\n hoverLines[0].object.material.color.set(0xff0000)\n this.hovered = hoverLines[0].object\n this.dispatchEvent({ type: 'change' })\n return\n }\n\n if (this.hovered) {\n this.hovered = null;\n this.dispatchEvent({ type: 'change' })\n }\n\n }\n\n\n\n onPick(e) {\n if (this.mode || e.buttons != 1) return\n\n if (this.hovered) {\n this.selected.add(this.hovered)\n\n if (this.hovered.type === \"Points\") {\n this.grabPtIdx = this.ptsArr.indexOf(\n this.hovered\n )\n this.domElement.addEventListener('pointermove', this.onDrag);\n this.domElement.addEventListener('pointerup', this.onRelease)\n }\n } else {\n for (let obj of this.selected) {\n obj.material.color.set(0x555555)\n }\n this.dispatchEvent({ type: 'change' })\n this.selected.clear()\n }\n }\n\n onDrag(e) {\n const mouseLoc = this.getLocation(e);\n this.ptsArr[this.grabPtIdx].geometry.attributes.position.set(mouseLoc);\n this.solve()\n this.dispatchEvent({ type: 'change' })\n }\n\n\n onRelease() {\n this.domElement.removeEventListener('pointermove', this.onDrag)\n this.domElement.removeEventListener('pointerup', this.onRelease)\n this.ptsArr[this.grabPtIdx].geometry.computeBoundingSphere()\n // this.grabbedObject = null\n }\n\n\n\n delete() {\n const deleteSet = new Set()\n let idx;\n for (let obj of this.selected) {\n deleteSet.add(obj)\n if (obj.parent == this.linesGroup) {\n idx = this.linesArr.indexOf(obj) * 2\n deleteSet.add(this.ptsArr[idx])\n deleteSet.add(this.ptsArr[idx + 1])\n } else if (obj.parent == this.pointsGroup) {\n idx = Math.floor(this.pointsArr.indexOf(obj) / 2)\n deleteSet.add(this.linesArr[idx])\n }\n }\n\n for (let obj of deleteSet) {\n obj.geometry.dispose()\n obj.material.dispose()\n obj.parent.remove(obj)\n }\n\n this.selected.clear()\n this.dispatchEvent({ type: 'change' })\n }\n\n clear() {\n if (this.mode == \"\") return\n\n this.domElement.removeEventListener('pointerdown', this.onClick_1)\n this.domElement.removeEventListener('pointermove', this.beforeClick_2);\n this.domElement.removeEventListener('pointerdown', this.onClick_2);\n\n const lastLine = this.linesArr[this.linesArr.length - 1]\n this.linesGroup.remove(lastLine)\n lastLine.geometry.dispose()\n\n const lastPoints = this.ptsArr.slice(this.ptsArr.length - 2)\n this.pointsGroup.remove(...lastPoints)\n lastPoints.forEach(obj => obj.geometry.dispose())\n\n this.dispatchEvent({ type: 'change' })\n }\n\n getLocation(e) {\n this.raycaster.setFromCamera(\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Vector2(\n (e.clientX / window.innerWidth) * 2 - 1,\n - (e.clientY / window.innerHeight) * 2 + 1\n ),\n this.camera\n );\n // return this.worldToLocal(this.raycaster.ray.intersectPlane(this.plane)).toArray()\n return this.raycaster.ray.intersectPlane(this.plane).applyMatrix4(this.inverse).toArray()\n }\n\n onClick_1(e) {\n console.log(e)\n if (e.buttons !== 1) return\n const mouseLoc = this.getLocation(e);\n\n this.p1Geom = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry().setAttribute('position',\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(new Float32Array(mouseLoc), 3)\n )\n this.p1 = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Points(this.p1Geom,\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial().copy(this.pointMaterial)\n );\n\n this.p2Geom = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry().setAttribute('position',\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(new Float32Array(3), 3)\n )\n this.p2 = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Points(this.p2Geom,\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial().copy(this.pointMaterial)\n );\n\n if (this.mode == \"line\") {\n this.lineGeom = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry().setAttribute('position',\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(new Float32Array(6), 3)\n );\n this.lineGeom.attributes.position.set(mouseLoc)\n this.line = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Line(this.lineGeom,\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial().copy(this.lineMaterial)\n );\n this.line.frustumCulled = false;\n\n\n this.linesGroup.add(this.line)\n this.pointsGroup.add(this.p1)\n this.pointsGroup.add(this.p2)\n } else if (this.mode == \"arc\") {\n\n this.arcGeom = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry().setAttribute('position',\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(new Float32Array(3 * 37), 3)\n )\n\n this.arc = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Line(this.arcGeom,\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial().copy(this.lineMaterial)\n );\n this.arc.frustumCulled = false;\n\n this.p3Geom = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry().setAttribute('position',\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(new Float32Array(3), 3)\n )\n this.p3 = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Points(this.p3Geom,\n new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial().copy(this.pointMaterial)\n );\n\n this.arcsGroup.add(this.arc)\n this.arcPtsGroup.add(this.p1)\n this.arcPtsGroup.add(this.p2)\n this.arcPtsGroup.add(this.p3)\n\n }\n\n\n\n this.domElement.removeEventListener('pointerdown', this.onClick_1)\n this.domElement.addEventListener('pointermove', this.beforeClick_2)\n this.domElement.addEventListener('pointerdown', this.onClick_2)\n }\n\n\n beforeClick_2(e) {\n const mouseLoc = this.getLocation(e);\n\n this.p2Geom.attributes.position.set(mouseLoc);\n this.p2Geom.attributes.position.needsUpdate = true;\n this.p2Geom.computeBoundingSphere()\n\n if (this.mode == \"line\") {\n this.lineGeom.attributes.position.set(mouseLoc, 3)\n this.lineGeom.attributes.position.needsUpdate = true;\n } else if (this.mode == 'arc') {\n const [points, center] = get2PtArc(\n this.p1Geom.attributes.position.array,\n this.p2Geom.attributes.position.array\n )\n this.arcGeom.attributes.position.set(\n points\n );\n this.arcGeom.attributes.position.needsUpdate = true;\n this.p3Geom.attributes.position.set(center);\n this.p3Geom.attributes.position.needsUpdate = true;\n this.p3Geom.computeBoundingSphere()\n\n }\n\n this.dispatchEvent({ type: 'change' })\n }\n\n onClick_2(e) {\n if (e.buttons !== 1) return;\n this.domElement.removeEventListener('pointermove', this.beforeClick_2);\n this.domElement.removeEventListener('pointerdown', this.onClick_2);\n if (this.mode == \"line\") {\n this.onClick_1(e)\n } else if (this.mode == \"arc\") {\n\n\n\n // this.domElement.addEventListener('pointermove', this.beforeClick_3)\n }\n }\n\n beforeClick_3(e) {\n const mouseLoc = this.getLocation(e);\n this.p3Geom.attributes.position.set(mouseLoc);\n this.p3Geom.attributes.position.needsUpdate = true;\n this.p3Geom.computeBoundingSphere()\n }\n\n solve() {\n let ptsBuf = new Float32Array(this.ptsArr.length * 2)\n for (let i = 0, p = 0; i < this.ptsArr.length; i++) {\n ptsBuf[p++] = this.ptsArr[i].geometry.attributes.position.array[0]\n ptsBuf[p++] = this.ptsArr[i].geometry.attributes.position.array[1]\n }\n\n\n buffer = Module._malloc(ptsBuf.length * ptsBuf.BYTES_PER_ELEMENT)\n Module.HEAPF32.set(ptsBuf, buffer >> 2)\n Module[\"_solver\"](this.ptsArr.length / 2, buffer)\n\n\n let ptr = buffer >> 2;\n\n\n for (let i = 0; i < ptsBuf.length; i += 4) {\n const pt1_pos = this.ptsArr[i >> 1].geometry.attributes.position;\n const pt2_pos = this.ptsArr[(i >> 1) + 1].geometry.attributes.position;\n const line_pos = this.linesArr[i >> 2].geometry.attributes.position;\n\n pt1_pos.array[0] = Module.HEAPF32[ptr]\n line_pos.array[0] = Module.HEAPF32[ptr++]\n\n pt1_pos.array[1] = Module.HEAPF32[ptr]\n line_pos.array[1] = Module.HEAPF32[ptr++]\n\n pt2_pos.array[0] = Module.HEAPF32[ptr]\n line_pos.array[3] = Module.HEAPF32[ptr++]\n\n pt2_pos.array[1] = Module.HEAPF32[ptr]\n line_pos.array[4] = Module.HEAPF32[ptr++]\n\n pt1_pos.needsUpdate = true;\n pt2_pos.needsUpdate = true;\n line_pos.needsUpdate = true;\n }\n\n this.dispatchEvent({ type: 'change' })\n\n Module._free(buffer)\n }\n\n}\n\n\n\n\n\n//# sourceURL=webpack:///./src/Sketcher.js?"); /***/ }), @@ -4036,7 +4036,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \**********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../node_modules/three/src/Three */ \"./node_modules/three/src/Three.js\");\n/* harmony import */ var _OrbitControls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./OrbitControls */ \"./src/OrbitControls.js\");\n/* harmony import */ var _trackball__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./trackball */ \"./src/trackball.js\");\n/* harmony import */ var _Sketcher__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Sketcher */ \"./src/Sketcher.js\");\n/* harmony import */ var _node_modules_dat_gui_src_dat_gui_GUI_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../node_modules/dat.gui/src/dat/gui/GUI.js */ \"./node_modules/dat.gui/src/dat/gui/GUI.js\");\n/* harmony import */ var _node_modules_three_examples_jsm_libs_stats_module_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../node_modules/three/examples/jsm/libs/stats.module.js */ \"./node_modules/three/examples/jsm/libs/stats.module.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils */ \"./src/utils.js\");\n// class MinMaxGUIHelper {\n// constructor(obj, minProp, maxProp, minDif) {\n// this.obj = obj;\n// this.minProp = minProp;\n// this.maxProp = maxProp;\n// this.minDif = minDif;\n// }\n// get min() {\n// return this.obj[this.minProp];\n// }\n// set min(v) {\n// this.obj[this.minProp] = v;\n// this.obj[this.maxProp] = Math.max(this.obj[this.maxProp], v + this.minDif);\n// }\n// get max() {\n// return this.obj[this.maxProp];\n// }\n// set max(v) {\n// this.obj[this.maxProp] = v;\n// this.min = this.min; // this will call the min setter\n// }\n// }\n\n// const gui = new GUI();\n// gui.add(camera, 'zoom', 0.01, 1, 0.01).listen();\n// const minMaxGUIHelper = new MinMaxGUIHelper(camera, 'near', 'far', 0.1);\n// gui.add(minMaxGUIHelper, 'min', 0.1, 50, 0.1).name('near');\n// gui.add(minMaxGUIHelper, 'max', 0.1, 50, 0.1).name('far');\n\n\n\n\n\n\n\n\n\n\n\n\nfunction main() {\n\n const Controller = new _utils__WEBPACK_IMPORTED_MODULE_6__.KeyboardController()\n\n var stats = new _node_modules_three_examples_jsm_libs_stats_module_js__WEBPACK_IMPORTED_MODULE_5__.default();\n stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom\n document.body.appendChild(stats.dom);\n\n const canvas = document.querySelector('#c');\n const view1Elem = document.querySelector('#view1');\n const view2Elem = document.querySelector('#view2');\n const renderer = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.WebGLRenderer({ canvas });\n\n const scene = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Scene();\n window.scene = scene;\n scene.background = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Color('pink');\n\n const helpersGroup = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Group();\n scene.add(helpersGroup);\n\n\n const size = 1;\n const near = 5;\n const far = 50;\n const camera = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.OrthographicCamera(-size, size, size, -size, near, far);\n camera.zoom = 0.1;\n camera.position.set(0, 0, 20);\n const controls = new _OrbitControls__WEBPACK_IMPORTED_MODULE_1__.OrbitControls(camera, view1Elem);\n // const controls = new TrackballControls(camera, view1Elem);\n controls.target.set(0, 0, 0);\n controls.update()\n const cameraHelper = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.CameraHelper(camera);\n helpersGroup.add(cameraHelper);\n\n\n const camera2 = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.PerspectiveCamera(\n 60, // fov\n 2, // aspect\n 0.1, // near\n 500, // far\n );\n camera2.position.set(16, 28, 40);\n camera2.lookAt(0, 5, 0);\n const controls2 = new _OrbitControls__WEBPACK_IMPORTED_MODULE_1__.OrbitControls(camera2, view2Elem);\n controls2.target.set(0, 5, 0);\n controls2.update();\n\n\n\n const axesHelper = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.AxesHelper(5);\n helpersGroup.add(axesHelper);\n\n const sketchPlane = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Plane(new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Vector3(0, 0, 1), 0);\n const sketcher = new _Sketcher__WEBPACK_IMPORTED_MODULE_3__.Sketcher(camera, view1Elem, sketchPlane)\n scene.add(sketcher)\n\n {\n const color = 0xFFFFFF;\n const intensity = 1;\n const light = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.DirectionalLight(color, intensity);\n light.position.set(0, 10, 0);\n light.target.position.set(-5, 0, 0);\n scene.add(light);\n scene.add(light.target);\n }\n\n\n\n\n\n function resizeRendererToDisplaySize(renderer) {\n const canvas = renderer.domElement;\n const width = canvas.clientWidth;\n const height = canvas.clientHeight;\n const needResize = canvas.width !== width || canvas.height !== height;\n if (needResize) {\n renderer.setSize(width, height, false);\n }\n return needResize;\n }\n\n function setScissorForElement(elem) {\n const canvasRect = canvas.getBoundingClientRect();\n const elemRect = elem.getBoundingClientRect();\n\n // compute a canvas relative rectangle\n const right = Math.min(elemRect.right, canvasRect.right) - canvasRect.left;\n const left = Math.max(0, elemRect.left - canvasRect.left);\n const bottom = Math.min(elemRect.bottom, canvasRect.bottom) - canvasRect.top;\n const top = Math.max(0, elemRect.top - canvasRect.top);\n\n const width = Math.min(canvasRect.width, right - left);\n const height = Math.min(canvasRect.height, bottom - top);\n\n // setup the scissor to only render to that part of the canvas\n const positiveYUpBottom = canvasRect.height - bottom;\n renderer.setScissor(left, positiveYUpBottom, width, height);\n renderer.setViewport(left, positiveYUpBottom, width, height);\n\n // return the aspect\n return width / height;\n }\n\n function render() {\n stats.begin();\n resizeRendererToDisplaySize(renderer);\n\n renderer.setScissorTest(true);\n {\n const aspect = setScissorForElement(view1Elem);\n camera.left = -aspect;\n camera.right = aspect;\n camera.updateProjectionMatrix();\n cameraHelper.update();\n cameraHelper.visible = false;\n renderer.render(scene, camera);\n }\n {\n const aspect = setScissorForElement(view2Elem);\n camera2.aspect = aspect;\n camera2.updateProjectionMatrix();\n cameraHelper.visible = true;\n renderer.render(scene, camera2);\n }\n\n stats.end();\n\n // requestAnimationFrame(render);\n }\n // requestAnimationFrame(render);\n\n\n controls.addEventListener('change', render);\n controls.addEventListener('start', render);\n controls2.addEventListener('change', render);\n sketcher.addEventListener('change', render);\n window.addEventListener('resize', render);\n render();\n}\n\nmain();\n\n\n//# sourceURL=webpack:///./src/index.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../node_modules/three/src/Three */ \"./node_modules/three/src/Three.js\");\n/* harmony import */ var _OrbitControls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./OrbitControls */ \"./src/OrbitControls.js\");\n/* harmony import */ var _trackball__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./trackball */ \"./src/trackball.js\");\n/* harmony import */ var _Sketcher__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Sketcher */ \"./src/Sketcher.js\");\n/* harmony import */ var _node_modules_dat_gui_src_dat_gui_GUI_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../node_modules/dat.gui/src/dat/gui/GUI.js */ \"./node_modules/dat.gui/src/dat/gui/GUI.js\");\n/* harmony import */ var _node_modules_three_examples_jsm_libs_stats_module_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../node_modules/three/examples/jsm/libs/stats.module.js */ \"./node_modules/three/examples/jsm/libs/stats.module.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils */ \"./src/utils.js\");\n// class MinMaxGUIHelper {\n// constructor(obj, minProp, maxProp, minDif) {\n// this.obj = obj;\n// this.minProp = minProp;\n// this.maxProp = maxProp;\n// this.minDif = minDif;\n// }\n// get min() {\n// return this.obj[this.minProp];\n// }\n// set min(v) {\n// this.obj[this.minProp] = v;\n// this.obj[this.maxProp] = Math.max(this.obj[this.maxProp], v + this.minDif);\n// }\n// get max() {\n// return this.obj[this.maxProp];\n// }\n// set max(v) {\n// this.obj[this.maxProp] = v;\n// this.min = this.min; // this will call the min setter\n// }\n// }\n\n// const gui = new GUI();\n// gui.add(camera, 'zoom', 0.01, 1, 0.01).listen();\n// const minMaxGUIHelper = new MinMaxGUIHelper(camera, 'near', 'far', 0.1);\n// gui.add(minMaxGUIHelper, 'min', 0.1, 50, 0.1).name('near');\n// gui.add(minMaxGUIHelper, 'max', 0.1, 50, 0.1).name('far');\n\n\n\n\n\n\n\n\n\n\n\n\nfunction main() {\n\n const Controller = new _utils__WEBPACK_IMPORTED_MODULE_6__.KeyboardController()\n\n var stats = new _node_modules_three_examples_jsm_libs_stats_module_js__WEBPACK_IMPORTED_MODULE_5__.default();\n stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom\n document.body.appendChild(stats.dom);\n\n const canvas = document.querySelector('#c');\n const view1Elem = document.querySelector('#view1');\n const view2Elem = document.querySelector('#view2');\n const renderer = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.WebGLRenderer({ canvas });\n\n const scene = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Scene();\n window.scene = scene;\n scene.background = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Color('pink');\n\n const helpersGroup = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Group();\n scene.add(helpersGroup);\n\n\n const size = 1;\n const near = 5;\n const far = 50;\n const camera = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.OrthographicCamera(-size, size, size, -size, near, far);\n camera.zoom = 0.1;\n camera.position.set(0, 0, 20);\n const controls = new _OrbitControls__WEBPACK_IMPORTED_MODULE_1__.OrbitControls(camera, view1Elem);\n // const controls = new TrackballControls(camera, view1Elem);\n controls.target.set(0, 0, 0);\n controls.update()\n const cameraHelper = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.CameraHelper(camera);\n helpersGroup.add(cameraHelper);\n\n\n // const camera2 = new THREE.PerspectiveCamera(\n // 60, // fov\n // 2, // aspect\n // 0.1, // near\n // 500, // far\n // );\n // camera2.position.set(16, 28, 40);\n // camera2.lookAt(0, 5, 0);\n // const controls2 = new OrbitControls(camera2, view2Elem);\n // controls2.target.set(0, 5, 0);\n // controls2.update();\n\n\n\n const axesHelper = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.AxesHelper(5);\n helpersGroup.add(axesHelper);\n\n const sketchPlane = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Plane(new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.Vector3(0, 0, 1), 0);\n const sketcher = new _Sketcher__WEBPACK_IMPORTED_MODULE_3__.Sketcher(camera, view1Elem, sketchPlane)\n scene.add(sketcher)\n\n {\n const color = 0xFFFFFF;\n const intensity = 1;\n const light = new _node_modules_three_src_Three__WEBPACK_IMPORTED_MODULE_0__.DirectionalLight(color, intensity);\n light.position.set(0, 10, 0);\n light.target.position.set(-5, 0, 0);\n scene.add(light);\n scene.add(light.target);\n }\n\n\n\n\n\n function resizeRendererToDisplaySize(renderer) {\n const canvas = renderer.domElement;\n const width = canvas.clientWidth;\n const height = canvas.clientHeight;\n const needResize = canvas.width !== width || canvas.height !== height;\n if (needResize) {\n renderer.setSize(width, height, false);\n }\n return needResize;\n }\n\n function setScissorForElement(elem) {\n const canvasRect = canvas.getBoundingClientRect();\n const elemRect = elem.getBoundingClientRect();\n\n // compute a canvas relative rectangle\n const right = Math.min(elemRect.right, canvasRect.right) - canvasRect.left;\n const left = Math.max(0, elemRect.left - canvasRect.left);\n const bottom = Math.min(elemRect.bottom, canvasRect.bottom) - canvasRect.top;\n const top = Math.max(0, elemRect.top - canvasRect.top);\n\n const width = Math.min(canvasRect.width, right - left);\n const height = Math.min(canvasRect.height, bottom - top);\n\n // setup the scissor to only render to that part of the canvas\n const positiveYUpBottom = canvasRect.height - bottom;\n renderer.setScissor(left, positiveYUpBottom, width, height);\n renderer.setViewport(left, positiveYUpBottom, width, height);\n\n // return the aspect\n return width / height;\n }\n\n function render() {\n stats.begin();\n resizeRendererToDisplaySize(renderer);\n\n renderer.setScissorTest(true);\n {\n const aspect = setScissorForElement(view1Elem);\n camera.left = -aspect;\n camera.right = aspect;\n camera.updateProjectionMatrix();\n cameraHelper.update();\n cameraHelper.visible = false;\n renderer.render(scene, camera);\n }\n // {\n // const aspect = setScissorForElement(view2Elem);\n // camera2.aspect = aspect;\n // camera2.updateProjectionMatrix();\n // cameraHelper.visible = true;\n // renderer.render(scene, camera2);\n // }\n\n stats.end();\n\n // requestAnimationFrame(render);\n }\n // requestAnimationFrame(render);\n\n\n controls.addEventListener('change', render);\n controls.addEventListener('start', render);\n // controls2.addEventListener('change', render);\n sketcher.addEventListener('change', render);\n window.addEventListener('resize', render);\n render();\n}\n\nmain();\n\n\n//# sourceURL=webpack:///./src/index.js?"); /***/ }), diff --git a/dist/index.html b/dist/index.html index a8e2085..5cf2a46 100644 --- a/dist/index.html +++ b/dist/index.html @@ -58,7 +58,7 @@
-
+