@shapediver/viewer.rendering-engine.intersection-restriction-engine 3.9.0 → 3.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api/implementation/AbstractRestrictionApi.d.ts +2 -2
- package/dist/api/implementation/AbstractRestrictionApi.d.ts.map +1 -1
- package/dist/api/implementation/AbstractRestrictionApi.js.map +1 -1
- package/dist/api/implementation/AbstractSnapRestrictionApi.d.ts +2 -2
- package/dist/api/implementation/AbstractSnapRestrictionApi.d.ts.map +1 -1
- package/dist/api/implementation/AbstractSnapRestrictionApi.js.map +1 -1
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.d.ts +2 -2
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.d.ts.map +1 -1
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.js.map +1 -1
- package/dist/api/implementation/geometry/GeometryRestrictionApi.d.ts +3 -3
- package/dist/api/implementation/geometry/GeometryRestrictionApi.d.ts.map +1 -1
- package/dist/api/implementation/geometry/GeometryRestrictionApi.js.map +1 -1
- package/dist/api/implementation/line/LineRestrictionApi.d.ts +3 -3
- package/dist/api/implementation/line/LineRestrictionApi.d.ts.map +1 -1
- package/dist/api/implementation/line/LineRestrictionApi.js.map +1 -1
- package/dist/api/implementation/plane/PlaneRestrictionApi.d.ts +6 -6
- package/dist/api/implementation/plane/PlaneRestrictionApi.d.ts.map +1 -1
- package/dist/api/implementation/plane/PlaneRestrictionApi.js.map +1 -1
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.d.ts +2 -2
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.d.ts.map +1 -1
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.js.map +1 -1
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.d.ts +2 -2
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.d.ts.map +1 -1
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.js.map +1 -1
- package/dist/api/implementation/plane/snap/GridRestrictionApi.d.ts +2 -2
- package/dist/api/implementation/plane/snap/GridRestrictionApi.d.ts.map +1 -1
- package/dist/api/implementation/plane/snap/GridRestrictionApi.js.map +1 -1
- package/dist/api/implementation/point/PointRestrictionApi.d.ts +3 -3
- package/dist/api/implementation/point/PointRestrictionApi.d.ts.map +1 -1
- package/dist/api/implementation/point/PointRestrictionApi.js.map +1 -1
- package/dist/api/interfaces/IRestrictionApi.d.ts.map +1 -1
- package/dist/api/interfaces/ISnapRestrictionApi.d.ts +1 -1
- package/dist/api/interfaces/ISnapRestrictionApi.d.ts.map +1 -1
- package/dist/implementation/EventManager.d.ts +3 -3
- package/dist/implementation/EventManager.d.ts.map +1 -1
- package/dist/implementation/EventManager.js.map +1 -1
- package/dist/implementation/GeometryMathManager.d.ts +4 -4
- package/dist/implementation/GeometryMathManager.d.ts.map +1 -1
- package/dist/implementation/GeometryMathManager.js +25 -13
- package/dist/implementation/GeometryMathManager.js.map +1 -1
- package/dist/implementation/RestrictionManager.d.ts +7 -6
- package/dist/implementation/RestrictionManager.d.ts.map +1 -1
- package/dist/implementation/RestrictionManager.js +65 -29
- package/dist/implementation/RestrictionManager.js.map +1 -1
- package/dist/implementation/restrictions/AbstractRestriction.d.ts +7 -7
- package/dist/implementation/restrictions/AbstractRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/AbstractRestriction.js +8 -5
- package/dist/implementation/restrictions/AbstractRestriction.js.map +1 -1
- package/dist/implementation/restrictions/AbstractSnapRestriction.d.ts +7 -7
- package/dist/implementation/restrictions/AbstractSnapRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/AbstractSnapRestriction.js +4 -4
- package/dist/implementation/restrictions/AbstractSnapRestriction.js.map +1 -1
- package/dist/implementation/restrictions/RestrictionsHelper.d.ts +2 -2
- package/dist/implementation/restrictions/RestrictionsHelper.d.ts.map +1 -1
- package/dist/implementation/restrictions/RestrictionsHelper.js +7 -3
- package/dist/implementation/restrictions/RestrictionsHelper.js.map +1 -1
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.d.ts +7 -7
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js +2 -2
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js.map +1 -1
- package/dist/implementation/restrictions/geometry/GeometryRestriction.d.ts +8 -8
- package/dist/implementation/restrictions/geometry/GeometryRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/geometry/GeometryRestriction.js +67 -30
- package/dist/implementation/restrictions/geometry/GeometryRestriction.js.map +1 -1
- package/dist/implementation/restrictions/line/LineRestriction.d.ts +20 -9
- package/dist/implementation/restrictions/line/LineRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/line/LineRestriction.js +66 -9
- package/dist/implementation/restrictions/line/LineRestriction.js.map +1 -1
- package/dist/implementation/restrictions/plane/PlaneRestriction.d.ts +11 -11
- package/dist/implementation/restrictions/plane/PlaneRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/plane/PlaneRestriction.js +34 -16
- package/dist/implementation/restrictions/plane/PlaneRestriction.js.map +1 -1
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts +9 -9
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.js +87 -35
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.js.map +1 -1
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts +8 -8
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.js +79 -24
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.js.map +1 -1
- package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts +8 -8
- package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/plane/snap/GridRestriction.js +118 -23
- package/dist/implementation/restrictions/plane/snap/GridRestriction.js.map +1 -1
- package/dist/implementation/restrictions/point/PointRestriction.d.ts +8 -8
- package/dist/implementation/restrictions/point/PointRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/point/PointRestriction.js +5 -4
- package/dist/implementation/restrictions/point/PointRestriction.js.map +1 -1
- package/dist/index.d.ts +29 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/interfaces/IDragAnchor.d.ts +1 -1
- package/dist/interfaces/IDragAnchor.d.ts.map +1 -1
- package/dist/interfaces/IRestriction.d.ts +14 -13
- package/dist/interfaces/IRestriction.d.ts.map +1 -1
- package/dist/interfaces/IRestriction.js +2 -2
- package/dist/interfaces/IRestriction.js.map +1 -1
- package/dist/interfaces/IRestrictionManager.d.ts +2 -2
- package/dist/interfaces/IRestrictionManager.d.ts.map +1 -1
- package/dist/interfaces/ISnapRestriction.d.ts +3 -3
- package/dist/interfaces/ISnapRestriction.d.ts.map +1 -1
- package/dist/interfaces/ISnapRestriction.js.map +1 -1
- package/dist/interfaces/IVisualizationSettings.d.ts +1 -1
- package/dist/interfaces/IVisualizationSettings.d.ts.map +1 -1
- package/package.json +52 -52
|
@@ -36,17 +36,17 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
36
36
|
var _AxisRestriction_activationKeyPlane, _AxisRestriction_activationKeyX, _AxisRestriction_activationKeyY, _AxisRestriction_activationKeyZ, _AxisRestriction_planeRestriction, _AxisRestriction_active, _AxisRestriction_axesHelper, _AxisRestriction_geometryMathManager, _AxisRestriction_priority;
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.AxisRestriction = void 0;
|
|
39
|
-
const THREE = __importStar(require("three"));
|
|
40
|
-
const AbstractSnapRestriction_1 = require("../../AbstractSnapRestriction");
|
|
41
39
|
const viewer_1 = require("@shapediver/viewer");
|
|
42
40
|
const gl_matrix_1 = require("gl-matrix");
|
|
41
|
+
const THREE = __importStar(require("three"));
|
|
42
|
+
const AbstractSnapRestriction_1 = require("../../AbstractSnapRestriction");
|
|
43
43
|
// #endregion Type aliases (1)
|
|
44
44
|
// #region Classes (1)
|
|
45
45
|
class AxisRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction {
|
|
46
46
|
// #endregion Properties (9)
|
|
47
47
|
// #region Constructors (1)
|
|
48
48
|
constructor(viewport, geometryMathManager, parentNode, planeRestriction, properties) {
|
|
49
|
-
super(viewport, parentNode,
|
|
49
|
+
super(viewport, parentNode, "axis");
|
|
50
50
|
// #region Properties (9)
|
|
51
51
|
_AxisRestriction_activationKeyPlane.set(this, void 0);
|
|
52
52
|
_AxisRestriction_activationKeyX.set(this, void 0);
|
|
@@ -59,10 +59,10 @@ class AxisRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction
|
|
|
59
59
|
_AxisRestriction_priority.set(this, 0);
|
|
60
60
|
__classPrivateFieldSet(this, _AxisRestriction_planeRestriction, planeRestriction, "f");
|
|
61
61
|
__classPrivateFieldSet(this, _AxisRestriction_geometryMathManager, geometryMathManager, "f");
|
|
62
|
-
__classPrivateFieldSet(this, _AxisRestriction_activationKeyX, (properties === null || properties === void 0 ? void 0 : properties.activationKeyX) ||
|
|
63
|
-
__classPrivateFieldSet(this, _AxisRestriction_activationKeyY, (properties === null || properties === void 0 ? void 0 : properties.activationKeyY) ||
|
|
64
|
-
__classPrivateFieldSet(this, _AxisRestriction_activationKeyZ, (properties === null || properties === void 0 ? void 0 : properties.activationKeyZ) ||
|
|
65
|
-
__classPrivateFieldSet(this, _AxisRestriction_activationKeyPlane, (properties === null || properties === void 0 ? void 0 : properties.activationKeyPlane) ||
|
|
62
|
+
__classPrivateFieldSet(this, _AxisRestriction_activationKeyX, (properties === null || properties === void 0 ? void 0 : properties.activationKeyX) || "x", "f");
|
|
63
|
+
__classPrivateFieldSet(this, _AxisRestriction_activationKeyY, (properties === null || properties === void 0 ? void 0 : properties.activationKeyY) || "y", "f");
|
|
64
|
+
__classPrivateFieldSet(this, _AxisRestriction_activationKeyZ, (properties === null || properties === void 0 ? void 0 : properties.activationKeyZ) || "z", "f");
|
|
65
|
+
__classPrivateFieldSet(this, _AxisRestriction_activationKeyPlane, (properties === null || properties === void 0 ? void 0 : properties.activationKeyPlane) || "p", "f");
|
|
66
66
|
__classPrivateFieldSet(this, _AxisRestriction_priority, (properties === null || properties === void 0 ? void 0 : properties.priority) || 1, "f");
|
|
67
67
|
// create the axes visualization
|
|
68
68
|
this.createAxesVisualization();
|
|
@@ -94,34 +94,75 @@ class AxisRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction
|
|
|
94
94
|
return;
|
|
95
95
|
if (!metaData || !metaData.startPoint)
|
|
96
96
|
return;
|
|
97
|
-
const xPressed = ((
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
97
|
+
const xPressed = ((_a = metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
|
|
98
|
+
(metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys[0]) === __classPrivateFieldGet(this, _AxisRestriction_activationKeyX, "f");
|
|
99
|
+
const yPressed = ((_b = metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys) === null || _b === void 0 ? void 0 : _b.length) === 1 &&
|
|
100
|
+
(metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys[0]) === __classPrivateFieldGet(this, _AxisRestriction_activationKeyY, "f");
|
|
101
|
+
const zPressed = ((_c = metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys) === null || _c === void 0 ? void 0 : _c.length) === 1 &&
|
|
102
|
+
(metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys[0]) === __classPrivateFieldGet(this, _AxisRestriction_activationKeyZ, "f");
|
|
103
|
+
const pPressed = ((_d = metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys) === null || _d === void 0 ? void 0 : _d.length) === 1 &&
|
|
104
|
+
(metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys[0]) === __classPrivateFieldGet(this, _AxisRestriction_activationKeyPlane, "f");
|
|
101
105
|
// we move the axes helper to the reference point
|
|
102
106
|
if (__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f") && (xPressed || yPressed || zPressed)) {
|
|
103
107
|
__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").position.copy(new THREE.Vector3(metaData.startPoint[0], metaData.startPoint[1], metaData.startPoint[2]));
|
|
104
108
|
__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").visible = false;
|
|
105
109
|
}
|
|
106
110
|
if (xPressed) {
|
|
107
|
-
const snappedPoint = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint({
|
|
111
|
+
const snappedPoint = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint({
|
|
112
|
+
origin: metaData.startPoint,
|
|
113
|
+
direction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorU,
|
|
114
|
+
}, point);
|
|
108
115
|
const closestPointOnRay = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint(ray, snappedPoint);
|
|
109
|
-
return {
|
|
116
|
+
return {
|
|
117
|
+
targetPoint: snappedPoint,
|
|
118
|
+
closestIntersectionPoint: closestPointOnRay,
|
|
119
|
+
distanceOriginToClosestIntersectionPointSquared: gl_matrix_1.vec3.sqrDist(ray.origin, closestPointOnRay),
|
|
120
|
+
distanceClosestPointToTargetPointSquared: gl_matrix_1.vec3.sqrDist(snappedPoint, closestPointOnRay),
|
|
121
|
+
restriction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f"),
|
|
122
|
+
snapRestriction: this,
|
|
123
|
+
};
|
|
110
124
|
}
|
|
111
125
|
else if (yPressed) {
|
|
112
|
-
const snappedPoint = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint({
|
|
126
|
+
const snappedPoint = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint({
|
|
127
|
+
origin: metaData.startPoint,
|
|
128
|
+
direction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorV,
|
|
129
|
+
}, point);
|
|
113
130
|
const closestPointOnRay = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint(ray, snappedPoint);
|
|
114
|
-
return {
|
|
131
|
+
return {
|
|
132
|
+
targetPoint: snappedPoint,
|
|
133
|
+
closestIntersectionPoint: closestPointOnRay,
|
|
134
|
+
distanceOriginToClosestIntersectionPointSquared: gl_matrix_1.vec3.sqrDist(ray.origin, closestPointOnRay),
|
|
135
|
+
distanceClosestPointToTargetPointSquared: gl_matrix_1.vec3.sqrDist(snappedPoint, closestPointOnRay),
|
|
136
|
+
restriction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f"),
|
|
137
|
+
snapRestriction: this,
|
|
138
|
+
};
|
|
115
139
|
}
|
|
116
140
|
else if (zPressed) {
|
|
117
|
-
const snappedPoint = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPointsRayRay({
|
|
141
|
+
const snappedPoint = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPointsRayRay({
|
|
142
|
+
origin: metaData.startPoint,
|
|
143
|
+
direction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").normal,
|
|
144
|
+
}, ray).closestPointOnRay1;
|
|
118
145
|
const closestPointOnRay = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint(ray, snappedPoint);
|
|
119
|
-
return {
|
|
146
|
+
return {
|
|
147
|
+
targetPoint: snappedPoint,
|
|
148
|
+
closestIntersectionPoint: closestPointOnRay,
|
|
149
|
+
distanceOriginToClosestIntersectionPointSquared: gl_matrix_1.vec3.sqrDist(ray.origin, closestPointOnRay),
|
|
150
|
+
distanceClosestPointToTargetPointSquared: gl_matrix_1.vec3.sqrDist(snappedPoint, closestPointOnRay),
|
|
151
|
+
restriction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f"),
|
|
152
|
+
snapRestriction: this,
|
|
153
|
+
};
|
|
120
154
|
}
|
|
121
155
|
else if (pPressed) {
|
|
122
156
|
const snappedPoint = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPointOnPlane(__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").origin, __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").normal, point);
|
|
123
157
|
const closestPointOnRay = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint(ray, snappedPoint);
|
|
124
|
-
return {
|
|
158
|
+
return {
|
|
159
|
+
targetPoint: snappedPoint,
|
|
160
|
+
closestIntersectionPoint: closestPointOnRay,
|
|
161
|
+
distanceOriginToClosestIntersectionPointSquared: gl_matrix_1.vec3.sqrDist(ray.origin, closestPointOnRay),
|
|
162
|
+
distanceClosestPointToTargetPointSquared: gl_matrix_1.vec3.sqrDist(snappedPoint, closestPointOnRay),
|
|
163
|
+
restriction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f"),
|
|
164
|
+
snapRestriction: this,
|
|
165
|
+
};
|
|
125
166
|
}
|
|
126
167
|
}
|
|
127
168
|
updatePlaneDefinition() {
|
|
@@ -154,14 +195,28 @@ class AxisRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction
|
|
|
154
195
|
__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").position.copy(new THREE.Vector3(__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").origin[0], __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").origin[1], __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").origin[2]));
|
|
155
196
|
__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").visible = false;
|
|
156
197
|
__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").renderOrder = 100;
|
|
157
|
-
__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").material.depthTest =
|
|
158
|
-
|
|
198
|
+
__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").material.depthTest =
|
|
199
|
+
false;
|
|
200
|
+
__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").material.transparent =
|
|
201
|
+
true;
|
|
159
202
|
// three.js uses a right-handed coordinate system, so we need to rotate the axes helper
|
|
160
203
|
const rotationMatrix = new THREE.Matrix4().fromArray([
|
|
161
|
-
__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorU[0],
|
|
162
|
-
__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").
|
|
163
|
-
__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").
|
|
164
|
-
0,
|
|
204
|
+
__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorU[0],
|
|
205
|
+
__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorU[1],
|
|
206
|
+
__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorU[2],
|
|
207
|
+
0,
|
|
208
|
+
__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorV[0],
|
|
209
|
+
__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorV[1],
|
|
210
|
+
__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorV[2],
|
|
211
|
+
0,
|
|
212
|
+
__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").normal[0],
|
|
213
|
+
__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").normal[1],
|
|
214
|
+
__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").normal[2],
|
|
215
|
+
0,
|
|
216
|
+
0,
|
|
217
|
+
0,
|
|
218
|
+
0,
|
|
219
|
+
1,
|
|
165
220
|
]);
|
|
166
221
|
__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").rotation.setFromRotationMatrix(rotationMatrix);
|
|
167
222
|
this._object3D.add(__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AxisRestriction.js","sourceRoot":"","sources":["../../../../../src/implementation/restrictions/plane/snap/AxisRestriction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"AxisRestriction.js","sourceRoot":"","sources":["../../../../../src/implementation/restrictions/plane/snap/AxisRestriction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA2E;AAE3E,yCAA+B;AAC/B,6CAA+B;AAU/B,2EAAsE;AAYtE,8BAA8B;AAE9B,sBAAsB;AAEtB,MAAa,eACZ,SAAQ,iDAAuB;IAgB/B,4BAA4B;IAE5B,2BAA2B;IAE3B,YACC,QAAsB,EACtB,mBAAwC,EACxC,UAAqB,EACrB,gBAAkC,EAClC,UAAsC;QAEtC,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QAxBrC,yBAAyB;QAEzB,sDAAqC;QACrC,kDAAiC;QACjC,kDAAiC;QACjC,kDAAiC;QACjC,oDAA6C;QAE7C,kCAAmB,KAAK,EAAC;QACzB,8CAA+B;QAC/B,uDAA0C;QAC1C,oCAAoB,CAAC,EAAC;QAcrB,uBAAA,IAAI,qCAAqB,gBAAgB,MAAA,CAAC;QAC1C,uBAAA,IAAI,wCAAwB,mBAAmB,MAAA,CAAC;QAEhD,uBAAA,IAAI,mCAAmB,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,cAAc,KAAI,GAAG,MAAA,CAAC;QACzD,uBAAA,IAAI,mCAAmB,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,cAAc,KAAI,GAAG,MAAA,CAAC;QACzD,uBAAA,IAAI,mCAAmB,CAAA,UAAU,aAAV,UAAU,u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viewer";
|
|
2
|
+
import { IRay } from "@shapediver/viewer.shared.types";
|
|
3
|
+
import { vec3 } from "gl-matrix";
|
|
4
|
+
import { RestrictionMetaData, RestrictionResult } from "../../../../interfaces/IRestriction";
|
|
5
|
+
import { ISnapRestriction, SnapRestrictionProperties } from "../../../../interfaces/ISnapRestriction";
|
|
6
|
+
import { GeometryMathManager } from "../../../GeometryMathManager";
|
|
7
|
+
import { AbstractSnapRestriction } from "../../AbstractSnapRestriction";
|
|
8
|
+
import { PlaneRestriction } from "../PlaneRestriction";
|
|
9
9
|
/**
|
|
10
10
|
* Properties for the grid restriction
|
|
11
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridRestriction.d.ts","sourceRoot":"","sources":["../../../../../src/implementation/restrictions/plane/snap/GridRestriction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GridRestriction.d.ts","sourceRoot":"","sources":["../../../../../src/implementation/restrictions/plane/snap/GridRestriction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,SAAS,EAAE,YAAY,EAAY,MAAM,oBAAoB,CAAC;AAM3E,OAAO,EAAC,IAAI,EAAc,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAE/B,OAAO,EACN,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACN,gBAAgB,EAChB,yBAAyB,EACzB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAC,uBAAuB,EAAC,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAIrD;;GAEG;AACH,oBAAY,yBAAyB,GAAG;IACvC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B,GAAG,yBAAyB,CAAC;AAM9B,qBAAa,eACZ,SAAQ,uBACR,YAAW,gBAAgB;;gBAsB1B,QAAQ,EAAE,YAAY,EACtB,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,SAAS,EACrB,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,CAAC,EAAE,yBAAyB;IAsFvC,IAAW,MAAM,IAAI,OAAO,CAE3B;IAED,IAAW,MAAM,CAAC,KAAK,EAAE,OAAO,EAI/B;IAED,IAAW,eAAe,IAAI,OAAO,CAEpC;IAED,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,QAAQ,CAAC,KAAK,EAAE,MAAM,EAMhC;IAED,IAAW,gBAAgB,IAAI,OAAO,CAErC;IAED,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,QAAQ,CAAC,KAAK,EAAE,MAAM,EAEhC;IAOM,IAAI,CACV,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,mBAAmB,GAC3B,iBAAiB,GAAG,SAAS;IAqFzB,qBAAqB,IAAI,IAAI;IASpC,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAYnD,OAAO,CAAC,uBAAuB;IAyF/B,OAAO,CAAC,oBAAoB;CAiB5B"}
|
|
@@ -33,13 +33,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
33
33
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
34
34
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
35
35
|
};
|
|
36
|
-
var _GridRestriction_activationKey, _GridRestriction_planeRestriction, _GridRestriction_active, _GridRestriction_gridHelper, _GridRestriction_gridSize, _GridRestriction_gridUnit, _GridRestriction_gridUnitEditable, _GridRestriction_offsetFromUnit, _GridRestriction_priority;
|
|
36
|
+
var _GridRestriction_activationKey, _GridRestriction_eventEngine, _GridRestriction_planeRestriction, _GridRestriction_active, _GridRestriction_gridHelper, _GridRestriction_gridSize, _GridRestriction_gridUnit, _GridRestriction_gridUnitEditable, _GridRestriction_offsetFromUnit, _GridRestriction_toggleInversion, _GridRestriction_priority;
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.GridRestriction = void 0;
|
|
39
|
-
const THREE = __importStar(require("three"));
|
|
40
|
-
const AbstractSnapRestriction_1 = require("../../AbstractSnapRestriction");
|
|
41
39
|
const viewer_1 = require("@shapediver/viewer");
|
|
40
|
+
const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
|
|
42
41
|
const gl_matrix_1 = require("gl-matrix");
|
|
42
|
+
const THREE = __importStar(require("three"));
|
|
43
|
+
const AbstractSnapRestriction_1 = require("../../AbstractSnapRestriction");
|
|
43
44
|
// #endregion Type aliases (1)
|
|
44
45
|
// #region Classes (1)
|
|
45
46
|
class GridRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction {
|
|
@@ -47,9 +48,10 @@ class GridRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction
|
|
|
47
48
|
// #region Constructors (1)
|
|
48
49
|
constructor(viewport, geometryMathManager, parentNode, planeRestriction, properties) {
|
|
49
50
|
var _a, _b, _c;
|
|
50
|
-
super(viewport, parentNode,
|
|
51
|
+
super(viewport, parentNode, "grid");
|
|
51
52
|
// #region Properties (9)
|
|
52
53
|
_GridRestriction_activationKey.set(this, void 0);
|
|
54
|
+
_GridRestriction_eventEngine.set(this, viewer_shared_services_1.EventEngine.instance);
|
|
53
55
|
_GridRestriction_planeRestriction.set(this, void 0);
|
|
54
56
|
_GridRestriction_active.set(this, false);
|
|
55
57
|
_GridRestriction_gridHelper.set(this, void 0);
|
|
@@ -57,12 +59,62 @@ class GridRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction
|
|
|
57
59
|
_GridRestriction_gridUnit.set(this, void 0);
|
|
58
60
|
_GridRestriction_gridUnitEditable.set(this, true);
|
|
59
61
|
_GridRestriction_offsetFromUnit.set(this, gl_matrix_1.vec3.create());
|
|
62
|
+
_GridRestriction_toggleInversion.set(this, false);
|
|
60
63
|
_GridRestriction_priority.set(this, 0);
|
|
61
64
|
__classPrivateFieldSet(this, _GridRestriction_planeRestriction, planeRestriction, "f");
|
|
62
|
-
__classPrivateFieldSet(this, _GridRestriction_activationKey, (properties === null || properties === void 0 ? void 0 : properties.activationKey) ||
|
|
65
|
+
__classPrivateFieldSet(this, _GridRestriction_activationKey, (properties === null || properties === void 0 ? void 0 : properties.activationKey) || "g", "f");
|
|
63
66
|
this.enabled = (_a = properties === null || properties === void 0 ? void 0 : properties.enabled) !== null && _a !== void 0 ? _a : false;
|
|
64
67
|
this._enabledEditable = (_b = properties === null || properties === void 0 ? void 0 : properties.enabledEditable) !== null && _b !== void 0 ? _b : true;
|
|
65
|
-
|
|
68
|
+
// if a grid unit is provided, we toggle it on by default
|
|
69
|
+
if ((properties === null || properties === void 0 ? void 0 : properties.gridUnit) !== undefined && (properties === null || properties === void 0 ? void 0 : properties.gridUnit) !== 0) {
|
|
70
|
+
__classPrivateFieldSet(this, _GridRestriction_toggleInversion, true, "f");
|
|
71
|
+
__classPrivateFieldSet(this, _GridRestriction_gridUnit, properties.gridUnit, "f");
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
// we define our own grid unit
|
|
75
|
+
__classPrivateFieldSet(this, _GridRestriction_gridUnit, 1, "f");
|
|
76
|
+
/**
|
|
77
|
+
* Depending on the scene radius, we calculate the grid unit.
|
|
78
|
+
* The grid unit is calculated as follows:
|
|
79
|
+
* - calculate 1% of the scene radius
|
|
80
|
+
* - find the closest power of 10 that is smaller than the 1% of the scene radius
|
|
81
|
+
* - find the closest power of 10 that is larger than the 1% of the scene radius
|
|
82
|
+
* - the grid unit is whichever of the two is closer to the 1% of the scene radius
|
|
83
|
+
*
|
|
84
|
+
* @param sceneRadius
|
|
85
|
+
* @returns
|
|
86
|
+
*/
|
|
87
|
+
const calculateGridUnit = (sceneRadius) => {
|
|
88
|
+
const percentage = 0.01;
|
|
89
|
+
const percentageSceneRadius = sceneRadius * percentage;
|
|
90
|
+
const log10 = Math.log10(percentageSceneRadius);
|
|
91
|
+
const smaller = Math.pow(10, Math.floor(log10));
|
|
92
|
+
const larger = Math.pow(10, Math.ceil(log10));
|
|
93
|
+
const gridUnit = Math.abs(smaller - percentageSceneRadius) <
|
|
94
|
+
Math.abs(larger - percentageSceneRadius)
|
|
95
|
+
? smaller
|
|
96
|
+
: larger;
|
|
97
|
+
return gridUnit;
|
|
98
|
+
};
|
|
99
|
+
if (viewer_1.sceneTree.root.boundingBox.isEmpty()) {
|
|
100
|
+
// add an event listener to update the grid size
|
|
101
|
+
const eventListenerToken = __classPrivateFieldGet(this, _GridRestriction_eventEngine, "f").addListener(viewer_shared_services_1.EVENTTYPE_SCENE.SCENE_BOUNDING_BOX_CHANGE, (e) => {
|
|
102
|
+
const sceneEvent = e;
|
|
103
|
+
if (sceneEvent.boundingBox) {
|
|
104
|
+
const box = new viewer_1.Box(sceneEvent.boundingBox.min, sceneEvent.boundingBox.max);
|
|
105
|
+
if (box.isEmpty())
|
|
106
|
+
return;
|
|
107
|
+
__classPrivateFieldSet(this, _GridRestriction_gridUnit, calculateGridUnit(box.boundingSphere.radius), "f");
|
|
108
|
+
this.createOffsetFromUnit();
|
|
109
|
+
this.createGridVisualization();
|
|
110
|
+
__classPrivateFieldGet(this, _GridRestriction_eventEngine, "f").removeListener(eventListenerToken);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
__classPrivateFieldSet(this, _GridRestriction_gridUnit, calculateGridUnit(viewer_1.sceneTree.root.boundingBox.boundingSphere.radius), "f");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
66
118
|
__classPrivateFieldSet(this, _GridRestriction_gridUnitEditable, (_c = properties === null || properties === void 0 ? void 0 : properties.gridUnitEditable) !== null && _c !== void 0 ? _c : true, "f");
|
|
67
119
|
__classPrivateFieldSet(this, _GridRestriction_priority, (properties === null || properties === void 0 ? void 0 : properties.priority) || 0, "f");
|
|
68
120
|
// create the offset of the grid size to origin
|
|
@@ -107,8 +159,14 @@ class GridRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction
|
|
|
107
159
|
// public get
|
|
108
160
|
snap(ray, point, distance, metaData) {
|
|
109
161
|
var _a;
|
|
110
|
-
// if the
|
|
111
|
-
|
|
162
|
+
// check if the activation key is pressed
|
|
163
|
+
let isKeyToggled = ((_a = metaData === null || metaData === void 0 ? void 0 : metaData.toggledKeys) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
|
|
164
|
+
(metaData === null || metaData === void 0 ? void 0 : metaData.toggledKeys[0]) === __classPrivateFieldGet(this, _GridRestriction_activationKey, "f");
|
|
165
|
+
// invert the result if toggleInversion is set
|
|
166
|
+
if (__classPrivateFieldGet(this, _GridRestriction_toggleInversion, "f"))
|
|
167
|
+
isKeyToggled = !isKeyToggled;
|
|
168
|
+
// if the restriction is not enabled and the activation key is set and the key is not pressed, return
|
|
169
|
+
if (this.enabled === false && !isKeyToggled)
|
|
112
170
|
return;
|
|
113
171
|
/**
|
|
114
172
|
* Explanation of the following code:
|
|
@@ -136,12 +194,23 @@ class GridRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction
|
|
|
136
194
|
const rotatedPoint = gl_matrix_1.vec3.transformMat4(gl_matrix_1.vec3.create(), point, __classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").transformationToXYPlaneMatrix);
|
|
137
195
|
// Snap the offset to the grid
|
|
138
196
|
const snappedOffset = gl_matrix_1.vec3.create();
|
|
139
|
-
snappedOffset[0] =
|
|
140
|
-
|
|
197
|
+
snappedOffset[0] =
|
|
198
|
+
Math.round(rotatedPoint[0] / __classPrivateFieldGet(this, _GridRestriction_gridUnit, "f")) * __classPrivateFieldGet(this, _GridRestriction_gridUnit, "f") -
|
|
199
|
+
__classPrivateFieldGet(this, _GridRestriction_offsetFromUnit, "f")[0];
|
|
200
|
+
snappedOffset[1] =
|
|
201
|
+
Math.round(rotatedPoint[1] / __classPrivateFieldGet(this, _GridRestriction_gridUnit, "f")) * __classPrivateFieldGet(this, _GridRestriction_gridUnit, "f") -
|
|
202
|
+
__classPrivateFieldGet(this, _GridRestriction_offsetFromUnit, "f")[1];
|
|
141
203
|
snappedOffset[2] = rotatedPoint[2];
|
|
142
204
|
// Move the snapped point back to the original coordinate system
|
|
143
205
|
const snappedPoint = gl_matrix_1.vec3.transformMat4(gl_matrix_1.vec3.create(), snappedOffset, __classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").transformationFromXYPlaneMatrix);
|
|
144
|
-
return {
|
|
206
|
+
return {
|
|
207
|
+
targetPoint: snappedPoint,
|
|
208
|
+
closestIntersectionPoint: point,
|
|
209
|
+
distanceOriginToClosestIntersectionPointSquared: distance,
|
|
210
|
+
distanceClosestPointToTargetPointSquared: gl_matrix_1.vec3.sqrDist(snappedPoint, point),
|
|
211
|
+
restriction: __classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f"),
|
|
212
|
+
snapRestriction: this,
|
|
213
|
+
};
|
|
145
214
|
}
|
|
146
215
|
updatePlaneDefinition() {
|
|
147
216
|
this.createOffsetFromUnit();
|
|
@@ -171,12 +240,15 @@ class GridRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction
|
|
|
171
240
|
}
|
|
172
241
|
const radius = bb.boundingSphere.radius;
|
|
173
242
|
__classPrivateFieldSet(this, _GridRestriction_gridSize, radius * 2, "f");
|
|
174
|
-
if (__classPrivateFieldGet(this, _GridRestriction_gridSize, "f") === Infinity ||
|
|
243
|
+
if (__classPrivateFieldGet(this, _GridRestriction_gridSize, "f") === Infinity ||
|
|
244
|
+
__classPrivateFieldGet(this, _GridRestriction_gridSize, "f") === -Infinity ||
|
|
245
|
+
isNaN(__classPrivateFieldGet(this, _GridRestriction_gridSize, "f")) ||
|
|
246
|
+
__classPrivateFieldGet(this, _GridRestriction_gridSize, "f") === 0)
|
|
175
247
|
__classPrivateFieldSet(this, _GridRestriction_gridSize, 100, "f");
|
|
176
248
|
// if the grid size is not divisible by the grid unit, we need to adjust the grid size
|
|
177
249
|
let gridSize = __classPrivateFieldGet(this, _GridRestriction_gridUnit, "f") * Math.ceil(__classPrivateFieldGet(this, _GridRestriction_gridSize, "f") / __classPrivateFieldGet(this, _GridRestriction_gridUnit, "f"));
|
|
178
250
|
// if the number of divisions is odd, we need to add one more division
|
|
179
|
-
if (gridSize / __classPrivateFieldGet(this, _GridRestriction_gridUnit, "f") % 2 === 1)
|
|
251
|
+
if ((gridSize / __classPrivateFieldGet(this, _GridRestriction_gridUnit, "f")) % 2 === 1)
|
|
180
252
|
gridSize += __classPrivateFieldGet(this, _GridRestriction_gridUnit, "f");
|
|
181
253
|
// todo adjust grid size so that is divisible by grid unit
|
|
182
254
|
__classPrivateFieldSet(this, _GridRestriction_gridHelper, new THREE.GridHelper(gridSize, gridSize / __classPrivateFieldGet(this, _GridRestriction_gridUnit, "f"), 0x666666, 0x222222), "f");
|
|
@@ -184,14 +256,28 @@ class GridRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction
|
|
|
184
256
|
__classPrivateFieldGet(this, _GridRestriction_gridHelper, "f").position.copy(new THREE.Vector3(adjustedOrigin[0], adjustedOrigin[1], adjustedOrigin[2]));
|
|
185
257
|
__classPrivateFieldGet(this, _GridRestriction_gridHelper, "f").visible = false;
|
|
186
258
|
__classPrivateFieldGet(this, _GridRestriction_gridHelper, "f").renderOrder = 100;
|
|
187
|
-
__classPrivateFieldGet(this, _GridRestriction_gridHelper, "f").material.depthTest =
|
|
188
|
-
|
|
259
|
+
__classPrivateFieldGet(this, _GridRestriction_gridHelper, "f").material.depthTest =
|
|
260
|
+
false;
|
|
261
|
+
__classPrivateFieldGet(this, _GridRestriction_gridHelper, "f").material.transparent =
|
|
262
|
+
true;
|
|
189
263
|
// three.js uses a right-handed coordinate system, so we need to rotate the grid helper
|
|
190
264
|
const rotationMatrix = new THREE.Matrix4().fromArray([
|
|
191
|
-
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").vectorU[0],
|
|
192
|
-
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").
|
|
193
|
-
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").
|
|
194
|
-
0,
|
|
265
|
+
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").vectorU[0],
|
|
266
|
+
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").vectorU[1],
|
|
267
|
+
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").vectorU[2],
|
|
268
|
+
0,
|
|
269
|
+
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").vectorV[0],
|
|
270
|
+
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").vectorV[1],
|
|
271
|
+
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").vectorV[2],
|
|
272
|
+
0,
|
|
273
|
+
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").normal[0],
|
|
274
|
+
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").normal[1],
|
|
275
|
+
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").normal[2],
|
|
276
|
+
0,
|
|
277
|
+
0,
|
|
278
|
+
0,
|
|
279
|
+
0,
|
|
280
|
+
1,
|
|
195
281
|
]);
|
|
196
282
|
__classPrivateFieldGet(this, _GridRestriction_gridHelper, "f").rotation.setFromRotationMatrix(rotationMatrix);
|
|
197
283
|
// three.js grid helper is created in the XY plane, so we need to rotate it by 90 degrees around the X axis
|
|
@@ -200,12 +286,21 @@ class GridRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction
|
|
|
200
286
|
}
|
|
201
287
|
createOffsetFromUnit() {
|
|
202
288
|
// Calculate the offset of the rotated point from the rotated origin
|
|
203
|
-
__classPrivateFieldGet(this, _GridRestriction_offsetFromUnit, "f")[0] =
|
|
204
|
-
|
|
205
|
-
|
|
289
|
+
__classPrivateFieldGet(this, _GridRestriction_offsetFromUnit, "f")[0] =
|
|
290
|
+
__classPrivateFieldGet(this, _GridRestriction_gridUnit, "f") *
|
|
291
|
+
Math.round(__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").origin[0] / __classPrivateFieldGet(this, _GridRestriction_gridUnit, "f")) -
|
|
292
|
+
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").origin[0];
|
|
293
|
+
__classPrivateFieldGet(this, _GridRestriction_offsetFromUnit, "f")[1] =
|
|
294
|
+
__classPrivateFieldGet(this, _GridRestriction_gridUnit, "f") *
|
|
295
|
+
Math.round(__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").origin[1] / __classPrivateFieldGet(this, _GridRestriction_gridUnit, "f")) -
|
|
296
|
+
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").origin[1];
|
|
297
|
+
__classPrivateFieldGet(this, _GridRestriction_offsetFromUnit, "f")[2] =
|
|
298
|
+
__classPrivateFieldGet(this, _GridRestriction_gridUnit, "f") *
|
|
299
|
+
Math.round(__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").origin[2] / __classPrivateFieldGet(this, _GridRestriction_gridUnit, "f")) -
|
|
300
|
+
__classPrivateFieldGet(this, _GridRestriction_planeRestriction, "f").origin[2];
|
|
206
301
|
}
|
|
207
302
|
}
|
|
208
303
|
exports.GridRestriction = GridRestriction;
|
|
209
|
-
_GridRestriction_activationKey = new WeakMap(), _GridRestriction_planeRestriction = new WeakMap(), _GridRestriction_active = new WeakMap(), _GridRestriction_gridHelper = new WeakMap(), _GridRestriction_gridSize = new WeakMap(), _GridRestriction_gridUnit = new WeakMap(), _GridRestriction_gridUnitEditable = new WeakMap(), _GridRestriction_offsetFromUnit = new WeakMap(), _GridRestriction_priority = new WeakMap();
|
|
304
|
+
_GridRestriction_activationKey = new WeakMap(), _GridRestriction_eventEngine = new WeakMap(), _GridRestriction_planeRestriction = new WeakMap(), _GridRestriction_active = new WeakMap(), _GridRestriction_gridHelper = new WeakMap(), _GridRestriction_gridSize = new WeakMap(), _GridRestriction_gridUnit = new WeakMap(), _GridRestriction_gridUnitEditable = new WeakMap(), _GridRestriction_offsetFromUnit = new WeakMap(), _GridRestriction_toggleInversion = new WeakMap(), _GridRestriction_priority = new WeakMap();
|
|
210
305
|
// #endregion Classes (1)
|
|
211
306
|
//# sourceMappingURL=GridRestriction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridRestriction.js","sourceRoot":"","sources":["../../../../../src/implementation/restrictions/plane/snap/GridRestriction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"GridRestriction.js","sourceRoot":"","sources":["../../../../../src/implementation/restrictions/plane/snap/GridRestriction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA2E;AAC3E,+EAI4C;AAE5C,yCAA+B;AAC/B,6CAA+B;AAU/B,2EAAsE;AAqBtE,8BAA8B;AAE9B,sBAAsB;AAEtB,MAAa,eACZ,SAAQ,iDAAuB;IAkB/B,4BAA4B;IAE5B,2BAA2B;IAE3B,YACC,QAAsB,EACtB,mBAAwC,EACxC,UAAqB,EACrB,gBAAkC,EAClC,UAAsC;;QAEtC,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QA1BrC,yBAAyB;QAEzB,iDAAgC;QAChC,uCAAqC,oCAAW,CAAC,QAAQ,EAAC;QAC1D,oDAA6C;QAE7C,kCAAmB,KAAK,EAAC;QACzB,8CAA+B;QAC/B,oCAAoB,GAAG,EAAC;QACxB,4CAAkB;QAClB,4CAA6B,IAAI,EAAC;QAClC,0CAAwB,gBAAI,CAAC,MAAM,EAAE,EAAC;QACtC,2CAA4B,KA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AM,CAAC,CAAC,CAAC,GAAG,uBAAA,IAAI,iCAAU,CAAC;gBAC9D,uBAAA,IAAI,yCAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;CAGD;AAtXD,0CAsXC;;AAED,yBAAyB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { IRestriction, RestrictionMetaData, RestrictionPropertiesBase, RestrictionResult } from
|
|
5
|
-
import { ISnapRestriction } from
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { ITreeNode, IViewportApi } from "@shapediver/viewer";
|
|
2
|
+
import { IRay } from "@shapediver/viewer.shared.types";
|
|
3
|
+
import { vec3 } from "gl-matrix";
|
|
4
|
+
import { IRestriction, RestrictionMetaData, RestrictionPropertiesBase, RestrictionResult } from "../../../interfaces/IRestriction";
|
|
5
|
+
import { ISnapRestriction } from "../../../interfaces/ISnapRestriction";
|
|
6
|
+
import { IVisualizationSettings } from "../../../interfaces/IVisualizationSettings";
|
|
7
|
+
import { GeometryMathManager } from "../../GeometryMathManager";
|
|
8
|
+
import { AbstractRestriction } from "../AbstractRestriction";
|
|
9
9
|
export interface PointRestrictionProperties extends RestrictionPropertiesBase {
|
|
10
10
|
/**
|
|
11
11
|
* The location of the restriction.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PointRestriction.d.ts","sourceRoot":"","sources":["../../../../src/implementation/restrictions/point/PointRestriction.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"PointRestriction.d.ts","sourceRoot":"","sources":["../../../../src/implementation/restrictions/point/PointRestriction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAC,IAAI,EAAC,MAAM,iCAAiC,CAAC;AACrD,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAC,sBAAsB,EAAC,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAC,mBAAmB,EAAC,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAI3D,MAAM,WAAW,0BAA2B,SAAQ,yBAAyB;IAC5E;;OAEG;IACH,KAAK,EAAE,IAAI,CAAC;IACZ;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD,qBAAa,gBACZ,SAAQ,mBACR,YAAW,YAAY;;gBAetB,QAAQ,EAAE,YAAY,EACtB,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,SAAS,EACrB,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,sBAAsB,EAChC,UAAU,EAAE,0BAA0B;IAavC,IAAW,KAAK,IAAI,IAAI,CAEvB;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,gBAAgB,IAAI;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAA;KAAC,CAE/D;IAMM,cAAc,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO;IAOpC,QAAQ,CACd,GAAG,EAAE,IAAI,EACT,QAAQ,CAAC,EAAE,mBAAmB,GAC5B,iBAAiB,GAAG,SAAS;IAuDhC,SAAS,CAAC,iBAAiB,IAAI,IAAI;CAGnC"}
|
|
@@ -13,8 +13,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
var _PointRestriction_viewport, _PointRestriction_point, _PointRestriction_radius, _PointRestriction_snapRestrictions;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.PointRestriction = void 0;
|
|
16
|
-
const AbstractRestriction_1 = require("../AbstractRestriction");
|
|
17
16
|
const gl_matrix_1 = require("gl-matrix");
|
|
17
|
+
const AbstractRestriction_1 = require("../AbstractRestriction");
|
|
18
18
|
// #endregion Type aliases (1)
|
|
19
19
|
// #region Classes (1)
|
|
20
20
|
class PointRestriction extends AbstractRestriction_1.AbstractRestriction {
|
|
@@ -45,7 +45,8 @@ class PointRestriction extends AbstractRestriction_1.AbstractRestriction {
|
|
|
45
45
|
// #endregion Public Getters And Setters (4)
|
|
46
46
|
// #region Public Methods (1)
|
|
47
47
|
isWithinRadius(point) {
|
|
48
|
-
return (gl_matrix_1.vec3.squaredDistance(point, __classPrivateFieldGet(this, _PointRestriction_point, "f")) <=
|
|
48
|
+
return (gl_matrix_1.vec3.squaredDistance(point, __classPrivateFieldGet(this, _PointRestriction_point, "f")) <=
|
|
49
|
+
__classPrivateFieldGet(this, _PointRestriction_radius, "f") * __classPrivateFieldGet(this, _PointRestriction_radius, "f"));
|
|
49
50
|
}
|
|
50
51
|
rayTrace(ray, metaData) {
|
|
51
52
|
const closestPointVector = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _PointRestriction_point, "f"), ray.origin);
|
|
@@ -62,10 +63,10 @@ class PointRestriction extends AbstractRestriction_1.AbstractRestriction {
|
|
|
62
63
|
distanceOriginToClosestIntersectionPointSquared: distanceOrigin,
|
|
63
64
|
targetPoint: __classPrivateFieldGet(this, _PointRestriction_point, "f"),
|
|
64
65
|
distanceClosestPointToTargetPointSquared: distance,
|
|
65
|
-
restriction: this
|
|
66
|
+
restriction: this,
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
|
-
// now we calculate the closest point on the
|
|
69
|
+
// now we calculate the closest point on the sphere to the ray
|
|
69
70
|
const offset = Math.sqrt(__classPrivateFieldGet(this, _PointRestriction_radius, "f") * __classPrivateFieldGet(this, _PointRestriction_radius, "f") - distance);
|
|
70
71
|
// Compute the entry distance
|
|
71
72
|
const entry = t - offset;
|