@shapediver/viewer.rendering-engine.intersection-restriction-engine 3.16.8 → 3.16.10
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/dist/api/implementation/AbstractRestrictionApi.d.ts +12 -12
- package/dist/api/implementation/AbstractRestrictionApi.js +46 -46
- package/dist/api/implementation/AbstractRestrictionApi.js.map +1 -1
- package/dist/api/implementation/AbstractSnapRestrictionApi.d.ts +12 -12
- package/dist/api/implementation/AbstractSnapRestrictionApi.js +46 -46
- package/dist/api/implementation/AbstractSnapRestrictionApi.js.map +1 -1
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.d.ts +6 -6
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.js +23 -23
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.js.map +1 -1
- package/dist/api/implementation/geometry/GeometryRestrictionApi.d.ts +14 -14
- package/dist/api/implementation/geometry/GeometryRestrictionApi.js +53 -53
- package/dist/api/implementation/geometry/GeometryRestrictionApi.js.map +1 -1
- package/dist/api/implementation/line/LineRestrictionApi.d.ts +10 -10
- package/dist/api/implementation/line/LineRestrictionApi.js +39 -39
- package/dist/api/implementation/line/LineRestrictionApi.js.map +1 -1
- package/dist/api/implementation/plane/PlaneRestrictionApi.d.ts +19 -19
- package/dist/api/implementation/plane/PlaneRestrictionApi.js +66 -66
- package/dist/api/implementation/plane/PlaneRestrictionApi.js.map +1 -1
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.d.ts +9 -9
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.js +39 -39
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.js.map +1 -1
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.d.ts +6 -6
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.js +23 -23
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.js.map +1 -1
- package/dist/api/implementation/plane/snap/GridRestrictionApi.d.ts +9 -9
- package/dist/api/implementation/plane/snap/GridRestrictionApi.js +39 -39
- package/dist/api/implementation/plane/snap/GridRestrictionApi.js.map +1 -1
- package/dist/api/implementation/point/PointRestrictionApi.d.ts +9 -9
- package/dist/api/implementation/point/PointRestrictionApi.js +36 -36
- package/dist/api/implementation/point/PointRestrictionApi.js.map +1 -1
- package/dist/api/interfaces/IRestrictionApi.d.ts +10 -10
- package/dist/api/interfaces/IRestrictionApi.js +2 -2
- package/dist/api/interfaces/ISnapRestrictionApi.d.ts +12 -12
- package/dist/api/interfaces/ISnapRestrictionApi.js +2 -2
- package/dist/implementation/EventManager.d.ts +25 -25
- package/dist/implementation/EventManager.d.ts.map +1 -1
- package/dist/implementation/EventManager.js +62 -62
- package/dist/implementation/EventManager.js.map +1 -1
- package/dist/implementation/GeometryMathManager.d.ts +87 -87
- package/dist/implementation/GeometryMathManager.js +260 -260
- package/dist/implementation/GeometryMathManager.js.map +1 -1
- package/dist/implementation/RestrictionManager.d.ts +28 -28
- package/dist/implementation/RestrictionManager.js +323 -323
- package/dist/implementation/RestrictionManager.js.map +1 -1
- package/dist/implementation/restrictions/AbstractRestriction.d.ts +42 -42
- package/dist/implementation/restrictions/AbstractRestriction.js +164 -154
- package/dist/implementation/restrictions/AbstractRestriction.js.map +1 -1
- package/dist/implementation/restrictions/AbstractSnapRestriction.d.ts +35 -35
- package/dist/implementation/restrictions/AbstractSnapRestriction.js +150 -140
- package/dist/implementation/restrictions/AbstractSnapRestriction.js.map +1 -1
- package/dist/implementation/restrictions/RestrictionsHelper.d.ts +10 -10
- package/dist/implementation/restrictions/RestrictionsHelper.d.ts.map +1 -1
- package/dist/implementation/restrictions/RestrictionsHelper.js +50 -50
- package/dist/implementation/restrictions/RestrictionsHelper.js.map +1 -1
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.d.ts +17 -17
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js +62 -62
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js.map +1 -1
- package/dist/implementation/restrictions/geometry/GeometryRestriction.d.ts +92 -92
- package/dist/implementation/restrictions/geometry/GeometryRestriction.js +410 -400
- package/dist/implementation/restrictions/geometry/GeometryRestriction.js.map +1 -1
- package/dist/implementation/restrictions/line/LineRestriction.d.ts +58 -58
- package/dist/implementation/restrictions/line/LineRestriction.js +291 -281
- package/dist/implementation/restrictions/line/LineRestriction.js.map +1 -1
- package/dist/implementation/restrictions/plane/PlaneRestriction.d.ts +65 -65
- package/dist/implementation/restrictions/plane/PlaneRestriction.js +306 -306
- package/dist/implementation/restrictions/plane/PlaneRestriction.js.map +1 -1
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts +39 -39
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.js +346 -346
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.js.map +1 -1
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts +27 -27
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.js +239 -229
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.js.map +1 -1
- package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts +39 -39
- package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts.map +1 -1
- package/dist/implementation/restrictions/plane/snap/GridRestriction.js +318 -308
- package/dist/implementation/restrictions/plane/snap/GridRestriction.js.map +1 -1
- package/dist/implementation/restrictions/point/PointRestriction.d.ts +45 -45
- package/dist/implementation/restrictions/point/PointRestriction.js +166 -156
- package/dist/implementation/restrictions/point/PointRestriction.js.map +1 -1
- package/dist/index.d.ts +29 -29
- package/dist/index.js +37 -37
- package/dist/interfaces/IDragAnchor.d.ts +8 -8
- package/dist/interfaces/IDragAnchor.js +2 -2
- package/dist/interfaces/IRestriction.d.ts +117 -117
- package/dist/interfaces/IRestriction.d.ts.map +1 -1
- package/dist/interfaces/IRestriction.js +23 -23
- package/dist/interfaces/IRestriction.js.map +1 -1
- package/dist/interfaces/IRestrictionManager.d.ts +13 -13
- package/dist/interfaces/IRestrictionManager.js +2 -2
- package/dist/interfaces/ISnapRestriction.d.ts +81 -81
- package/dist/interfaces/ISnapRestriction.d.ts.map +1 -1
- package/dist/interfaces/ISnapRestriction.js +3 -3
- package/package.json +10 -10
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
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");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _CameraPlaneRestriction_viewport, _CameraPlaneRestriction_dragPlane, _CameraPlaneRestriction_snapRestrictions;
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.CameraPlaneRestriction = void 0;
|
|
16
|
-
const viewer_shared_math_1 = require("@shapediver/viewer.shared.math");
|
|
17
|
-
const gl_matrix_1 = require("gl-matrix");
|
|
18
|
-
const AbstractRestriction_1 = require("../AbstractRestriction");
|
|
19
|
-
// #endregion Type aliases (1)
|
|
20
|
-
// #region Classes (1)
|
|
21
|
-
class CameraPlaneRestriction extends AbstractRestriction_1.AbstractRestriction {
|
|
22
|
-
// #endregion Properties (3)
|
|
23
|
-
// #region Constructors (1)
|
|
24
|
-
constructor(viewport, geometryMathManager, parentNode, id, settings, properties) {
|
|
25
|
-
super(viewport, parentNode, id, properties);
|
|
26
|
-
// #region Properties (3)
|
|
27
|
-
_CameraPlaneRestriction_viewport.set(this, void 0);
|
|
28
|
-
_CameraPlaneRestriction_dragPlane.set(this, void 0);
|
|
29
|
-
_CameraPlaneRestriction_snapRestrictions.set(this, {});
|
|
30
|
-
__classPrivateFieldSet(this, _CameraPlaneRestriction_viewport, viewport, "f");
|
|
31
|
-
}
|
|
32
|
-
// #endregion Constructors (1)
|
|
33
|
-
// #region Public Getters And Setters (2)
|
|
34
|
-
get snapRestrictions() {
|
|
35
|
-
return __classPrivateFieldGet(this, _CameraPlaneRestriction_snapRestrictions, "f");
|
|
36
|
-
}
|
|
37
|
-
// #endregion Public Getters And Setters (2)
|
|
38
|
-
// #region Public Methods (1)
|
|
39
|
-
rayTrace(ray, metaData) {
|
|
40
|
-
var _a;
|
|
41
|
-
const cameraDirection = gl_matrix_1.vec3.normalize(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _CameraPlaneRestriction_viewport, "f").camera.target, __classPrivateFieldGet(this, _CameraPlaneRestriction_viewport, "f").camera.position));
|
|
42
|
-
__classPrivateFieldSet(this, _CameraPlaneRestriction_dragPlane, new viewer_shared_math_1.Plane().setFromNormalAndCoplanarPoint(cameraDirection, metaData.startPoint || gl_matrix_1.vec3.create()), "f");
|
|
43
|
-
const distance = (_a = __classPrivateFieldGet(this, _CameraPlaneRestriction_dragPlane, "f")) === null || _a === void 0 ? void 0 : _a.intersect(ray.origin, ray.direction);
|
|
44
|
-
if (distance && distance > 0) {
|
|
45
|
-
const point = gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.multiply(gl_matrix_1.vec3.create(), ray.direction, gl_matrix_1.vec3.fromValues(distance, distance, distance)), ray.origin);
|
|
46
|
-
return {
|
|
47
|
-
closestIntersectionPoint: point,
|
|
48
|
-
distanceOriginToClosestIntersectionPointSquared: distance * distance,
|
|
49
|
-
targetPoint: point,
|
|
50
|
-
distanceClosestPointToTargetPointSquared: 0,
|
|
51
|
-
restriction: this,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
// #endregion Public Methods (1)
|
|
57
|
-
// #region Protected Methods (1)
|
|
58
|
-
visibilityChanged() { }
|
|
59
|
-
}
|
|
60
|
-
exports.CameraPlaneRestriction = CameraPlaneRestriction;
|
|
61
|
-
_CameraPlaneRestriction_viewport = new WeakMap(), _CameraPlaneRestriction_dragPlane = new WeakMap(), _CameraPlaneRestriction_snapRestrictions = new WeakMap();
|
|
62
|
-
// #endregion Classes (1)
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
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");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _CameraPlaneRestriction_viewport, _CameraPlaneRestriction_dragPlane, _CameraPlaneRestriction_snapRestrictions;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.CameraPlaneRestriction = void 0;
|
|
16
|
+
const viewer_shared_math_1 = require("@shapediver/viewer.shared.math");
|
|
17
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
18
|
+
const AbstractRestriction_1 = require("../AbstractRestriction");
|
|
19
|
+
// #endregion Type aliases (1)
|
|
20
|
+
// #region Classes (1)
|
|
21
|
+
class CameraPlaneRestriction extends AbstractRestriction_1.AbstractRestriction {
|
|
22
|
+
// #endregion Properties (3)
|
|
23
|
+
// #region Constructors (1)
|
|
24
|
+
constructor(viewport, geometryMathManager, parentNode, id, settings, properties) {
|
|
25
|
+
super(viewport, parentNode, id, properties);
|
|
26
|
+
// #region Properties (3)
|
|
27
|
+
_CameraPlaneRestriction_viewport.set(this, void 0);
|
|
28
|
+
_CameraPlaneRestriction_dragPlane.set(this, void 0);
|
|
29
|
+
_CameraPlaneRestriction_snapRestrictions.set(this, {});
|
|
30
|
+
__classPrivateFieldSet(this, _CameraPlaneRestriction_viewport, viewport, "f");
|
|
31
|
+
}
|
|
32
|
+
// #endregion Constructors (1)
|
|
33
|
+
// #region Public Getters And Setters (2)
|
|
34
|
+
get snapRestrictions() {
|
|
35
|
+
return __classPrivateFieldGet(this, _CameraPlaneRestriction_snapRestrictions, "f");
|
|
36
|
+
}
|
|
37
|
+
// #endregion Public Getters And Setters (2)
|
|
38
|
+
// #region Public Methods (1)
|
|
39
|
+
rayTrace(ray, metaData) {
|
|
40
|
+
var _a;
|
|
41
|
+
const cameraDirection = gl_matrix_1.vec3.normalize(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _CameraPlaneRestriction_viewport, "f").camera.target, __classPrivateFieldGet(this, _CameraPlaneRestriction_viewport, "f").camera.position));
|
|
42
|
+
__classPrivateFieldSet(this, _CameraPlaneRestriction_dragPlane, new viewer_shared_math_1.Plane().setFromNormalAndCoplanarPoint(cameraDirection, metaData.startPoint || gl_matrix_1.vec3.create()), "f");
|
|
43
|
+
const distance = (_a = __classPrivateFieldGet(this, _CameraPlaneRestriction_dragPlane, "f")) === null || _a === void 0 ? void 0 : _a.intersect(ray.origin, ray.direction);
|
|
44
|
+
if (distance && distance > 0) {
|
|
45
|
+
const point = gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.multiply(gl_matrix_1.vec3.create(), ray.direction, gl_matrix_1.vec3.fromValues(distance, distance, distance)), ray.origin);
|
|
46
|
+
return {
|
|
47
|
+
closestIntersectionPoint: point,
|
|
48
|
+
distanceOriginToClosestIntersectionPointSquared: distance * distance,
|
|
49
|
+
targetPoint: point,
|
|
50
|
+
distanceClosestPointToTargetPointSquared: 0,
|
|
51
|
+
restriction: this,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// #endregion Public Methods (1)
|
|
57
|
+
// #region Protected Methods (1)
|
|
58
|
+
visibilityChanged() { }
|
|
59
|
+
}
|
|
60
|
+
exports.CameraPlaneRestriction = CameraPlaneRestriction;
|
|
61
|
+
_CameraPlaneRestriction_viewport = new WeakMap(), _CameraPlaneRestriction_dragPlane = new WeakMap(), _CameraPlaneRestriction_snapRestrictions = new WeakMap();
|
|
62
|
+
// #endregion Classes (1)
|
|
63
63
|
//# sourceMappingURL=CameraPlaneRestriction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CameraPlaneRestriction.js","sourceRoot":"","sources":["../../../../src/implementation/restrictions/camera_plane/CameraPlaneRestriction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,uEAA6D;AAE7D,yCAA+B;AAS/B,gEAA2D;AAQ3D,8BAA8B;AAE9B,sBAAsB;AAEtB,MAAa,sBACZ,SAAQ,yCAAmB;IAU3B,4BAA4B;IAE5B,2BAA2B;IAE3B,YACC,QAAsB,EACtB,mBAAwC,EACxC,UAAqB,EACrB,EAAU,EACV,QAAgC,EAChC,UAA4C;QAE5C,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;QAnB7C,yBAAyB;
|
|
1
|
+
{"version":3,"file":"CameraPlaneRestriction.js","sourceRoot":"","sources":["../../../../src/implementation/restrictions/camera_plane/CameraPlaneRestriction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,uEAA6D;AAE7D,yCAA+B;AAS/B,gEAA2D;AAQ3D,8BAA8B;AAE9B,sBAAsB;AAEtB,MAAa,sBACZ,SAAQ,yCAAmB;IAU3B,4BAA4B;IAE5B,2BAA2B;IAE3B,YACC,QAAsB,EACtB,mBAAwC,EACxC,UAAqB,EACrB,EAAU,EACV,QAAgC,EAChC,UAA4C;QAE5C,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;QAnB7C,yBAAyB;QAEhB,mDAAwB;QAEjC,oDAAoB;QACpB,mDAAuD,EAAE,EAAC;QAgBzD,uBAAA,IAAI,oCAAa,QAAQ,MAAA,CAAC;IAC3B,CAAC;IAED,8BAA8B;IAE9B,yCAAyC;IAEzC,IAAW,gBAAgB;QAC1B,OAAO,uBAAA,IAAI,gDAAkB,CAAC;IAC/B,CAAC;IAED,4CAA4C;IAE5C,6BAA6B;IAEtB,QAAQ,CACd,GAAS,EACT,QAA6B;;QAE7B,MAAM,eAAe,GAAG,gBAAI,CAAC,SAAS,CACrC,gBAAI,CAAC,MAAM,EAAE,EACb,gBAAI,CAAC,GAAG,CACP,gBAAI,CAAC,MAAM,EAAE,EACb,uBAAA,IAAI,wCAAU,CAAC,MAAO,CAAC,MAAM,EAC7B,uBAAA,IAAI,wCAAU,CAAC,MAAO,CAAC,QAAQ,CAC/B,CACD,CAAC;QACF,uBAAA,IAAI,qCAAc,IAAI,0BAAK,EAAE,CAAC,6BAA6B,CAC1D,eAAe,EACf,QAAQ,CAAC,UAAU,IAAI,gBAAI,CAAC,MAAM,EAAE,CACpC,MAAA,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAA,uBAAA,IAAI,yCAAW,0CAAE,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;QACvE,IAAI,QAAQ,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,gBAAI,CAAC,GAAG,CACrB,gBAAI,CAAC,MAAM,EAAE,EACb,gBAAI,CAAC,QAAQ,CACZ,gBAAI,CAAC,MAAM,EAAE,EACb,GAAG,CAAC,SAAS,EACb,gBAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAC7C,EACD,GAAG,CAAC,MAAM,CACV,CAAC;YACF,OAAO;gBACN,wBAAwB,EAAE,KAAK;gBAC/B,+CAA+C,EAC9C,QAAQ,GAAG,QAAQ;gBACpB,WAAW,EAAE,KAAK;gBAClB,wCAAwC,EAAE,CAAC;gBAC3C,WAAW,EAAE,IAAI;aACjB,CAAC;QACH,CAAC;QACD,OAAO;IACR,CAAC;IAED,gCAAgC;IAEhC,gCAAgC;IAEtB,iBAAiB,KAAU,CAAC;CAGtC;AAvFD,wDAuFC;;AAED,yBAAyB"}
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import { IViewportApi } from "@shapediver/viewer";
|
|
2
|
-
import { ITreeNode } from "@shapediver/viewer.shared.node-tree";
|
|
3
|
-
import { IGeometryData, IRay, IVisualizationSettings } from "@shapediver/viewer.shared.types";
|
|
4
|
-
import { IRestriction, RestrictionMetaData, RestrictionPropertiesBase, RestrictionResult } from "../../../interfaces/IRestriction";
|
|
5
|
-
import { ISnapRestriction } from "../../../interfaces/ISnapRestriction";
|
|
6
|
-
import { GeometryMathManager } from "../../GeometryMathManager";
|
|
7
|
-
import { AbstractRestriction } from "../AbstractRestriction";
|
|
8
|
-
export interface GeometryRestrictionProperties extends RestrictionPropertiesBase {
|
|
9
|
-
/**
|
|
10
|
-
* The nodes to restrict the interaction to.
|
|
11
|
-
*/
|
|
12
|
-
nodes: ITreeNode[];
|
|
13
|
-
/**
|
|
14
|
-
* If the geometry should be displayed as wireframe.
|
|
15
|
-
*/
|
|
16
|
-
wireframe?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* The color of the wireframe.
|
|
19
|
-
*/
|
|
20
|
-
wireframeColor?: string;
|
|
21
|
-
/**
|
|
22
|
-
* If the wireframe should be rendered with depth test. (default: false)
|
|
23
|
-
*/
|
|
24
|
-
wireframeDepthTest?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* The point size of the wireframe if the geometry contains points. (default: as defined in the viewport settings)
|
|
27
|
-
*/
|
|
28
|
-
wireframePointSize?: number;
|
|
29
|
-
/**
|
|
30
|
-
* If the restriction should snap to vertices. (default: true)
|
|
31
|
-
*/
|
|
32
|
-
snapToVertices?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* The radius in which the restriction should snap to vertices. (default: 2.5% of the scene bounding sphere radius in screen space)
|
|
35
|
-
*/
|
|
36
|
-
snapToVerticesRadius?: number;
|
|
37
|
-
/**
|
|
38
|
-
* If the restriction should snap to edges. (default: true)
|
|
39
|
-
*/
|
|
40
|
-
snapToEdges?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* The radius in which the restriction should snap to edges. (default: 2.5% of the scene bounding sphere radius in screen space)
|
|
43
|
-
*/
|
|
44
|
-
snapToEdgesRadius?: number;
|
|
45
|
-
/**
|
|
46
|
-
* If the restriction should snap to faces. (default: true)
|
|
47
|
-
*/
|
|
48
|
-
snapToFaces?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* The radius in which the restriction should snap. (default: undefined)
|
|
51
|
-
* Overrides the snapToVerticesRadius and snapToEdgesRadius if defined.
|
|
52
|
-
*/
|
|
53
|
-
radius?: number;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* The data of the intersection of the geometry restriction.
|
|
57
|
-
* This data is forwarded for internal use.
|
|
58
|
-
*/
|
|
59
|
-
export interface GeometryRestrictionIntersectionData {
|
|
60
|
-
node: ITreeNode;
|
|
61
|
-
geometryData: IGeometryData;
|
|
62
|
-
}
|
|
63
|
-
export declare class GeometryRestriction extends AbstractRestriction implements IRestriction {
|
|
64
|
-
#private;
|
|
65
|
-
constructor(viewport: IViewportApi, geometryMathManager: GeometryMathManager, parentNode: ITreeNode, id: string, settings: IVisualizationSettings, properties: GeometryRestrictionProperties);
|
|
66
|
-
get nodes(): ITreeNode[];
|
|
67
|
-
get snapRestrictions(): {
|
|
68
|
-
[key: string]: ISnapRestriction;
|
|
69
|
-
};
|
|
70
|
-
get snapToEdges(): boolean;
|
|
71
|
-
set snapToEdges(value: boolean);
|
|
72
|
-
get snapToFaces(): boolean;
|
|
73
|
-
set snapToFaces(value: boolean);
|
|
74
|
-
get snapToVertices(): boolean;
|
|
75
|
-
set snapToVertices(value: boolean);
|
|
76
|
-
rayTrace(ray: IRay, metaData?: RestrictionMetaData): RestrictionResult | undefined;
|
|
77
|
-
updateNodes(nodes: ITreeNode[]): void;
|
|
78
|
-
protected visibilityChanged(): void;
|
|
79
|
-
private updateIntersectionThresholds;
|
|
80
|
-
private constructRestrictionResult;
|
|
81
|
-
/**
|
|
82
|
-
* We check the distance between two points.
|
|
83
|
-
* If a radius is given, we check if the distance is smaller than the radius.
|
|
84
|
-
* If no radius is given, we move to the screen space distance check.
|
|
85
|
-
*
|
|
86
|
-
* @param point1
|
|
87
|
-
* @param point2
|
|
88
|
-
* @param radius
|
|
89
|
-
* @returns
|
|
90
|
-
*/
|
|
91
|
-
private checkDistance;
|
|
92
|
-
}
|
|
1
|
+
import { IViewportApi } from "@shapediver/viewer";
|
|
2
|
+
import { ITreeNode } from "@shapediver/viewer.shared.node-tree";
|
|
3
|
+
import { IGeometryData, IRay, IVisualizationSettings } from "@shapediver/viewer.shared.types";
|
|
4
|
+
import { IRestriction, RestrictionMetaData, RestrictionPropertiesBase, RestrictionResult } from "../../../interfaces/IRestriction";
|
|
5
|
+
import { ISnapRestriction } from "../../../interfaces/ISnapRestriction";
|
|
6
|
+
import { GeometryMathManager } from "../../GeometryMathManager";
|
|
7
|
+
import { AbstractRestriction } from "../AbstractRestriction";
|
|
8
|
+
export interface GeometryRestrictionProperties extends RestrictionPropertiesBase {
|
|
9
|
+
/**
|
|
10
|
+
* The nodes to restrict the interaction to.
|
|
11
|
+
*/
|
|
12
|
+
nodes: ITreeNode[];
|
|
13
|
+
/**
|
|
14
|
+
* If the geometry should be displayed as wireframe.
|
|
15
|
+
*/
|
|
16
|
+
wireframe?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The color of the wireframe.
|
|
19
|
+
*/
|
|
20
|
+
wireframeColor?: string;
|
|
21
|
+
/**
|
|
22
|
+
* If the wireframe should be rendered with depth test. (default: false)
|
|
23
|
+
*/
|
|
24
|
+
wireframeDepthTest?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The point size of the wireframe if the geometry contains points. (default: as defined in the viewport settings)
|
|
27
|
+
*/
|
|
28
|
+
wireframePointSize?: number;
|
|
29
|
+
/**
|
|
30
|
+
* If the restriction should snap to vertices. (default: true)
|
|
31
|
+
*/
|
|
32
|
+
snapToVertices?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The radius in which the restriction should snap to vertices. (default: 2.5% of the scene bounding sphere radius in screen space)
|
|
35
|
+
*/
|
|
36
|
+
snapToVerticesRadius?: number;
|
|
37
|
+
/**
|
|
38
|
+
* If the restriction should snap to edges. (default: true)
|
|
39
|
+
*/
|
|
40
|
+
snapToEdges?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The radius in which the restriction should snap to edges. (default: 2.5% of the scene bounding sphere radius in screen space)
|
|
43
|
+
*/
|
|
44
|
+
snapToEdgesRadius?: number;
|
|
45
|
+
/**
|
|
46
|
+
* If the restriction should snap to faces. (default: true)
|
|
47
|
+
*/
|
|
48
|
+
snapToFaces?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The radius in which the restriction should snap. (default: undefined)
|
|
51
|
+
* Overrides the snapToVerticesRadius and snapToEdgesRadius if defined.
|
|
52
|
+
*/
|
|
53
|
+
radius?: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The data of the intersection of the geometry restriction.
|
|
57
|
+
* This data is forwarded for internal use.
|
|
58
|
+
*/
|
|
59
|
+
export interface GeometryRestrictionIntersectionData {
|
|
60
|
+
node: ITreeNode;
|
|
61
|
+
geometryData: IGeometryData;
|
|
62
|
+
}
|
|
63
|
+
export declare class GeometryRestriction extends AbstractRestriction implements IRestriction {
|
|
64
|
+
#private;
|
|
65
|
+
constructor(viewport: IViewportApi, geometryMathManager: GeometryMathManager, parentNode: ITreeNode, id: string, settings: IVisualizationSettings, properties: GeometryRestrictionProperties);
|
|
66
|
+
get nodes(): ITreeNode[];
|
|
67
|
+
get snapRestrictions(): {
|
|
68
|
+
[key: string]: ISnapRestriction;
|
|
69
|
+
};
|
|
70
|
+
get snapToEdges(): boolean;
|
|
71
|
+
set snapToEdges(value: boolean);
|
|
72
|
+
get snapToFaces(): boolean;
|
|
73
|
+
set snapToFaces(value: boolean);
|
|
74
|
+
get snapToVertices(): boolean;
|
|
75
|
+
set snapToVertices(value: boolean);
|
|
76
|
+
rayTrace(ray: IRay, metaData?: RestrictionMetaData): RestrictionResult | undefined;
|
|
77
|
+
updateNodes(nodes: ITreeNode[]): void;
|
|
78
|
+
protected visibilityChanged(): void;
|
|
79
|
+
private updateIntersectionThresholds;
|
|
80
|
+
private constructRestrictionResult;
|
|
81
|
+
/**
|
|
82
|
+
* We check the distance between two points.
|
|
83
|
+
* If a radius is given, we check if the distance is smaller than the radius.
|
|
84
|
+
* If no radius is given, we move to the screen space distance check.
|
|
85
|
+
*
|
|
86
|
+
* @param point1
|
|
87
|
+
* @param point2
|
|
88
|
+
* @param radius
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
private checkDistance;
|
|
92
|
+
}
|
|
93
93
|
//# sourceMappingURL=GeometryRestriction.d.ts.map
|