@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 @@
|
|
|
1
|
+
{"version":3,"file":"LineRestriction.js","sourceRoot":"","sources":["../../../../src/implementation/restrictions/line/LineRestriction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAA6D;AAa7D,yCAAiC;AAUjC,8BAA8B;AAE9B,sBAAsB;AAEtB,MAAa,eAAgB,SAAQ,yCAAmB;IAYpD,4BAA4B;IAE5B,2BAA2B;IAE3B,YAAY,QAAsB,EAAE,mBAAwC,EAAE,UAAqB,EAAE,EAAU,EAAE,QAAgC,EAAE,UAAqC;QACpL,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;QAhBhD,yBAAyB;QAEzB,4CAAiC;QAEjC,kDAAwB;QACxB,2CAAe;QACf,0CAAc;QACd,0CAAc;QACd,0CAAgB;QAChB,4CAAyD,EAAE,EAAC;QASxD,uBAAA,IAAI,6BAAa,QAAQ,MAAA,CAAC;QAC1B,uBAAA,IAAI,2BAAW,UAAU,CAAC,MAAM,MAAA,CAAC;QACjC,uBAAA,IAAI,2BAAW,UAAU,CAAC,MAAM,MAAA,CAAC;QACjC,uBAAA,IAAI,2BAAW,UAAU,CAAC,MAAM,IAAI,CAAC,MAAA,CAAC;QAEtC,MAAM,SAAS,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BAAI,CAAC,MAAM,EAAE,CAAC;QACjC,IAAI,EAAE,GAAG,CAAC,EAAE;YACR,gBAAI,CAAC,IAAI,CAAC,MAAM,EAAE,uBAAA,IAAI,gCAAS,CAAC,MAAM,CAAC,CAAC;SAC3C;aAAM,IAAI,EAAE,GAAG,uBAAA,IAAI,uCAAgB,EAAE;YAClC,MAAM,GAAG,gBAAI,CAAC,GAAG,CAAC,gBAAI,CAAC,MAAM,EAAE,EAAE,uBAAA,IAAI,gCAAS,CAAC,MAAM,EAAE,gBAAI,CAAC,GAAG,CAAC,gBAAI,CAAC,MAAM,EAAE,EAAE,uBAAA,IAAI,gCAAS,CAAC,SAAS,EAAE,gBAAI,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;SACzI;aAAM;YACH,gBAAI,CAAC,IAAI,CAAC,MAAM,EAAE,uBAAA,IAAI,+BAAQ,CAAC,CAAC;SACnC;QAED,MAAM,QAAQ,GAAG,gBAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/C,IAAI,QAAQ,GAAG,uBAAA,IAAI,+BAAQ,EAAE;YACzB,OAAO;gBACH,QAAQ;gBACR,KAAK,EAAE,MAAM;gBACb,iBAAiB,EAAE,MAAM;gBACzB,WAAW,EAAE,IAAI;aACpB,CAAC;SACL;QAED,OAAO;IACX,CAAC;IAED,gCAAgC;IAEhC,gCAAgC;IAEtB,iBAAiB,KAAW,CAAC;CAG1C;AAzGD,0CAyGC;;AAED,yBAAyB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { AbstractRestriction } from '../AbstractRestriction';
|
|
2
|
+
import { AngularRestriction, AngularRestrictionProperties } from './snap/AngularRestriction';
|
|
3
|
+
import { AxisRestriction, AxisRestrictionProperties } from './snap/AxisRestriction';
|
|
4
|
+
import { ITreeNode, IViewportApi } from '@shapediver/viewer';
|
|
5
|
+
import { GeometryMathManager } from '../../GeometryMathManager';
|
|
6
|
+
import { GridRestriction, GridRestrictionProperties } from './snap/GridRestriction';
|
|
7
|
+
import { IRay } from '@shapediver/viewer.rendering-engine.intersection-engine';
|
|
8
|
+
import { IRestriction, RestrictionMetaData, RestrictionPropertiesBase, RestrictionResult } from '../../../interfaces/IRestriction';
|
|
9
|
+
import { ISnapRestriction } from '../../../interfaces/ISnapRestriction';
|
|
10
|
+
import { IVisualizationSettings } from '../../../interfaces/IVisualizationSettings';
|
|
11
|
+
import { mat4, vec3 } from 'gl-matrix';
|
|
12
|
+
export declare type PlaneRestrictionProperties = {
|
|
13
|
+
/**
|
|
14
|
+
* The origin of the plane.
|
|
15
|
+
*
|
|
16
|
+
* @default vec3.fromValues(0, 0, 0)
|
|
17
|
+
*/
|
|
18
|
+
origin?: vec3;
|
|
19
|
+
/**
|
|
20
|
+
* Vector U of the plane
|
|
21
|
+
* with the cross product of vector_u and vector_v the normal of the plane can be calculated
|
|
22
|
+
*/
|
|
23
|
+
vector_u?: vec3;
|
|
24
|
+
/**
|
|
25
|
+
* Vector V of the plane
|
|
26
|
+
* with the cross product of vector_u and vector_v the normal of the plane can be calculated
|
|
27
|
+
*/
|
|
28
|
+
vector_v?: vec3;
|
|
29
|
+
/**
|
|
30
|
+
* grid snap restriction
|
|
31
|
+
*/
|
|
32
|
+
gridSnapRestriction?: GridRestrictionProperties;
|
|
33
|
+
/**
|
|
34
|
+
* angular snap restriction
|
|
35
|
+
*/
|
|
36
|
+
angularSnapRestriction?: AngularRestrictionProperties;
|
|
37
|
+
/**
|
|
38
|
+
* axis snap restriction
|
|
39
|
+
*/
|
|
40
|
+
axisSnapRestriction?: AxisRestrictionProperties;
|
|
41
|
+
} & RestrictionPropertiesBase;
|
|
42
|
+
export declare class PlaneRestriction extends AbstractRestriction implements IRestriction {
|
|
43
|
+
#private;
|
|
44
|
+
constructor(viewport: IViewportApi, geometryMathManager: GeometryMathManager, parentNode: ITreeNode, id: string, settings: IVisualizationSettings, properties: PlaneRestrictionProperties);
|
|
45
|
+
get angularRestriction(): AngularRestriction;
|
|
46
|
+
get axisRestriction(): AxisRestriction;
|
|
47
|
+
get gridRestriction(): GridRestriction;
|
|
48
|
+
get normal(): vec3;
|
|
49
|
+
get origin(): vec3;
|
|
50
|
+
set origin(value: vec3);
|
|
51
|
+
get priority(): number;
|
|
52
|
+
get snapRestrictions(): {
|
|
53
|
+
[key: string]: ISnapRestriction;
|
|
54
|
+
};
|
|
55
|
+
get transformationFromXYPlaneMatrix(): mat4;
|
|
56
|
+
get transformationToXYPlaneMatrix(): mat4;
|
|
57
|
+
get vectorU(): vec3;
|
|
58
|
+
set vectorU(value: vec3);
|
|
59
|
+
get vectorV(): vec3;
|
|
60
|
+
set vectorV(value: vec3);
|
|
61
|
+
rayTrace(ray: IRay, metaData?: RestrictionMetaData): RestrictionResult | undefined;
|
|
62
|
+
protected visibilityChanged(): void;
|
|
63
|
+
private createDefaultPlane;
|
|
64
|
+
private createTransformationMatrices;
|
|
65
|
+
private snap;
|
|
66
|
+
private updatePlaneDefinition;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=PlaneRestriction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlaneRestriction.d.ts","sourceRoot":"","sources":["../../../../src/implementation/restrictions/plane/PlaneRestriction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAIH,SAAS,EACT,YAAY,EAEf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAEpF,OAAO,EAAE,IAAI,EAAE,MAAM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AA+B,IAAI,IAAI,CAEjD;IAED,IAAW,6BAA6B,IAAI,IAAI,CAE/C;IAED,IAAW,OAAO,IAAI,IAAI,CAEzB;IAED,IAAW,OAAO,CAAC,KAAK,EAAE,IAAI,EAG7B;IAED,IAAW,OAAO,IAAI,IAAI,CAEzB;IAED,IAAW,OAAO,CAAC,KAAK,EAAE,IAAI,EAG7B;IAMM,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,mBAAmB,GAAG,iBAAiB,GAAG,SAAS;IA4BzF,SAAS,CAAC,iBAAiB,IAAI,IAAI;IAMnC,OAAO,CAAC,kBAAkB;IAqB1B,OAAO,CAAC,4BAA4B;IAuBpC,OAAO,CAAC,IAAI;IAgDZ,OAAO,CAAC,qBAAqB;CAqDhC"}
|
|
@@ -0,0 +1,259 @@
|
|
|
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 _PlaneRestriction_properties, _PlaneRestriction_viewport, _PlaneRestriction_angularRestriction, _PlaneRestriction_axisRestriction, _PlaneRestriction_cameraId, _PlaneRestriction_gridRestriction, _PlaneRestriction_normal, _PlaneRestriction_origin, _PlaneRestriction_plane, _PlaneRestriction_snapRestrictions, _PlaneRestriction_transformationFromXYPlaneMatrix, _PlaneRestriction_transformationToXYPlaneMatrix, _PlaneRestriction_vectorU, _PlaneRestriction_vectorV;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PlaneRestriction = void 0;
|
|
16
|
+
const AbstractRestriction_1 = require("../AbstractRestriction");
|
|
17
|
+
const AngularRestriction_1 = require("./snap/AngularRestriction");
|
|
18
|
+
const AxisRestriction_1 = require("./snap/AxisRestriction");
|
|
19
|
+
const viewer_1 = require("@shapediver/viewer");
|
|
20
|
+
const GridRestriction_1 = require("./snap/GridRestriction");
|
|
21
|
+
const viewer_shared_math_1 = require("@shapediver/viewer.shared.math");
|
|
22
|
+
const IRestriction_1 = require("../../../interfaces/IRestriction");
|
|
23
|
+
const gl_matrix_1 = require("gl-matrix");
|
|
24
|
+
// #endregion Type aliases (1)
|
|
25
|
+
// #region Classes (1)
|
|
26
|
+
class PlaneRestriction extends AbstractRestriction_1.AbstractRestriction {
|
|
27
|
+
// #endregion Properties (14)
|
|
28
|
+
// #region Constructors (1)
|
|
29
|
+
constructor(viewport, geometryMathManager, parentNode, id, settings, properties) {
|
|
30
|
+
super(viewport, parentNode, id, properties);
|
|
31
|
+
// #region Properties (14)
|
|
32
|
+
_PlaneRestriction_properties.set(this, void 0);
|
|
33
|
+
_PlaneRestriction_viewport.set(this, void 0);
|
|
34
|
+
_PlaneRestriction_angularRestriction.set(this, void 0);
|
|
35
|
+
_PlaneRestriction_axisRestriction.set(this, void 0);
|
|
36
|
+
_PlaneRestriction_cameraId.set(this, '');
|
|
37
|
+
_PlaneRestriction_gridRestriction.set(this, void 0);
|
|
38
|
+
_PlaneRestriction_normal.set(this, gl_matrix_1.vec3.create());
|
|
39
|
+
_PlaneRestriction_origin.set(this, gl_matrix_1.vec3.create());
|
|
40
|
+
_PlaneRestriction_plane.set(this, new viewer_shared_math_1.Plane());
|
|
41
|
+
_PlaneRestriction_snapRestrictions.set(this, void 0);
|
|
42
|
+
_PlaneRestriction_transformationFromXYPlaneMatrix.set(this, gl_matrix_1.mat4.create());
|
|
43
|
+
_PlaneRestriction_transformationToXYPlaneMatrix.set(this, gl_matrix_1.mat4.create());
|
|
44
|
+
_PlaneRestriction_vectorU.set(this, gl_matrix_1.vec3.create());
|
|
45
|
+
_PlaneRestriction_vectorV.set(this, gl_matrix_1.vec3.create());
|
|
46
|
+
__classPrivateFieldSet(this, _PlaneRestriction_viewport, viewport, "f");
|
|
47
|
+
__classPrivateFieldSet(this, _PlaneRestriction_cameraId, __classPrivateFieldGet(this, _PlaneRestriction_viewport, "f").camera.id, "f");
|
|
48
|
+
__classPrivateFieldSet(this, _PlaneRestriction_properties, properties, "f");
|
|
49
|
+
__classPrivateFieldSet(this, _PlaneRestriction_gridRestriction, new GridRestriction_1.GridRestriction(viewport, geometryMathManager, parentNode, this, __classPrivateFieldGet(this, _PlaneRestriction_properties, "f").gridSnapRestriction), "f");
|
|
50
|
+
__classPrivateFieldSet(this, _PlaneRestriction_angularRestriction, new AngularRestriction_1.AngularRestriction(viewport, geometryMathManager, parentNode, this, settings, __classPrivateFieldGet(this, _PlaneRestriction_properties, "f").angularSnapRestriction), "f");
|
|
51
|
+
__classPrivateFieldSet(this, _PlaneRestriction_axisRestriction, new AxisRestriction_1.AxisRestriction(viewport, geometryMathManager, parentNode, this, __classPrivateFieldGet(this, _PlaneRestriction_properties, "f").axisSnapRestriction), "f");
|
|
52
|
+
this.updatePlaneDefinition();
|
|
53
|
+
__classPrivateFieldSet(this, _PlaneRestriction_snapRestrictions, {
|
|
54
|
+
grid: __classPrivateFieldGet(this, _PlaneRestriction_gridRestriction, "f"),
|
|
55
|
+
angular: __classPrivateFieldGet(this, _PlaneRestriction_angularRestriction, "f"),
|
|
56
|
+
axis: __classPrivateFieldGet(this, _PlaneRestriction_axisRestriction, "f")
|
|
57
|
+
}, "f");
|
|
58
|
+
}
|
|
59
|
+
// #endregion Constructors (1)
|
|
60
|
+
// #region Public Getters And Setters (14)
|
|
61
|
+
get angularRestriction() {
|
|
62
|
+
return __classPrivateFieldGet(this, _PlaneRestriction_angularRestriction, "f");
|
|
63
|
+
}
|
|
64
|
+
get axisRestriction() {
|
|
65
|
+
return __classPrivateFieldGet(this, _PlaneRestriction_axisRestriction, "f");
|
|
66
|
+
}
|
|
67
|
+
get gridRestriction() {
|
|
68
|
+
return __classPrivateFieldGet(this, _PlaneRestriction_gridRestriction, "f");
|
|
69
|
+
}
|
|
70
|
+
get normal() {
|
|
71
|
+
return __classPrivateFieldGet(this, _PlaneRestriction_normal, "f");
|
|
72
|
+
}
|
|
73
|
+
get origin() {
|
|
74
|
+
return __classPrivateFieldGet(this, _PlaneRestriction_origin, "f");
|
|
75
|
+
}
|
|
76
|
+
set origin(value) {
|
|
77
|
+
__classPrivateFieldSet(this, _PlaneRestriction_origin, value, "f");
|
|
78
|
+
this.updatePlaneDefinition();
|
|
79
|
+
}
|
|
80
|
+
get priority() {
|
|
81
|
+
return -1;
|
|
82
|
+
}
|
|
83
|
+
get snapRestrictions() {
|
|
84
|
+
return __classPrivateFieldGet(this, _PlaneRestriction_snapRestrictions, "f");
|
|
85
|
+
}
|
|
86
|
+
get transformationFromXYPlaneMatrix() {
|
|
87
|
+
return __classPrivateFieldGet(this, _PlaneRestriction_transformationFromXYPlaneMatrix, "f");
|
|
88
|
+
}
|
|
89
|
+
get transformationToXYPlaneMatrix() {
|
|
90
|
+
return __classPrivateFieldGet(this, _PlaneRestriction_transformationToXYPlaneMatrix, "f");
|
|
91
|
+
}
|
|
92
|
+
get vectorU() {
|
|
93
|
+
return __classPrivateFieldGet(this, _PlaneRestriction_vectorU, "f");
|
|
94
|
+
}
|
|
95
|
+
set vectorU(value) {
|
|
96
|
+
__classPrivateFieldGet(this, _PlaneRestriction_properties, "f").vector_u = value;
|
|
97
|
+
this.updatePlaneDefinition();
|
|
98
|
+
}
|
|
99
|
+
get vectorV() {
|
|
100
|
+
return __classPrivateFieldGet(this, _PlaneRestriction_vectorV, "f");
|
|
101
|
+
}
|
|
102
|
+
set vectorV(value) {
|
|
103
|
+
__classPrivateFieldGet(this, _PlaneRestriction_properties, "f").vector_v = value;
|
|
104
|
+
this.updatePlaneDefinition();
|
|
105
|
+
}
|
|
106
|
+
// #endregion Public Getters And Setters (14)
|
|
107
|
+
// #region Public Methods (1)
|
|
108
|
+
rayTrace(ray, metaData) {
|
|
109
|
+
if (this.enabled === false)
|
|
110
|
+
return;
|
|
111
|
+
if ((0, IRestriction_1.isDrawingRestriction)(metaData)) {
|
|
112
|
+
if (__classPrivateFieldGet(this, _PlaneRestriction_cameraId, "f") !== __classPrivateFieldGet(this, _PlaneRestriction_viewport, "f").camera.id)
|
|
113
|
+
this.updatePlaneDefinition();
|
|
114
|
+
let origin = __classPrivateFieldGet(this, _PlaneRestriction_origin, "f");
|
|
115
|
+
if (metaData.startPoint)
|
|
116
|
+
origin = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _PlaneRestriction_origin, "f"), gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _PlaneRestriction_normal, "f"), gl_matrix_1.vec3.dot(gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _PlaneRestriction_origin, "f"), metaData.startPoint), __classPrivateFieldGet(this, _PlaneRestriction_normal, "f"))));
|
|
117
|
+
// find intersection of ray and plane
|
|
118
|
+
const t = (gl_matrix_1.vec3.dot(origin, __classPrivateFieldGet(this, _PlaneRestriction_normal, "f")) - gl_matrix_1.vec3.dot(ray.origin, __classPrivateFieldGet(this, _PlaneRestriction_normal, "f"))) / gl_matrix_1.vec3.dot(ray.direction, __classPrivateFieldGet(this, _PlaneRestriction_normal, "f"));
|
|
119
|
+
const intersection = 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(t, t, t)));
|
|
120
|
+
return this.snap(ray, intersection, metaData);
|
|
121
|
+
}
|
|
122
|
+
else if ((0, IRestriction_1.isDraggingRestriction)(metaData)) {
|
|
123
|
+
const distance = __classPrivateFieldGet(this, _PlaneRestriction_plane, "f").intersect(ray.origin, ray.direction);
|
|
124
|
+
if (distance && distance > 0) {
|
|
125
|
+
const intersection = 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);
|
|
126
|
+
return this.snap(ray, intersection, metaData);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// #endregion Public Methods (1)
|
|
131
|
+
// #region Protected Methods (1)
|
|
132
|
+
visibilityChanged() { }
|
|
133
|
+
// #endregion Protected Methods (1)
|
|
134
|
+
// #region Private Methods (4)
|
|
135
|
+
createDefaultPlane(camera) {
|
|
136
|
+
if (camera.type === viewer_1.CAMERA_TYPE.PERSPECTIVE ||
|
|
137
|
+
(camera.type === viewer_1.CAMERA_TYPE.ORTHOGRAPHIC && camera.direction === viewer_1.ORTHOGRAPHIC_CAMERA_DIRECTION.CUSTOM)) {
|
|
138
|
+
__classPrivateFieldSet(this, _PlaneRestriction_vectorU, gl_matrix_1.vec3.fromValues(1, 0, 0), "f");
|
|
139
|
+
__classPrivateFieldSet(this, _PlaneRestriction_vectorV, gl_matrix_1.vec3.fromValues(0, 1, 0), "f");
|
|
140
|
+
__classPrivateFieldSet(this, _PlaneRestriction_normal, gl_matrix_1.vec3.fromValues(0, 0, 1), "f");
|
|
141
|
+
__classPrivateFieldSet(this, _PlaneRestriction_origin, gl_matrix_1.vec3.fromValues(0, 0, 0), "f");
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
const orthographicCamera = camera;
|
|
145
|
+
const direction = gl_matrix_1.vec3.normalize(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), orthographicCamera.target, orthographicCamera.position));
|
|
146
|
+
const up = orthographicCamera.direction === viewer_1.ORTHOGRAPHIC_CAMERA_DIRECTION.TOP || orthographicCamera.direction === viewer_1.ORTHOGRAPHIC_CAMERA_DIRECTION.BOTTOM ?
|
|
147
|
+
gl_matrix_1.vec3.fromValues(0, 1, 0) : gl_matrix_1.vec3.fromValues(0, 0, 1);
|
|
148
|
+
__classPrivateFieldSet(this, _PlaneRestriction_origin, gl_matrix_1.vec3.fromValues(0, 0, 0), "f");
|
|
149
|
+
__classPrivateFieldSet(this, _PlaneRestriction_normal, gl_matrix_1.vec3.negate(gl_matrix_1.vec3.create(), direction), "f");
|
|
150
|
+
__classPrivateFieldSet(this, _PlaneRestriction_vectorU, gl_matrix_1.vec3.clone(up), "f");
|
|
151
|
+
__classPrivateFieldSet(this, _PlaneRestriction_vectorV, gl_matrix_1.vec3.normalize(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _PlaneRestriction_normal, "f"), __classPrivateFieldGet(this, _PlaneRestriction_vectorU, "f"))), "f");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
createTransformationMatrices() {
|
|
155
|
+
// Calculate the transformation matrix for the rotation
|
|
156
|
+
const rotationMatrix = gl_matrix_1.mat4.fromValues(__classPrivateFieldGet(this, _PlaneRestriction_vectorU, "f")[0], __classPrivateFieldGet(this, _PlaneRestriction_vectorV, "f")[0], __classPrivateFieldGet(this, _PlaneRestriction_normal, "f")[0], 0, __classPrivateFieldGet(this, _PlaneRestriction_vectorU, "f")[1], __classPrivateFieldGet(this, _PlaneRestriction_vectorV, "f")[1], __classPrivateFieldGet(this, _PlaneRestriction_normal, "f")[1], 0, __classPrivateFieldGet(this, _PlaneRestriction_vectorU, "f")[2], __classPrivateFieldGet(this, _PlaneRestriction_vectorV, "f")[2], __classPrivateFieldGet(this, _PlaneRestriction_normal, "f")[2], 0, 0, 0, 0, 1);
|
|
157
|
+
let rotationMatrixInverse = gl_matrix_1.mat4.invert(gl_matrix_1.mat4.create(), rotationMatrix);
|
|
158
|
+
if (!rotationMatrixInverse)
|
|
159
|
+
rotationMatrixInverse = gl_matrix_1.mat4.create();
|
|
160
|
+
const pivotMatrix = gl_matrix_1.mat4.fromTranslation(gl_matrix_1.mat4.create(), gl_matrix_1.vec3.fromValues(__classPrivateFieldGet(this, _PlaneRestriction_origin, "f")[0], __classPrivateFieldGet(this, _PlaneRestriction_origin, "f")[1], __classPrivateFieldGet(this, _PlaneRestriction_origin, "f")[2]));
|
|
161
|
+
const pivotMatrixInverse = gl_matrix_1.mat4.fromTranslation(gl_matrix_1.mat4.create(), gl_matrix_1.vec3.fromValues(-__classPrivateFieldGet(this, _PlaneRestriction_origin, "f")[0], -__classPrivateFieldGet(this, _PlaneRestriction_origin, "f")[1], -__classPrivateFieldGet(this, _PlaneRestriction_origin, "f")[2]));
|
|
162
|
+
gl_matrix_1.mat4.multiply(__classPrivateFieldGet(this, _PlaneRestriction_transformationToXYPlaneMatrix, "f"), pivotMatrix, rotationMatrix);
|
|
163
|
+
gl_matrix_1.mat4.multiply(__classPrivateFieldGet(this, _PlaneRestriction_transformationToXYPlaneMatrix, "f"), __classPrivateFieldGet(this, _PlaneRestriction_transformationToXYPlaneMatrix, "f"), pivotMatrixInverse);
|
|
164
|
+
gl_matrix_1.mat4.multiply(__classPrivateFieldGet(this, _PlaneRestriction_transformationFromXYPlaneMatrix, "f"), pivotMatrix, rotationMatrixInverse);
|
|
165
|
+
gl_matrix_1.mat4.multiply(__classPrivateFieldGet(this, _PlaneRestriction_transformationFromXYPlaneMatrix, "f"), __classPrivateFieldGet(this, _PlaneRestriction_transformationFromXYPlaneMatrix, "f"), pivotMatrixInverse);
|
|
166
|
+
}
|
|
167
|
+
snap(ray, point, metaData) {
|
|
168
|
+
if (this.enabled === false)
|
|
169
|
+
return;
|
|
170
|
+
if (__classPrivateFieldGet(this, _PlaneRestriction_cameraId, "f") !== __classPrivateFieldGet(this, _PlaneRestriction_viewport, "f").camera.id)
|
|
171
|
+
this.updatePlaneDefinition();
|
|
172
|
+
const sortedSnapRestrictions = Object.values(__classPrivateFieldGet(this, _PlaneRestriction_snapRestrictions, "f")).sort((a, b) => b.priority - a.priority);
|
|
173
|
+
// group snap restrictions by priority
|
|
174
|
+
const groupedSnapRestrictions = {};
|
|
175
|
+
for (const snapRestriction of sortedSnapRestrictions) {
|
|
176
|
+
if (!groupedSnapRestrictions[snapRestriction.priority])
|
|
177
|
+
groupedSnapRestrictions[snapRestriction.priority] = [];
|
|
178
|
+
groupedSnapRestrictions[snapRestriction.priority].push(snapRestriction);
|
|
179
|
+
}
|
|
180
|
+
// call snap method for each group
|
|
181
|
+
for (const snapRestrictions of Object.values(groupedSnapRestrictions)) {
|
|
182
|
+
const results = [];
|
|
183
|
+
for (const snapRestriction of snapRestrictions) {
|
|
184
|
+
results.push(snapRestriction.snap(ray, point, metaData));
|
|
185
|
+
}
|
|
186
|
+
const indexedResults = results.map((value, index) => ({ index, value }));
|
|
187
|
+
// find the result that is closest to the point and set the snap restriction to active
|
|
188
|
+
indexedResults.sort((a, b) => {
|
|
189
|
+
if (!a.value)
|
|
190
|
+
return 1;
|
|
191
|
+
if (!b.value)
|
|
192
|
+
return -1;
|
|
193
|
+
return gl_matrix_1.vec3.squaredDistance(point, a.value.point) - gl_matrix_1.vec3.squaredDistance(point, b.value.point);
|
|
194
|
+
});
|
|
195
|
+
for (const snapRestriction of snapRestrictions) {
|
|
196
|
+
snapRestriction.active = false;
|
|
197
|
+
}
|
|
198
|
+
// if a snap restriction returned a result, return it
|
|
199
|
+
if (indexedResults[0].value !== undefined) {
|
|
200
|
+
snapRestrictions[indexedResults[0].index].active = true;
|
|
201
|
+
return indexedResults[0].value;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
point: point,
|
|
206
|
+
closestPointOnRay: point,
|
|
207
|
+
restriction: this
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
updatePlaneDefinition() {
|
|
211
|
+
const camera = __classPrivateFieldGet(this, _PlaneRestriction_viewport, "f").camera;
|
|
212
|
+
__classPrivateFieldSet(this, _PlaneRestriction_cameraId, camera.id, "f");
|
|
213
|
+
const origin = __classPrivateFieldGet(this, _PlaneRestriction_properties, "f").origin ? gl_matrix_1.vec3.clone(__classPrivateFieldGet(this, _PlaneRestriction_properties, "f").origin) : gl_matrix_1.vec3.fromValues(0, 0, 0);
|
|
214
|
+
const vectorU = __classPrivateFieldGet(this, _PlaneRestriction_properties, "f").vector_u ? gl_matrix_1.vec3.clone(__classPrivateFieldGet(this, _PlaneRestriction_properties, "f").vector_u) : undefined;
|
|
215
|
+
const vectorV = __classPrivateFieldGet(this, _PlaneRestriction_properties, "f").vector_v ? gl_matrix_1.vec3.clone(__classPrivateFieldGet(this, _PlaneRestriction_properties, "f").vector_v) : undefined;
|
|
216
|
+
const planeDefined = origin && vectorU && vectorV;
|
|
217
|
+
let normal = gl_matrix_1.vec3.fromValues(0, 0, 1);
|
|
218
|
+
if (planeDefined) {
|
|
219
|
+
gl_matrix_1.vec3.normalize(vectorU, vectorU);
|
|
220
|
+
gl_matrix_1.vec3.normalize(vectorV, vectorV);
|
|
221
|
+
normal = gl_matrix_1.vec3.normalize(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), vectorU, vectorV));
|
|
222
|
+
if (gl_matrix_1.vec3.dot(vectorU, vectorV) !== 0)
|
|
223
|
+
gl_matrix_1.vec3.normalize(vectorV, gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), normal, vectorU));
|
|
224
|
+
if (camera.type === viewer_1.CAMERA_TYPE.ORTHOGRAPHIC) {
|
|
225
|
+
const cameraApi = camera;
|
|
226
|
+
const cameraDirection = gl_matrix_1.vec3.normalize(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), cameraApi.target, cameraApi.position));
|
|
227
|
+
// if the dot product of the camera direction and the normal tells us that they are parallel
|
|
228
|
+
// the plane is perpendicular to the camera direction
|
|
229
|
+
if (Math.abs(gl_matrix_1.vec3.dot(cameraDirection, normal)) < 0.0001) {
|
|
230
|
+
this.createDefaultPlane(camera);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
__classPrivateFieldSet(this, _PlaneRestriction_vectorU, vectorU, "f");
|
|
234
|
+
__classPrivateFieldSet(this, _PlaneRestriction_vectorV, vectorV, "f");
|
|
235
|
+
__classPrivateFieldSet(this, _PlaneRestriction_normal, normal, "f");
|
|
236
|
+
__classPrivateFieldSet(this, _PlaneRestriction_origin, origin, "f");
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
__classPrivateFieldSet(this, _PlaneRestriction_vectorU, vectorU, "f");
|
|
241
|
+
__classPrivateFieldSet(this, _PlaneRestriction_vectorV, vectorV, "f");
|
|
242
|
+
__classPrivateFieldSet(this, _PlaneRestriction_normal, normal, "f");
|
|
243
|
+
__classPrivateFieldSet(this, _PlaneRestriction_origin, origin, "f");
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
this.createDefaultPlane(camera);
|
|
248
|
+
}
|
|
249
|
+
__classPrivateFieldSet(this, _PlaneRestriction_plane, new viewer_shared_math_1.Plane().setFromNormalAndCoplanarPoint(__classPrivateFieldGet(this, _PlaneRestriction_normal, "f"), __classPrivateFieldGet(this, _PlaneRestriction_origin, "f")), "f");
|
|
250
|
+
this.createTransformationMatrices();
|
|
251
|
+
__classPrivateFieldGet(this, _PlaneRestriction_gridRestriction, "f").updatePlaneDefinition();
|
|
252
|
+
__classPrivateFieldGet(this, _PlaneRestriction_angularRestriction, "f").updatePlaneDefinition();
|
|
253
|
+
__classPrivateFieldGet(this, _PlaneRestriction_axisRestriction, "f").updatePlaneDefinition();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
exports.PlaneRestriction = PlaneRestriction;
|
|
257
|
+
_PlaneRestriction_properties = new WeakMap(), _PlaneRestriction_viewport = new WeakMap(), _PlaneRestriction_angularRestriction = new WeakMap(), _PlaneRestriction_axisRestriction = new WeakMap(), _PlaneRestriction_cameraId = new WeakMap(), _PlaneRestriction_gridRestriction = new WeakMap(), _PlaneRestriction_normal = new WeakMap(), _PlaneRestriction_origin = new WeakMap(), _PlaneRestriction_plane = new WeakMap(), _PlaneRestriction_snapRestrictions = new WeakMap(), _PlaneRestriction_transformationFromXYPlaneMatrix = new WeakMap(), _PlaneRestriction_transformationToXYPlaneMatrix = new WeakMap(), _PlaneRestriction_vectorU = new WeakMap(), _PlaneRestriction_vectorV = new WeakMap();
|
|
258
|
+
// #endregion Classes (1)
|
|
259
|
+
//# sourceMappingURL=PlaneRestriction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlaneRestriction.js","sourceRoot":"","sources":["../../../../src/implementation/restrictions/plane/PlaneRestriction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAA6D;AAC7D,kEAA6F;AAC7F,4DAAoF;AACpF,+CAO4B;AAE5B,4DAAoF;AACpF,uEAA+D;AAE/D,mEAO0C;AAG1C,yCAAuC;AAwCvC,8BAA8B;AAE9B,sBAAsB;AAEtB,MAAa,gBAAiB,SAAQ,yCAAmB;IAmBrD,6BAA6B;IAE7B,2BAA2B;IAE3B,YAAY,QAAsB,EAAE,mBAAwC,EAAE,UAAqB,EAAE,EAAU,EAAE,QAAgC,EAAE,UAAsC;QACrL,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;QAvBhD,0BAA0B;QAE1B,+CAAiD;QACjD,6CAAiC;QAEjC,uDAAwC;QACxC,oDAAkC;QAClC,qCAAoB,EAAE,EAAC;QACvB,oDAAkC;QA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EpF,IAAI,CAAC,4BAA4B,EAAE,CAAC;QACpC,uBAAA,IAAI,yCAAiB,CAAC,qBAAqB,EAAE,CAAC;QAC9C,uBAAA,IAAI,4CAAoB,CAAC,qBAAqB,EAAE,CAAC;QACjD,uBAAA,IAAI,yCAAiB,CAAC,qBAAqB,EAAE,CAAC;IAClD,CAAC;CAGJ;AAjSD,4CAiSC;;AAED,yBAAyB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AbstractSnapRestriction } from '../../AbstractSnapRestriction';
|
|
2
|
+
import { GeometryMathManager } from '../../../GeometryMathManager';
|
|
3
|
+
import { IRay } from '@shapediver/viewer.rendering-engine.intersection-engine';
|
|
4
|
+
import { RestrictionMetaData, RestrictionResult } from '../../../../interfaces/IRestriction';
|
|
5
|
+
import { ISnapRestriction, SnapRestrictionProperties } from '../../../../interfaces/ISnapRestriction';
|
|
6
|
+
import { ITreeNode, IViewportApi } from '@shapediver/viewer';
|
|
7
|
+
import { IVisualizationSettings } from '../../../../interfaces/IVisualizationSettings';
|
|
8
|
+
import { PlaneRestriction } from '../PlaneRestriction';
|
|
9
|
+
import { vec3 } from 'gl-matrix';
|
|
10
|
+
export declare type AngularRestrictionProperties = {
|
|
11
|
+
/**
|
|
12
|
+
* Step size for the angles
|
|
13
|
+
*/
|
|
14
|
+
angleStep?: number;
|
|
15
|
+
/**
|
|
16
|
+
* If the angle step is editable for change to the end user.
|
|
17
|
+
* If it is not editable, the angle step cannot be changed from the default value.
|
|
18
|
+
*/
|
|
19
|
+
angleStepEditable?: boolean;
|
|
20
|
+
} & SnapRestrictionProperties;
|
|
21
|
+
export declare class AngularRestriction extends AbstractSnapRestriction implements ISnapRestriction {
|
|
22
|
+
#private;
|
|
23
|
+
constructor(viewport: IViewportApi, geometryMathManager: GeometryMathManager, parentNode: ITreeNode, planeRestriction: PlaneRestriction, settings: IVisualizationSettings, properties?: AngularRestrictionProperties);
|
|
24
|
+
get active(): boolean;
|
|
25
|
+
set active(value: boolean);
|
|
26
|
+
get angleStep(): number;
|
|
27
|
+
set angleStep(value: number);
|
|
28
|
+
get angleStepEditable(): boolean;
|
|
29
|
+
get enabledEditable(): boolean;
|
|
30
|
+
get priority(): number;
|
|
31
|
+
set priority(value: number);
|
|
32
|
+
snap(ray: IRay, point: vec3, metaData?: RestrictionMetaData): RestrictionResult | undefined;
|
|
33
|
+
updatePlaneDefinition(): void;
|
|
34
|
+
protected visibilityChanged(visible: boolean): void;
|
|
35
|
+
private calculateAngles;
|
|
36
|
+
private createGrid;
|
|
37
|
+
private getAngularDifference;
|
|
38
|
+
private getNextIndex;
|
|
39
|
+
private getPreviousIndex;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=AngularRestriction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AngularRestriction.d.ts","sourceRoot":"","sources":["../../../../../src/implementation/restrictions/plane/snap/AngularRestriction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,yDAAyD,CAAC;AAC/E,OAAO,EAAwB,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACnH,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACtG,OAAO,EAAE,SAAS,EAAE,YAAY,EAAa,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,oBAAY,4BAA4B,GAAG;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAA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