@shapediver/viewer.rendering-engine.intersection-restriction-engine 3.5.0
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/LICENSE +73 -0
- package/README.md +3 -0
- package/dist/api/implementation/AbstractRestrictionApi.d.ts +10 -0
- package/dist/api/implementation/AbstractRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/AbstractRestrictionApi.js +38 -0
- package/dist/api/implementation/AbstractRestrictionApi.js.map +1 -0
- package/dist/api/implementation/AbstractSnapRestrictionApi.d.ts +13 -0
- package/dist/api/implementation/AbstractSnapRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/AbstractSnapRestrictionApi.js +47 -0
- package/dist/api/implementation/AbstractSnapRestrictionApi.js.map +1 -0
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.d.ts +7 -0
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.js +24 -0
- package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.js.map +1 -0
- package/dist/api/implementation/geometry/GeometryRestrictionApi.d.ts +15 -0
- package/dist/api/implementation/geometry/GeometryRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/geometry/GeometryRestrictionApi.js +54 -0
- package/dist/api/implementation/geometry/GeometryRestrictionApi.js.map +1 -0
- package/dist/api/implementation/line/LineRestrictionApi.d.ts +11 -0
- package/dist/api/implementation/line/LineRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/line/LineRestrictionApi.js +40 -0
- package/dist/api/implementation/line/LineRestrictionApi.js.map +1 -0
- package/dist/api/implementation/plane/PlaneRestrictionApi.d.ts +20 -0
- package/dist/api/implementation/plane/PlaneRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/plane/PlaneRestrictionApi.js +67 -0
- package/dist/api/implementation/plane/PlaneRestrictionApi.js.map +1 -0
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.d.ts +10 -0
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.js +40 -0
- package/dist/api/implementation/plane/snap/AngularRestrictionApi.js.map +1 -0
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.d.ts +7 -0
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.js +24 -0
- package/dist/api/implementation/plane/snap/AxisRestrictionApi.js.map +1 -0
- package/dist/api/implementation/plane/snap/GridRestrictionApi.d.ts +10 -0
- package/dist/api/implementation/plane/snap/GridRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/plane/snap/GridRestrictionApi.js +40 -0
- package/dist/api/implementation/plane/snap/GridRestrictionApi.js.map +1 -0
- package/dist/api/implementation/point/PointRestrictionApi.d.ts +10 -0
- package/dist/api/implementation/point/PointRestrictionApi.d.ts.map +1 -0
- package/dist/api/implementation/point/PointRestrictionApi.js +37 -0
- package/dist/api/implementation/point/PointRestrictionApi.js.map +1 -0
- package/dist/api/interfaces/IRestrictionApi.d.ts +11 -0
- package/dist/api/interfaces/IRestrictionApi.d.ts.map +1 -0
- package/dist/api/interfaces/IRestrictionApi.js +3 -0
- package/dist/api/interfaces/IRestrictionApi.js.map +1 -0
- package/dist/api/interfaces/ISnapRestrictionApi.d.ts +13 -0
- package/dist/api/interfaces/ISnapRestrictionApi.d.ts.map +1 -0
- package/dist/api/interfaces/ISnapRestrictionApi.js +3 -0
- package/dist/api/interfaces/ISnapRestrictionApi.js.map +1 -0
- package/dist/implementation/EventManager.d.ts +26 -0
- package/dist/implementation/EventManager.d.ts.map +1 -0
- package/dist/implementation/EventManager.js +63 -0
- package/dist/implementation/EventManager.js.map +1 -0
- package/dist/implementation/GeometryMathManager.d.ts +82 -0
- package/dist/implementation/GeometryMathManager.d.ts.map +1 -0
- package/dist/implementation/GeometryMathManager.js +240 -0
- package/dist/implementation/GeometryMathManager.js.map +1 -0
- package/dist/implementation/RestrictionManager.d.ts +29 -0
- package/dist/implementation/RestrictionManager.d.ts.map +1 -0
- package/dist/implementation/RestrictionManager.js +220 -0
- package/dist/implementation/RestrictionManager.js.map +1 -0
- package/dist/implementation/restrictions/AbstractRestriction.d.ts +42 -0
- package/dist/implementation/restrictions/AbstractRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/AbstractRestriction.js +130 -0
- package/dist/implementation/restrictions/AbstractRestriction.js.map +1 -0
- package/dist/implementation/restrictions/AbstractSnapRestriction.d.ts +32 -0
- package/dist/implementation/restrictions/AbstractSnapRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/AbstractSnapRestriction.js +125 -0
- package/dist/implementation/restrictions/AbstractSnapRestriction.js.map +1 -0
- package/dist/implementation/restrictions/RestrictionsHelper.d.ts +11 -0
- package/dist/implementation/restrictions/RestrictionsHelper.d.ts.map +1 -0
- package/dist/implementation/restrictions/RestrictionsHelper.js +47 -0
- package/dist/implementation/restrictions/RestrictionsHelper.js.map +1 -0
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.d.ts +19 -0
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js +64 -0
- package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js.map +1 -0
- package/dist/implementation/restrictions/geometry/GeometryRestriction.d.ts +41 -0
- package/dist/implementation/restrictions/geometry/GeometryRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/geometry/GeometryRestriction.js +259 -0
- package/dist/implementation/restrictions/geometry/GeometryRestriction.js.map +1 -0
- package/dist/implementation/restrictions/line/LineRestriction.d.ts +28 -0
- package/dist/implementation/restrictions/line/LineRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/line/LineRestriction.js +104 -0
- package/dist/implementation/restrictions/line/LineRestriction.js.map +1 -0
- package/dist/implementation/restrictions/plane/PlaneRestriction.d.ts +68 -0
- package/dist/implementation/restrictions/plane/PlaneRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/plane/PlaneRestriction.js +259 -0
- package/dist/implementation/restrictions/plane/PlaneRestriction.js.map +1 -0
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts +41 -0
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.js +321 -0
- package/dist/implementation/restrictions/plane/snap/AngularRestriction.js.map +1 -0
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts +28 -0
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.js +172 -0
- package/dist/implementation/restrictions/plane/snap/AxisRestriction.js.map +1 -0
- package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts +40 -0
- package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/plane/snap/GridRestriction.js +211 -0
- package/dist/implementation/restrictions/plane/snap/GridRestriction.js.map +1 -0
- package/dist/implementation/restrictions/point/PointRestriction.d.ts +25 -0
- package/dist/implementation/restrictions/point/PointRestriction.d.ts.map +1 -0
- package/dist/implementation/restrictions/point/PointRestriction.js +78 -0
- package/dist/implementation/restrictions/point/PointRestriction.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/IDragAnchor.d.ts +9 -0
- package/dist/interfaces/IDragAnchor.d.ts.map +1 -0
- package/dist/interfaces/IDragAnchor.js +3 -0
- package/dist/interfaces/IDragAnchor.js.map +1 -0
- package/dist/interfaces/IRestriction.d.ts +89 -0
- package/dist/interfaces/IRestriction.d.ts.map +1 -0
- package/dist/interfaces/IRestriction.js +25 -0
- package/dist/interfaces/IRestriction.js.map +1 -0
- package/dist/interfaces/IRestrictionManager.d.ts +14 -0
- package/dist/interfaces/IRestrictionManager.d.ts.map +1 -0
- package/dist/interfaces/IRestrictionManager.js +3 -0
- package/dist/interfaces/IRestrictionManager.js.map +1 -0
- package/dist/interfaces/ISnapRestriction.d.ts +67 -0
- package/dist/interfaces/ISnapRestriction.d.ts.map +1 -0
- package/dist/interfaces/ISnapRestriction.js +4 -0
- package/dist/interfaces/ISnapRestriction.js.map +1 -0
- package/dist/interfaces/IVisualizationSettings.d.ts +33 -0
- package/dist/interfaces/IVisualizationSettings.d.ts.map +1 -0
- package/dist/interfaces/IVisualizationSettings.js +3 -0
- package/dist/interfaces/IVisualizationSettings.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,40 @@
|
|
|
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 _GridRestrictionApi_gridRestriction;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.GridRestrictionApi = void 0;
|
|
16
|
+
const AbstractSnapRestrictionApi_1 = require("../../AbstractSnapRestrictionApi");
|
|
17
|
+
class GridRestrictionApi extends AbstractSnapRestrictionApi_1.AbstractSnapRestrictionApi {
|
|
18
|
+
// #endregion Properties (1)
|
|
19
|
+
// #region Constructors (1)
|
|
20
|
+
constructor(restriction) {
|
|
21
|
+
super(restriction);
|
|
22
|
+
// #region Properties (1)
|
|
23
|
+
_GridRestrictionApi_gridRestriction.set(this, void 0);
|
|
24
|
+
__classPrivateFieldSet(this, _GridRestrictionApi_gridRestriction, restriction, "f");
|
|
25
|
+
}
|
|
26
|
+
// #endregion Constructors (1)
|
|
27
|
+
// #region Public Getters And Setters (3)
|
|
28
|
+
get gridUnit() {
|
|
29
|
+
return __classPrivateFieldGet(this, _GridRestrictionApi_gridRestriction, "f").gridUnit;
|
|
30
|
+
}
|
|
31
|
+
set gridUnit(value) {
|
|
32
|
+
__classPrivateFieldGet(this, _GridRestrictionApi_gridRestriction, "f").gridUnit = value;
|
|
33
|
+
}
|
|
34
|
+
get gridUnitEditable() {
|
|
35
|
+
return __classPrivateFieldGet(this, _GridRestrictionApi_gridRestriction, "f").gridUnitEditable;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.GridRestrictionApi = GridRestrictionApi;
|
|
39
|
+
_GridRestrictionApi_gridRestriction = new WeakMap();
|
|
40
|
+
//# sourceMappingURL=GridRestrictionApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GridRestrictionApi.js","sourceRoot":"","sources":["../../../../../src/api/implementation/plane/snap/GridRestrictionApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iFAA8E;AAG9E,MAAa,kBAAmB,SAAQ,uDAA0B;IAK9D,4BAA4B;IAE5B,2BAA2B;IAE3B,YAAY,WAA4B;QACpC,KAAK,CAAC,WAAW,CAAC,CAAC;QATvB,yBAAyB;QAEzB,sDAA2C;QAQvC,uBAAA,IAAI,uCAAoB,WAAW,MAAA,CAAC;IACxC,CAAC;IAED,8BAA8B;IAE9B,yCAAyC;IAEzC,IAAW,QAAQ;QACf,OAAO,uBAAA,IAAI,2CAAiB,CAAC,QAAQ,CAAC;IAC1C,CAAC;IAED,IAAW,QAAQ,CAAC,KAAa;QAC7B,uBAAA,IAAI,2CAAiB,CAAC,QAAQ,GAAG,KAAK,CAAC;IAC3C,CAAC;IAED,IAAW,gBAAgB;QACvB,OAAO,uBAAA,IAAI,2CAAiB,CAAC,gBAAgB,CAAC;IAClD,CAAC;CAGJ;AA/BD,gDA+BC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractRestrictionApi } from '../AbstractRestrictionApi';
|
|
2
|
+
import { PointRestriction } from '../../../implementation/restrictions/point/PointRestriction';
|
|
3
|
+
import { vec3 } from 'gl-matrix';
|
|
4
|
+
export declare class PointRestrictionApi extends AbstractRestrictionApi {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(restriction: PointRestriction);
|
|
7
|
+
get point(): vec3;
|
|
8
|
+
get radius(): number;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=PointRestrictionApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointRestrictionApi.d.ts","sourceRoot":"","sources":["../../../../src/api/implementation/point/PointRestrictionApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAC/F,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,qBAAa,mBAAoB,SAAQ,sBAAsB;;gBAS/C,WAAW,EAAE,gBAAgB;IASzC,IAAW,KAAK,IAAI,IAAI,CAEvB;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;CAGJ"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 _PointRestrictionApi_pointRestriction;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PointRestrictionApi = void 0;
|
|
16
|
+
const AbstractRestrictionApi_1 = require("../AbstractRestrictionApi");
|
|
17
|
+
class PointRestrictionApi extends AbstractRestrictionApi_1.AbstractRestrictionApi {
|
|
18
|
+
// #endregion Properties (1)
|
|
19
|
+
// #region Constructors (1)
|
|
20
|
+
constructor(restriction) {
|
|
21
|
+
super(restriction);
|
|
22
|
+
// #region Properties (1)
|
|
23
|
+
_PointRestrictionApi_pointRestriction.set(this, void 0);
|
|
24
|
+
__classPrivateFieldSet(this, _PointRestrictionApi_pointRestriction, restriction, "f");
|
|
25
|
+
}
|
|
26
|
+
// #endregion Constructors (1)
|
|
27
|
+
// #region Public Getters And Setters (2)
|
|
28
|
+
get point() {
|
|
29
|
+
return __classPrivateFieldGet(this, _PointRestrictionApi_pointRestriction, "f").point;
|
|
30
|
+
}
|
|
31
|
+
get radius() {
|
|
32
|
+
return __classPrivateFieldGet(this, _PointRestrictionApi_pointRestriction, "f").radius;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.PointRestrictionApi = PointRestrictionApi;
|
|
36
|
+
_PointRestrictionApi_pointRestriction = new WeakMap();
|
|
37
|
+
//# sourceMappingURL=PointRestrictionApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointRestrictionApi.js","sourceRoot":"","sources":["../../../../src/api/implementation/point/PointRestrictionApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sEAAmE;AAInE,MAAa,mBAAoB,SAAQ,+CAAsB;IAK3D,4BAA4B;IAE5B,2BAA2B;IAE3B,YAAY,WAA6B;QACrC,KAAK,CAAC,WAAW,CAAC,CAAC;QATvB,yBAAyB;QAEzB,wDAA6C;QAQzC,uBAAA,IAAI,yCAAqB,WAAW,MAAA,CAAC;IACzC,CAAC;IAED,8BAA8B;IAE9B,yCAAyC;IAEzC,IAAW,KAAK;QACZ,OAAO,uBAAA,IAAI,6CAAkB,CAAC,KAAK,CAAC;IACxC,CAAC;IAED,IAAW,MAAM;QACb,OAAO,uBAAA,IAAI,6CAAkB,CAAC,MAAM,CAAC;IACzC,CAAC;CAGJ;AA3BD,kDA2BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IRestrictionApi.d.ts","sourceRoot":"","sources":["../../../src/api/interfaces/IRestrictionApi.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAG5B;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAGpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IRestrictionApi.js","sourceRoot":"","sources":["../../../src/api/interfaces/IRestrictionApi.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IRestrictionApi } from './IRestrictionApi';
|
|
2
|
+
export interface ISnapRestrictionApi extends IRestrictionApi {
|
|
3
|
+
/**
|
|
4
|
+
* If the enabling or disabling of the restriction is allowed to the end user.
|
|
5
|
+
* If it is not editable, the default value for enabling or disabling the restriction is used.
|
|
6
|
+
*/
|
|
7
|
+
readonly enabledEditable: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The priority of the restriction.
|
|
10
|
+
*/
|
|
11
|
+
priority: number;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ISnapRestrictionApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISnapRestrictionApi.d.ts","sourceRoot":"","sources":["../../../src/api/interfaces/ISnapRestrictionApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAGxD;;;OAGG;IACH,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAElC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAGpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ISnapRestrictionApi.js","sourceRoot":"","sources":["../../../src/api/interfaces/ISnapRestrictionApi.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IDomEventListener } from '@shapediver/viewer.shared.services';
|
|
2
|
+
import { IRay } from '@shapediver/viewer.rendering-engine.intersection-engine';
|
|
3
|
+
import { IViewportApi } from '@shapediver/viewer';
|
|
4
|
+
declare type Callbacks = {
|
|
5
|
+
onDown: (event: PointerEvent, ray: IRay) => void;
|
|
6
|
+
onMove: (event: PointerEvent, ray: IRay) => void;
|
|
7
|
+
onUp: (event: PointerEvent, ray: IRay) => void;
|
|
8
|
+
onOut: (event: PointerEvent, ray: IRay) => void;
|
|
9
|
+
onKeyDown: (event: KeyboardEvent) => void;
|
|
10
|
+
onKeyUp: (event: KeyboardEvent) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare class EventManager implements IDomEventListener {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(viewport: IViewportApi, callbacks: Callbacks);
|
|
15
|
+
close(): void;
|
|
16
|
+
onKeyDown(event: KeyboardEvent): void;
|
|
17
|
+
onKeyUp(event: KeyboardEvent): void;
|
|
18
|
+
onMouseWheel(): void;
|
|
19
|
+
onPointerDown(event: PointerEvent): void;
|
|
20
|
+
onPointerEnd(): void;
|
|
21
|
+
onPointerMove(event: PointerEvent): void;
|
|
22
|
+
onPointerOut(event: PointerEvent): void;
|
|
23
|
+
onPointerUp(event: PointerEvent): void;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=EventManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventManager.d.ts","sourceRoot":"","sources":["../../src/implementation/EventManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,yDAAyD,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIlD,aAAK,SAAS,GAAG;IACb,MAAM,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACjD,MAAM,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACjD,IAAI,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IAC/C,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IAChD,SAAS,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;CAC1C,CAAA;AAMD,qBAAa,YAAa,YAAW,iBAAiB;;gBAWtC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS;IAUjD,KAAK,IAAI,IAAI;IAIb,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAIrC,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAInC,YAAY,IAAI,IAAI;IAEpB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAKxC,YAAY,IAAI,IAAI;IAEpB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAKxC,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAKvC,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;CAMhD"}
|
|
@@ -0,0 +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 _EventManager_callbacks, _EventManager_canvasEventListenerToken, _EventManager_viewport;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.EventManager = void 0;
|
|
16
|
+
// #endregion Type aliases (1)
|
|
17
|
+
// #region Classes (1)
|
|
18
|
+
class EventManager {
|
|
19
|
+
// #endregion Properties (3)
|
|
20
|
+
// #region Constructors (1)
|
|
21
|
+
constructor(viewport, callbacks) {
|
|
22
|
+
// #region Properties (3)
|
|
23
|
+
_EventManager_callbacks.set(this, void 0);
|
|
24
|
+
_EventManager_canvasEventListenerToken.set(this, void 0);
|
|
25
|
+
_EventManager_viewport.set(this, void 0);
|
|
26
|
+
__classPrivateFieldSet(this, _EventManager_viewport, viewport, "f");
|
|
27
|
+
__classPrivateFieldSet(this, _EventManager_callbacks, callbacks, "f");
|
|
28
|
+
__classPrivateFieldSet(this, _EventManager_canvasEventListenerToken, __classPrivateFieldGet(this, _EventManager_viewport, "f").addCanvasEventListener(this), "f");
|
|
29
|
+
}
|
|
30
|
+
// #endregion Constructors (1)
|
|
31
|
+
// #region Public Methods (9)
|
|
32
|
+
close() {
|
|
33
|
+
__classPrivateFieldGet(this, _EventManager_viewport, "f").removeCanvasEventListener(__classPrivateFieldGet(this, _EventManager_canvasEventListenerToken, "f"));
|
|
34
|
+
}
|
|
35
|
+
onKeyDown(event) {
|
|
36
|
+
__classPrivateFieldGet(this, _EventManager_callbacks, "f").onKeyDown(event);
|
|
37
|
+
}
|
|
38
|
+
onKeyUp(event) {
|
|
39
|
+
__classPrivateFieldGet(this, _EventManager_callbacks, "f").onKeyUp(event);
|
|
40
|
+
}
|
|
41
|
+
onMouseWheel() { }
|
|
42
|
+
onPointerDown(event) {
|
|
43
|
+
const ray = __classPrivateFieldGet(this, _EventManager_viewport, "f").pointerEventToRay(event);
|
|
44
|
+
__classPrivateFieldGet(this, _EventManager_callbacks, "f").onDown(event, ray);
|
|
45
|
+
}
|
|
46
|
+
onPointerEnd() { }
|
|
47
|
+
onPointerMove(event) {
|
|
48
|
+
const ray = __classPrivateFieldGet(this, _EventManager_viewport, "f").pointerEventToRay(event);
|
|
49
|
+
__classPrivateFieldGet(this, _EventManager_callbacks, "f").onMove(event, ray);
|
|
50
|
+
}
|
|
51
|
+
onPointerOut(event) {
|
|
52
|
+
const ray = __classPrivateFieldGet(this, _EventManager_viewport, "f").pointerEventToRay(event);
|
|
53
|
+
__classPrivateFieldGet(this, _EventManager_callbacks, "f").onOut(event, ray);
|
|
54
|
+
}
|
|
55
|
+
onPointerUp(event) {
|
|
56
|
+
const ray = __classPrivateFieldGet(this, _EventManager_viewport, "f").pointerEventToRay(event);
|
|
57
|
+
__classPrivateFieldGet(this, _EventManager_callbacks, "f").onUp(event, ray);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.EventManager = EventManager;
|
|
61
|
+
_EventManager_callbacks = new WeakMap(), _EventManager_canvasEventListenerToken = new WeakMap(), _EventManager_viewport = new WeakMap();
|
|
62
|
+
// #endregion Classes (1)
|
|
63
|
+
//# sourceMappingURL=EventManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventManager.js","sourceRoot":"","sources":["../../src/implementation/EventManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAeA,8BAA8B;AAE9B,sBAAsB;AAEtB,MAAa,YAAY;IAOrB,4BAA4B;IAE5B,2BAA2B;IAE3B,YAAY,QAAsB,EAAE,SAAoB;QAVxD,yBAAyB;QAEzB,0CAA+B;QAC/B,yDAA2C;QAC3C,yCAAiC;QAO7B,uBAAA,IAAI,0BAAa,QAAQ,MAAA,CAAC;QAC1B,uBAAA,IAAI,2BAAc,SAAS,MAAA,CAAC;QAC5B,uBAAA,IAAI,0CAA6B,uBAAA,IAAI,8BAAU,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAA,CAAC;IACjF,CAAC;IAED,8BAA8B;IAE9B,6BAA6B;IAEtB,KAAK;QACR,uBAAA,IAAI,8BAAU,CAAC,yBAAyB,CAAC,uBAAA,IAAI,8CAA0B,CAAC,CAAC;IAC7E,CAAC;IAEM,SAAS,CAAC,KAAoB;QACjC,uBAAA,IAAI,+BAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAEM,OAAO,CAAC,KAAoB;QAC/B,uBAAA,IAAI,+BAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAEM,YAAY,KAAW,CAAC;IAExB,aAAa,CAAC,KAAmB;QACpC,MAAM,GAAG,GAAG,uBAAA,IAAI,8BAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACpD,uBAAA,IAAI,+BAAW,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IAEM,YAAY,KAAW,CAAC;IAExB,aAAa,CAAC,KAAmB;QACpC,MAAM,GAAG,GAAG,uBAAA,IAAI,8BAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACpD,uBAAA,IAAI,+BAAW,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IAEM,YAAY,CAAC,KAAmB;QACnC,MAAM,GAAG,GAAG,uBAAA,IAAI,8BAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACpD,uBAAA,IAAI,+BAAW,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IAEM,WAAW,CAAC,KAAmB;QAClC,MAAM,GAAG,GAAG,uBAAA,IAAI,8BAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACpD,uBAAA,IAAI,+BAAW,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC;CAGJ;AA1DD,oCA0DC;;AAED,yBAAyB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { IRay } from '@shapediver/viewer.rendering-engine.intersection-engine';
|
|
2
|
+
import { IViewportApi } from '@shapediver/viewer';
|
|
3
|
+
import { IVisualizationSettings } from '../interfaces/IVisualizationSettings';
|
|
4
|
+
import { vec3 } from 'gl-matrix';
|
|
5
|
+
export declare class GeometryMathManager {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(viewport: IViewportApi, settings: IVisualizationSettings);
|
|
8
|
+
/**
|
|
9
|
+
* Check which distances of lines to ray
|
|
10
|
+
*
|
|
11
|
+
* @param ray
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
checkLineDistances(ray: IRay, positionArray: Float32Array, indicesArrayLines?: Uint8Array | null): {
|
|
15
|
+
index: number[];
|
|
16
|
+
distance: number;
|
|
17
|
+
}[] | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Check which distances of points to ray
|
|
20
|
+
*
|
|
21
|
+
* @param ray
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
checkPointDistances(ray: IRay, positionArray: Float32Array): {
|
|
25
|
+
index: number;
|
|
26
|
+
distance: number;
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
close(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Calculate the closest point on a ray to a point
|
|
31
|
+
*
|
|
32
|
+
* @param ray
|
|
33
|
+
* @param point
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
closestPoint(ray: IRay, point: vec3): vec3;
|
|
37
|
+
/**
|
|
38
|
+
* Calculate the closest point on a line to a point
|
|
39
|
+
*
|
|
40
|
+
* @param start
|
|
41
|
+
* @param end
|
|
42
|
+
* @param point
|
|
43
|
+
*/
|
|
44
|
+
closestPointOnLine(start: vec3, end: vec3, point: vec3): vec3;
|
|
45
|
+
/**
|
|
46
|
+
* Calculate the closest point on a plane to a point
|
|
47
|
+
*
|
|
48
|
+
* @param point
|
|
49
|
+
* @param planeNormal
|
|
50
|
+
* @param planeOrigin
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
closestPointOnPlane(planeOrigin: vec3, planeNormal: vec3, point: vec3): vec3;
|
|
54
|
+
/**
|
|
55
|
+
* Calculate the distance between a ray and a line segment
|
|
56
|
+
*
|
|
57
|
+
* @param ray
|
|
58
|
+
* @param lineStart
|
|
59
|
+
* @param lineEnd
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
closestPointsRayLine(ray: IRay, lineStart: vec3, lineEnd: vec3): {
|
|
63
|
+
closestPointOnRay: vec3;
|
|
64
|
+
closestPointOnLine: vec3;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Calculate the distance between two rays
|
|
68
|
+
*
|
|
69
|
+
* @param ray1
|
|
70
|
+
* @param ray2
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
closestPointsRayRay(ray1: IRay, ray2: IRay): {
|
|
74
|
+
closestPointOnRay1: vec3;
|
|
75
|
+
closestPointOnRay2: vec3;
|
|
76
|
+
};
|
|
77
|
+
screenSpaceDistanceCheck(point1: vec3, point2: vec3, threshold: number): {
|
|
78
|
+
distanceSquared: number;
|
|
79
|
+
check: boolean;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=GeometryMathManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeometryMathManager.d.ts","sourceRoot":"","sources":["../../src/implementation/GeometryMathManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yDAAyD,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,qBAAa,mBAAmB;;gBAUhB,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,sBAAsB;IASpE;;;;;OAKG;IACI,kBAAkB,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,CAAC,EAAE,UAAU,GAAG,IAAI,GAAG;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;KAAE,EAAE,GAAG,SAAS;IA8B9J;;;;;OAKG;IACI,mBAAmB,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,GAAG;QAChE,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KACpB,EAAE,GAAG,SAAS;IAyBR,KAAK,IAAI,IAAI;IAEpB;;;;;;OAMG;IACI,YAAY,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI;IAOjD;;;;;;OAMG;IACI,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI;IAoBpE;;;;;;;OAOG;IACI,mBAAmB,CAAC,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI;IAYnF;;;;;;;OAOG;IACI,oBAAoB,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,GAAG;QAAE,iBAAiB,EAAE,IAAI,CAAC;QAAC,kBAAkB,EAAE,IAAI,CAAA;KAAE;IA2C7H;;;;;;OAMG;IACI,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG;QAAE,kBAAkB,EAAE,IAAI,CAAC;QAAC,kBAAkB,EAAE,IAAI,CAAA;KAAE;IA+BnG,wBAAwB,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM;;;;CAkChF"}
|
|
@@ -0,0 +1,240 @@
|
|
|
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 _GeometryMathManager_settings, _GeometryMathManager_viewport;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.GeometryMathManager = void 0;
|
|
16
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
17
|
+
class GeometryMathManager {
|
|
18
|
+
// #endregion Properties (2)
|
|
19
|
+
// #region Constructors (1)
|
|
20
|
+
constructor(viewport, settings) {
|
|
21
|
+
// #region Properties (2)
|
|
22
|
+
_GeometryMathManager_settings.set(this, void 0);
|
|
23
|
+
_GeometryMathManager_viewport.set(this, void 0);
|
|
24
|
+
__classPrivateFieldSet(this, _GeometryMathManager_viewport, viewport, "f");
|
|
25
|
+
__classPrivateFieldSet(this, _GeometryMathManager_settings, settings, "f");
|
|
26
|
+
}
|
|
27
|
+
// #endregion Constructors (1)
|
|
28
|
+
// #region Public Methods (9)
|
|
29
|
+
/**
|
|
30
|
+
* Check which distances of lines to ray
|
|
31
|
+
*
|
|
32
|
+
* @param ray
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
checkLineDistances(ray, positionArray, indicesArrayLines) {
|
|
36
|
+
// if there are no line array indices, return
|
|
37
|
+
if (!indicesArrayLines)
|
|
38
|
+
return;
|
|
39
|
+
/**
|
|
40
|
+
* Calculate line distances to ray
|
|
41
|
+
*/
|
|
42
|
+
const distances = [];
|
|
43
|
+
for (let i = 0; i < indicesArrayLines.length; i += 2) {
|
|
44
|
+
const firstIndex = indicesArrayLines.at(i);
|
|
45
|
+
const secondIndex = indicesArrayLines.at(i + 1);
|
|
46
|
+
const lineStart = gl_matrix_1.vec3.fromValues(positionArray.at(firstIndex * 3), positionArray.at(firstIndex * 3 + 1), positionArray.at(firstIndex * 3 + 2));
|
|
47
|
+
const lineEnd = gl_matrix_1.vec3.fromValues(positionArray.at(secondIndex * 3), positionArray.at(secondIndex * 3 + 1), positionArray.at(secondIndex * 3 + 2));
|
|
48
|
+
const { closestPointOnRay, closestPointOnLine } = this.closestPointsRayLine(ray, lineStart, lineEnd);
|
|
49
|
+
if (this.screenSpaceDistanceCheck(closestPointOnRay, closestPointOnLine, __classPrivateFieldGet(this, _GeometryMathManager_settings, "f").points.size_0 * __classPrivateFieldGet(this, _GeometryMathManager_settings, "f").distanceMultiplicationFactor).check === false)
|
|
50
|
+
continue;
|
|
51
|
+
distances.push({ index: [firstIndex, secondIndex], distance: gl_matrix_1.vec3.distance(closestPointOnRay, closestPointOnLine) });
|
|
52
|
+
}
|
|
53
|
+
// if there are no distances, return
|
|
54
|
+
if (distances.length === 0)
|
|
55
|
+
return;
|
|
56
|
+
return distances.sort((a, b) => a.distance - b.distance);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check which distances of points to ray
|
|
60
|
+
*
|
|
61
|
+
* @param ray
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
checkPointDistances(ray, positionArray) {
|
|
65
|
+
/**
|
|
66
|
+
* Calculate point distances to ray
|
|
67
|
+
*/
|
|
68
|
+
const distances = [];
|
|
69
|
+
for (let i = 0; i < positionArray.length; i += 3) {
|
|
70
|
+
const point = gl_matrix_1.vec3.fromValues(positionArray.at(i), positionArray.at(i + 1), positionArray.at(i + 2));
|
|
71
|
+
// distance from point to ray
|
|
72
|
+
const closestPoint = this.closestPoint(ray, point);
|
|
73
|
+
if (this.screenSpaceDistanceCheck(point, closestPoint, __classPrivateFieldGet(this, _GeometryMathManager_settings, "f").points.size_0 * __classPrivateFieldGet(this, _GeometryMathManager_settings, "f").distanceMultiplicationFactor).check === false)
|
|
74
|
+
continue;
|
|
75
|
+
distances.push({ index: i / 3, distance: gl_matrix_1.vec3.distance(point, closestPoint) });
|
|
76
|
+
}
|
|
77
|
+
// if there are no distances, return
|
|
78
|
+
if (distances.length === 0)
|
|
79
|
+
return;
|
|
80
|
+
// sort distances
|
|
81
|
+
return distances.sort((a, b) => a.distance - b.distance);
|
|
82
|
+
}
|
|
83
|
+
close() { }
|
|
84
|
+
/**
|
|
85
|
+
* Calculate the closest point on a ray to a point
|
|
86
|
+
*
|
|
87
|
+
* @param ray
|
|
88
|
+
* @param point
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
closestPoint(ray, point) {
|
|
92
|
+
// distance from point to ray
|
|
93
|
+
const dot = gl_matrix_1.vec3.dot(ray.direction, gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), point, ray.origin));
|
|
94
|
+
// closest point on ray to point
|
|
95
|
+
return gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), ray.origin, gl_matrix_1.vec3.multiply(gl_matrix_1.vec3.create(), ray.direction, gl_matrix_1.vec3.fromValues(dot, dot, dot)));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Calculate the closest point on a line to a point
|
|
99
|
+
*
|
|
100
|
+
* @param start
|
|
101
|
+
* @param end
|
|
102
|
+
* @param point
|
|
103
|
+
*/
|
|
104
|
+
closestPointOnLine(start, end, point) {
|
|
105
|
+
const lineDir = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), end, start);
|
|
106
|
+
// Vector from linePoint to point
|
|
107
|
+
const v = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), point, start);
|
|
108
|
+
// Line direction dot product with itself
|
|
109
|
+
const dirDotDir = gl_matrix_1.vec3.dot(lineDir, lineDir);
|
|
110
|
+
// If the direction vector is a zero vector, return the line point as closest point
|
|
111
|
+
if (dirDotDir === 0)
|
|
112
|
+
return start;
|
|
113
|
+
// Projection factor t
|
|
114
|
+
const t = gl_matrix_1.vec3.dot(v, lineDir) / dirDotDir;
|
|
115
|
+
// Closest point on the line
|
|
116
|
+
const closestPoint = gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), start, gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), lineDir, t));
|
|
117
|
+
return closestPoint;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Calculate the closest point on a plane to a point
|
|
121
|
+
*
|
|
122
|
+
* @param point
|
|
123
|
+
* @param planeNormal
|
|
124
|
+
* @param planeOrigin
|
|
125
|
+
* @returns
|
|
126
|
+
*/
|
|
127
|
+
closestPointOnPlane(planeOrigin, planeNormal, point) {
|
|
128
|
+
// Calculate the vector from the plane origin to the point
|
|
129
|
+
const toPoint = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), point, planeOrigin);
|
|
130
|
+
// Project the vector onto the plane normal
|
|
131
|
+
const projectionLength = gl_matrix_1.vec3.dot(toPoint, planeNormal);
|
|
132
|
+
const projectionVector = gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), planeNormal, projectionLength);
|
|
133
|
+
// Subtract the projection vector from the original point to get the projected point
|
|
134
|
+
return gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), point, projectionVector);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Calculate the distance between a ray and a line segment
|
|
138
|
+
*
|
|
139
|
+
* @param ray
|
|
140
|
+
* @param lineStart
|
|
141
|
+
* @param lineEnd
|
|
142
|
+
* @returns
|
|
143
|
+
*/
|
|
144
|
+
closestPointsRayLine(ray, lineStart, lineEnd) {
|
|
145
|
+
// direction of line
|
|
146
|
+
const lineDirection = gl_matrix_1.vec3.normalize(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.subtract(gl_matrix_1.vec3.create(), lineEnd, lineStart));
|
|
147
|
+
// cross product of ray direction and line direction
|
|
148
|
+
const crossProduct = gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), ray.direction, lineDirection);
|
|
149
|
+
// length of cross product
|
|
150
|
+
const crossProductLength = gl_matrix_1.vec3.length(crossProduct);
|
|
151
|
+
if (crossProductLength < 0.0001) {
|
|
152
|
+
// ray and line are parallel, calculate the distance differently
|
|
153
|
+
const closestPointOnRay = ray.origin;
|
|
154
|
+
const closestPointOnLine = gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), lineStart, gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), lineDirection, gl_matrix_1.vec3.dot(gl_matrix_1.vec3.subtract(gl_matrix_1.vec3.create(), ray.origin, lineStart), lineDirection)));
|
|
155
|
+
return {
|
|
156
|
+
closestPointOnRay, closestPointOnLine
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
const t = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), lineStart, ray.origin);
|
|
160
|
+
const u = gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), t, lineDirection);
|
|
161
|
+
const v = gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), t, ray.direction);
|
|
162
|
+
const tValue = gl_matrix_1.vec3.dot(u, crossProduct) / Math.pow(crossProductLength, 2);
|
|
163
|
+
const uValue = gl_matrix_1.vec3.dot(v, crossProduct) / Math.pow(crossProductLength, 2);
|
|
164
|
+
const closestPointOnRay = gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), ray.origin, gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), ray.direction, tValue));
|
|
165
|
+
// restrict the closest point on line to the line segment
|
|
166
|
+
let closestPointOnLine;
|
|
167
|
+
if (uValue < 0) {
|
|
168
|
+
closestPointOnLine = lineStart;
|
|
169
|
+
}
|
|
170
|
+
else if (uValue > gl_matrix_1.vec3.distance(lineStart, lineEnd)) {
|
|
171
|
+
closestPointOnLine = lineEnd;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
closestPointOnLine = gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), lineStart, gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), lineDirection, uValue));
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
closestPointOnRay, closestPointOnLine
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Calculate the distance between two rays
|
|
182
|
+
*
|
|
183
|
+
* @param ray1
|
|
184
|
+
* @param ray2
|
|
185
|
+
* @returns
|
|
186
|
+
*/
|
|
187
|
+
closestPointsRayRay(ray1, ray2) {
|
|
188
|
+
// cross product of ray1 direction and ray2 direction
|
|
189
|
+
const crossProduct = gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), ray1.direction, ray2.direction);
|
|
190
|
+
// length of cross product
|
|
191
|
+
const crossProductLength = gl_matrix_1.vec3.length(crossProduct);
|
|
192
|
+
if (crossProductLength < 0.0001) {
|
|
193
|
+
// ray1 and ray2 are parallel, calculate the distance differently
|
|
194
|
+
const closestPointOnRay1 = ray1.origin;
|
|
195
|
+
const closestPointOnRay2 = gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), ray2.origin, gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), ray2.direction, gl_matrix_1.vec3.dot(gl_matrix_1.vec3.subtract(gl_matrix_1.vec3.create(), ray1.origin, ray2.origin), ray2.direction)));
|
|
196
|
+
return {
|
|
197
|
+
closestPointOnRay1, closestPointOnRay2
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
const t = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), ray2.origin, ray1.origin);
|
|
201
|
+
const u = gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), t, ray2.direction);
|
|
202
|
+
const v = gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), t, ray1.direction);
|
|
203
|
+
const tValue = gl_matrix_1.vec3.dot(u, crossProduct) / Math.pow(crossProductLength, 2);
|
|
204
|
+
const uValue = gl_matrix_1.vec3.dot(v, crossProduct) / Math.pow(crossProductLength, 2);
|
|
205
|
+
const closestPointOnRay1 = gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), ray1.origin, gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), ray1.direction, tValue));
|
|
206
|
+
const closestPointOnRay2 = gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), ray2.origin, gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), ray2.direction, uValue));
|
|
207
|
+
return {
|
|
208
|
+
closestPointOnRay1, closestPointOnRay2
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
screenSpaceDistanceCheck(point1, point2, threshold) {
|
|
212
|
+
const camera = __classPrivateFieldGet(this, _GeometryMathManager_viewport, "f").camera;
|
|
213
|
+
// Project points to NDC
|
|
214
|
+
const screenPos1 = camera.project(gl_matrix_1.vec3.clone(point1));
|
|
215
|
+
const screenPos2 = camera.project(gl_matrix_1.vec3.clone(point2));
|
|
216
|
+
const width = __classPrivateFieldGet(this, _GeometryMathManager_viewport, "f").canvas.width;
|
|
217
|
+
const height = __classPrivateFieldGet(this, _GeometryMathManager_viewport, "f").canvas.height;
|
|
218
|
+
const x1 = ((screenPos1[0] * (width / 2)) + (width / 2));
|
|
219
|
+
const y1 = -((screenPos1[1] * (height / 2)) + (height / 2));
|
|
220
|
+
const x2 = ((screenPos2[0] * (width / 2)) + (width / 2));
|
|
221
|
+
const y2 = -((screenPos2[1] * (height / 2)) + (height / 2));
|
|
222
|
+
const distanceSquared = Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2);
|
|
223
|
+
/**
|
|
224
|
+
* Logic: The actual calculation would be
|
|
225
|
+
* distance * 2 < threshold
|
|
226
|
+
* the multiplication by 2 is to account for the fact that the distance is from the center of the point
|
|
227
|
+
*
|
|
228
|
+
* However, we work with the squared distance to avoid the sqrt operation
|
|
229
|
+
* Therefore we square all values:
|
|
230
|
+
* distanceSquared * 4 < threshold ** 2
|
|
231
|
+
*/
|
|
232
|
+
return {
|
|
233
|
+
distanceSquared: distanceSquared,
|
|
234
|
+
check: distanceSquared * 4 < Math.pow(threshold, 2)
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
exports.GeometryMathManager = GeometryMathManager;
|
|
239
|
+
_GeometryMathManager_settings = new WeakMap(), _GeometryMathManager_viewport = new WeakMap();
|
|
240
|
+
//# sourceMappingURL=GeometryMathManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeometryMathManager.js","sourceRoot":"","sources":["../../src/implementation/GeometryMathManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGA,yCAAiC;AAEjC,MAAa,mBAAmB;IAM5B,4BAA4B;IAE5B,2BAA2B;IAE3B,YAAY,QAAsB,EAAE,QAAgC;QATpE,yBAAyB;QAEzB,gDAA2C;QAC3C,gDAAiC;QAO7B,uBAAA,IAAI,iCAAa,QAAQ,MAAA,CAAC;QAC1B,uBAAA,IAAI,iCAAa,QAAQ,MAAA,CAAC;IAC9B,CAAC;IAED,8BAA8B;IAE9B,6BAA6B;IAE7B;;;;;OAKG;IACI,kBAAkB,CAAC,GAAS,EAAE,aAA2B,EAAE,iBAAqC;QACnG,6CAA6C;QAC7C,IAAI,CAAC,iBAAiB;YAAE,OAAO;QAE/B;;WAEG;QACH,MAAM,SAAS,GAGT,EAAE,CAAC;QAET,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAClD,MAAM,UAAU,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAE,CAAC;YAC5C,MAAM,WAAW,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAE,CAAC;YACjD,MAAM,SAAS,GAAG,gBAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC,UAAU,GAAG,CAA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AM,KAAK,GAAG,uBAAA,IAAI,qCAAU,CAAC,MAAM,CAAC,KAAK,CAAC;QAC1C,MAAM,MAAM,GAAG,uBAAA,IAAI,qCAAU,CAAC,MAAM,CAAC,MAAM,CAAC;QAE5C,MAAM,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;QACzD,MAAM,EAAE,GAAG,CAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;QAE7D,MAAM,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;QACzD,MAAM,EAAE,GAAG,CAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;QAE7D,MAAM,eAAe,GAAG,SAAA,CAAC,EAAE,GAAG,EAAE,CAAC,EAAI,CAAC,CAAA,GAAG,SAAA,CAAC,EAAE,GAAG,EAAE,CAAC,EAAI,CAAC,CAAA,CAAC;QAExD;;;;;;;;WAQG;QACH,OAAO;YACH,eAAe,EAAE,eAAe;YAChC,KAAK,EAAE,eAAe,GAAG,CAAC,GAAG,SAAA,SAAS,EAAI,CAAC,CAAA;SAC9C,CAAC;IACN,CAAC;CAGJ;AAnRD,kDAmRC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DraggingRestrictionMetaData, DrawingRestrictionMetaData, IRestriction, RayTraceResult, RestrictionProperties } from '../interfaces/IRestriction';
|
|
2
|
+
import { IRay } from '@shapediver/viewer.rendering-engine.intersection-engine';
|
|
3
|
+
import { IRestrictionManager } from '../interfaces/IRestrictionManager';
|
|
4
|
+
import { ITreeNode } from '@shapediver/viewer.shared.node-tree';
|
|
5
|
+
import { IViewportApi } from '@shapediver/viewer';
|
|
6
|
+
import { IVisualizationSettings } from '../interfaces/IVisualizationSettings';
|
|
7
|
+
export declare class RestrictionManager implements IRestrictionManager {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(viewport: IViewportApi, parentNode?: ITreeNode, restrictions?: RestrictionProperties[], settings?: IVisualizationSettings);
|
|
10
|
+
get closed(): boolean;
|
|
11
|
+
get restrictions(): {
|
|
12
|
+
[token: string]: IRestriction;
|
|
13
|
+
};
|
|
14
|
+
get showRestrictionVisualization(): boolean;
|
|
15
|
+
set showRestrictionVisualization(value: boolean);
|
|
16
|
+
addRestriction(properties: RestrictionProperties): string | undefined;
|
|
17
|
+
close(): void;
|
|
18
|
+
getPressedKeys(): string[];
|
|
19
|
+
getRestriction(token: string): IRestriction | undefined;
|
|
20
|
+
rayTrace(ray: IRay, metaData: DrawingRestrictionMetaData | DraggingRestrictionMetaData): RayTraceResult | undefined;
|
|
21
|
+
removeRestriction(token: string): boolean;
|
|
22
|
+
private onDown;
|
|
23
|
+
private onKeyDown;
|
|
24
|
+
private onKeyUp;
|
|
25
|
+
private onMove;
|
|
26
|
+
private onOut;
|
|
27
|
+
private onUp;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=RestrictionManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestrictionManager.d.ts","sourceRoot":"","sources":["../../src/implementation/RestrictionManager.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,2BAA2B,EAC3B,0BAA0B,EAC1B,YAAY,EAEZ,cAAc,EAEd,qBAAqB,EACxB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,IAAI,EAAE,MAAM,yDAAyD,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MA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