@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.
Files changed (131) hide show
  1. package/LICENSE +73 -0
  2. package/README.md +3 -0
  3. package/dist/api/implementation/AbstractRestrictionApi.d.ts +10 -0
  4. package/dist/api/implementation/AbstractRestrictionApi.d.ts.map +1 -0
  5. package/dist/api/implementation/AbstractRestrictionApi.js +38 -0
  6. package/dist/api/implementation/AbstractRestrictionApi.js.map +1 -0
  7. package/dist/api/implementation/AbstractSnapRestrictionApi.d.ts +13 -0
  8. package/dist/api/implementation/AbstractSnapRestrictionApi.d.ts.map +1 -0
  9. package/dist/api/implementation/AbstractSnapRestrictionApi.js +47 -0
  10. package/dist/api/implementation/AbstractSnapRestrictionApi.js.map +1 -0
  11. package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.d.ts +7 -0
  12. package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.d.ts.map +1 -0
  13. package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.js +24 -0
  14. package/dist/api/implementation/camera_plane/CameraPlaneRestrictionApi.js.map +1 -0
  15. package/dist/api/implementation/geometry/GeometryRestrictionApi.d.ts +15 -0
  16. package/dist/api/implementation/geometry/GeometryRestrictionApi.d.ts.map +1 -0
  17. package/dist/api/implementation/geometry/GeometryRestrictionApi.js +54 -0
  18. package/dist/api/implementation/geometry/GeometryRestrictionApi.js.map +1 -0
  19. package/dist/api/implementation/line/LineRestrictionApi.d.ts +11 -0
  20. package/dist/api/implementation/line/LineRestrictionApi.d.ts.map +1 -0
  21. package/dist/api/implementation/line/LineRestrictionApi.js +40 -0
  22. package/dist/api/implementation/line/LineRestrictionApi.js.map +1 -0
  23. package/dist/api/implementation/plane/PlaneRestrictionApi.d.ts +20 -0
  24. package/dist/api/implementation/plane/PlaneRestrictionApi.d.ts.map +1 -0
  25. package/dist/api/implementation/plane/PlaneRestrictionApi.js +67 -0
  26. package/dist/api/implementation/plane/PlaneRestrictionApi.js.map +1 -0
  27. package/dist/api/implementation/plane/snap/AngularRestrictionApi.d.ts +10 -0
  28. package/dist/api/implementation/plane/snap/AngularRestrictionApi.d.ts.map +1 -0
  29. package/dist/api/implementation/plane/snap/AngularRestrictionApi.js +40 -0
  30. package/dist/api/implementation/plane/snap/AngularRestrictionApi.js.map +1 -0
  31. package/dist/api/implementation/plane/snap/AxisRestrictionApi.d.ts +7 -0
  32. package/dist/api/implementation/plane/snap/AxisRestrictionApi.d.ts.map +1 -0
  33. package/dist/api/implementation/plane/snap/AxisRestrictionApi.js +24 -0
  34. package/dist/api/implementation/plane/snap/AxisRestrictionApi.js.map +1 -0
  35. package/dist/api/implementation/plane/snap/GridRestrictionApi.d.ts +10 -0
  36. package/dist/api/implementation/plane/snap/GridRestrictionApi.d.ts.map +1 -0
  37. package/dist/api/implementation/plane/snap/GridRestrictionApi.js +40 -0
  38. package/dist/api/implementation/plane/snap/GridRestrictionApi.js.map +1 -0
  39. package/dist/api/implementation/point/PointRestrictionApi.d.ts +10 -0
  40. package/dist/api/implementation/point/PointRestrictionApi.d.ts.map +1 -0
  41. package/dist/api/implementation/point/PointRestrictionApi.js +37 -0
  42. package/dist/api/implementation/point/PointRestrictionApi.js.map +1 -0
  43. package/dist/api/interfaces/IRestrictionApi.d.ts +11 -0
  44. package/dist/api/interfaces/IRestrictionApi.d.ts.map +1 -0
  45. package/dist/api/interfaces/IRestrictionApi.js +3 -0
  46. package/dist/api/interfaces/IRestrictionApi.js.map +1 -0
  47. package/dist/api/interfaces/ISnapRestrictionApi.d.ts +13 -0
  48. package/dist/api/interfaces/ISnapRestrictionApi.d.ts.map +1 -0
  49. package/dist/api/interfaces/ISnapRestrictionApi.js +3 -0
  50. package/dist/api/interfaces/ISnapRestrictionApi.js.map +1 -0
  51. package/dist/implementation/EventManager.d.ts +26 -0
  52. package/dist/implementation/EventManager.d.ts.map +1 -0
  53. package/dist/implementation/EventManager.js +63 -0
  54. package/dist/implementation/EventManager.js.map +1 -0
  55. package/dist/implementation/GeometryMathManager.d.ts +82 -0
  56. package/dist/implementation/GeometryMathManager.d.ts.map +1 -0
  57. package/dist/implementation/GeometryMathManager.js +240 -0
  58. package/dist/implementation/GeometryMathManager.js.map +1 -0
  59. package/dist/implementation/RestrictionManager.d.ts +29 -0
  60. package/dist/implementation/RestrictionManager.d.ts.map +1 -0
  61. package/dist/implementation/RestrictionManager.js +220 -0
  62. package/dist/implementation/RestrictionManager.js.map +1 -0
  63. package/dist/implementation/restrictions/AbstractRestriction.d.ts +42 -0
  64. package/dist/implementation/restrictions/AbstractRestriction.d.ts.map +1 -0
  65. package/dist/implementation/restrictions/AbstractRestriction.js +130 -0
  66. package/dist/implementation/restrictions/AbstractRestriction.js.map +1 -0
  67. package/dist/implementation/restrictions/AbstractSnapRestriction.d.ts +32 -0
  68. package/dist/implementation/restrictions/AbstractSnapRestriction.d.ts.map +1 -0
  69. package/dist/implementation/restrictions/AbstractSnapRestriction.js +125 -0
  70. package/dist/implementation/restrictions/AbstractSnapRestriction.js.map +1 -0
  71. package/dist/implementation/restrictions/RestrictionsHelper.d.ts +11 -0
  72. package/dist/implementation/restrictions/RestrictionsHelper.d.ts.map +1 -0
  73. package/dist/implementation/restrictions/RestrictionsHelper.js +47 -0
  74. package/dist/implementation/restrictions/RestrictionsHelper.js.map +1 -0
  75. package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.d.ts +19 -0
  76. package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.d.ts.map +1 -0
  77. package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js +64 -0
  78. package/dist/implementation/restrictions/camera_plane/CameraPlaneRestriction.js.map +1 -0
  79. package/dist/implementation/restrictions/geometry/GeometryRestriction.d.ts +41 -0
  80. package/dist/implementation/restrictions/geometry/GeometryRestriction.d.ts.map +1 -0
  81. package/dist/implementation/restrictions/geometry/GeometryRestriction.js +259 -0
  82. package/dist/implementation/restrictions/geometry/GeometryRestriction.js.map +1 -0
  83. package/dist/implementation/restrictions/line/LineRestriction.d.ts +28 -0
  84. package/dist/implementation/restrictions/line/LineRestriction.d.ts.map +1 -0
  85. package/dist/implementation/restrictions/line/LineRestriction.js +104 -0
  86. package/dist/implementation/restrictions/line/LineRestriction.js.map +1 -0
  87. package/dist/implementation/restrictions/plane/PlaneRestriction.d.ts +68 -0
  88. package/dist/implementation/restrictions/plane/PlaneRestriction.d.ts.map +1 -0
  89. package/dist/implementation/restrictions/plane/PlaneRestriction.js +259 -0
  90. package/dist/implementation/restrictions/plane/PlaneRestriction.js.map +1 -0
  91. package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts +41 -0
  92. package/dist/implementation/restrictions/plane/snap/AngularRestriction.d.ts.map +1 -0
  93. package/dist/implementation/restrictions/plane/snap/AngularRestriction.js +321 -0
  94. package/dist/implementation/restrictions/plane/snap/AngularRestriction.js.map +1 -0
  95. package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts +28 -0
  96. package/dist/implementation/restrictions/plane/snap/AxisRestriction.d.ts.map +1 -0
  97. package/dist/implementation/restrictions/plane/snap/AxisRestriction.js +172 -0
  98. package/dist/implementation/restrictions/plane/snap/AxisRestriction.js.map +1 -0
  99. package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts +40 -0
  100. package/dist/implementation/restrictions/plane/snap/GridRestriction.d.ts.map +1 -0
  101. package/dist/implementation/restrictions/plane/snap/GridRestriction.js +211 -0
  102. package/dist/implementation/restrictions/plane/snap/GridRestriction.js.map +1 -0
  103. package/dist/implementation/restrictions/point/PointRestriction.d.ts +25 -0
  104. package/dist/implementation/restrictions/point/PointRestriction.d.ts.map +1 -0
  105. package/dist/implementation/restrictions/point/PointRestriction.js +78 -0
  106. package/dist/implementation/restrictions/point/PointRestriction.js.map +1 -0
  107. package/dist/index.d.ts +30 -0
  108. package/dist/index.d.ts.map +1 -0
  109. package/dist/index.js +38 -0
  110. package/dist/index.js.map +1 -0
  111. package/dist/interfaces/IDragAnchor.d.ts +9 -0
  112. package/dist/interfaces/IDragAnchor.d.ts.map +1 -0
  113. package/dist/interfaces/IDragAnchor.js +3 -0
  114. package/dist/interfaces/IDragAnchor.js.map +1 -0
  115. package/dist/interfaces/IRestriction.d.ts +89 -0
  116. package/dist/interfaces/IRestriction.d.ts.map +1 -0
  117. package/dist/interfaces/IRestriction.js +25 -0
  118. package/dist/interfaces/IRestriction.js.map +1 -0
  119. package/dist/interfaces/IRestrictionManager.d.ts +14 -0
  120. package/dist/interfaces/IRestrictionManager.d.ts.map +1 -0
  121. package/dist/interfaces/IRestrictionManager.js +3 -0
  122. package/dist/interfaces/IRestrictionManager.js.map +1 -0
  123. package/dist/interfaces/ISnapRestriction.d.ts +67 -0
  124. package/dist/interfaces/ISnapRestriction.d.ts.map +1 -0
  125. package/dist/interfaces/ISnapRestriction.js +4 -0
  126. package/dist/interfaces/ISnapRestriction.js.map +1 -0
  127. package/dist/interfaces/IVisualizationSettings.d.ts +33 -0
  128. package/dist/interfaces/IVisualizationSettings.d.ts.map +1 -0
  129. package/dist/interfaces/IVisualizationSettings.js +3 -0
  130. package/dist/interfaces/IVisualizationSettings.js.map +1 -0
  131. package/package.json +54 -0
@@ -0,0 +1,321 @@
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 _AngularRestriction_activationKey, _AngularRestriction_geometryMathManager, _AngularRestriction_planeRestriction, _AngularRestriction_active, _AngularRestriction_activePolarGrids, _AngularRestriction_angleStep, _AngularRestriction_angleStepEditable, _AngularRestriction_angles, _AngularRestriction_labelNext, _AngularRestriction_labelPrevious, _AngularRestriction_priority, _AngularRestriction_settings;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AngularRestriction = void 0;
16
+ const AbstractSnapRestriction_1 = require("../../AbstractSnapRestriction");
17
+ const viewer_rendering_engine_rendering_engine_threejs_1 = require("@shapediver/viewer.rendering-engine.rendering-engine-threejs");
18
+ const IRestriction_1 = require("../../../../interfaces/IRestriction");
19
+ const viewer_1 = require("@shapediver/viewer");
20
+ const viewer_shared_services_1 = require("@shapediver/viewer.shared.services");
21
+ const gl_matrix_1 = require("gl-matrix");
22
+ // #endregion Type aliases (1)
23
+ // #region Classes (1)
24
+ class AngularRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction {
25
+ // #endregion Properties (12)
26
+ // #region Constructors (1)
27
+ constructor(viewport, geometryMathManager, parentNode, planeRestriction, settings, properties) {
28
+ var _a, _b, _c;
29
+ super(viewport, parentNode, 'angular');
30
+ // #region Properties (12)
31
+ _AngularRestriction_activationKey.set(this, void 0);
32
+ _AngularRestriction_geometryMathManager.set(this, void 0);
33
+ _AngularRestriction_planeRestriction.set(this, void 0);
34
+ _AngularRestriction_active.set(this, false);
35
+ _AngularRestriction_activePolarGrids.set(this, {
36
+ next: false,
37
+ previous: false
38
+ });
39
+ _AngularRestriction_angleStep.set(this, void 0);
40
+ _AngularRestriction_angleStepEditable.set(this, true);
41
+ _AngularRestriction_angles.set(this, []);
42
+ _AngularRestriction_labelNext.set(this, void 0);
43
+ _AngularRestriction_labelPrevious.set(this, void 0);
44
+ _AngularRestriction_priority.set(this, 0);
45
+ _AngularRestriction_settings.set(this, void 0);
46
+ __classPrivateFieldSet(this, _AngularRestriction_geometryMathManager, geometryMathManager, "f");
47
+ __classPrivateFieldSet(this, _AngularRestriction_settings, settings, "f");
48
+ __classPrivateFieldSet(this, _AngularRestriction_planeRestriction, planeRestriction, "f");
49
+ __classPrivateFieldSet(this, _AngularRestriction_activationKey, (properties === null || properties === void 0 ? void 0 : properties.activationKey) || 'a', "f");
50
+ this.enabled = (_a = properties === null || properties === void 0 ? void 0 : properties.enabled) !== null && _a !== void 0 ? _a : false;
51
+ this._enabledEditable = (_b = properties === null || properties === void 0 ? void 0 : properties.enabledEditable) !== null && _b !== void 0 ? _b : true;
52
+ __classPrivateFieldSet(this, _AngularRestriction_angleStep, (properties === null || properties === void 0 ? void 0 : properties.angleStep) || Math.PI / 12, "f");
53
+ __classPrivateFieldSet(this, _AngularRestriction_angleStepEditable, (_c = properties === null || properties === void 0 ? void 0 : properties.angleStepEditable) !== null && _c !== void 0 ? _c : true, "f");
54
+ __classPrivateFieldSet(this, _AngularRestriction_priority, (properties === null || properties === void 0 ? void 0 : properties.priority) || 0, "f");
55
+ // calculate the angles
56
+ this.calculateAngles();
57
+ }
58
+ // #endregion Constructors (1)
59
+ // #region Public Getters And Setters (8)
60
+ get active() {
61
+ return __classPrivateFieldGet(this, _AngularRestriction_active, "f");
62
+ }
63
+ set active(value) {
64
+ __classPrivateFieldSet(this, _AngularRestriction_active, value, "f");
65
+ if (value === false) {
66
+ if (__classPrivateFieldGet(this, _AngularRestriction_labelNext, "f"))
67
+ __classPrivateFieldGet(this, _AngularRestriction_labelNext, "f").visible = false;
68
+ if (__classPrivateFieldGet(this, _AngularRestriction_labelPrevious, "f"))
69
+ __classPrivateFieldGet(this, _AngularRestriction_labelPrevious, "f").visible = false;
70
+ }
71
+ else {
72
+ if (__classPrivateFieldGet(this, _AngularRestriction_labelNext, "f") && __classPrivateFieldGet(this, _AngularRestriction_activePolarGrids, "f").next)
73
+ __classPrivateFieldGet(this, _AngularRestriction_labelNext, "f").visible = true;
74
+ if (__classPrivateFieldGet(this, _AngularRestriction_labelPrevious, "f") && __classPrivateFieldGet(this, _AngularRestriction_activePolarGrids, "f").previous)
75
+ __classPrivateFieldGet(this, _AngularRestriction_labelPrevious, "f").visible = true;
76
+ }
77
+ }
78
+ get angleStep() {
79
+ return __classPrivateFieldGet(this, _AngularRestriction_angleStep, "f");
80
+ }
81
+ set angleStep(value) {
82
+ if (__classPrivateFieldGet(this, _AngularRestriction_angleStepEditable, "f") === false)
83
+ return;
84
+ __classPrivateFieldSet(this, _AngularRestriction_angleStep, value, "f");
85
+ this.calculateAngles();
86
+ }
87
+ get angleStepEditable() {
88
+ return __classPrivateFieldGet(this, _AngularRestriction_angleStepEditable, "f");
89
+ }
90
+ get enabledEditable() {
91
+ return this._enabledEditable;
92
+ }
93
+ get priority() {
94
+ return __classPrivateFieldGet(this, _AngularRestriction_priority, "f");
95
+ }
96
+ set priority(value) {
97
+ __classPrivateFieldSet(this, _AngularRestriction_priority, value, "f");
98
+ }
99
+ // #endregion Public Getters And Setters (8)
100
+ // #region Public Methods (2)
101
+ snap(ray, point, metaData) {
102
+ var _a;
103
+ if (!(0, IRestriction_1.isDrawingRestriction)(metaData))
104
+ return;
105
+ // if the restriction is not enabled OR the activation key is set and the key is not pressed, return
106
+ if (this.enabled === false && !(((_a = metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys) === null || _a === void 0 ? void 0 : _a.length) === 1 && (metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys[0]) === __classPrivateFieldGet(this, _AngularRestriction_activationKey, "f")))
107
+ return;
108
+ if (__classPrivateFieldGet(this, _AngularRestriction_labelNext, "f"))
109
+ __classPrivateFieldGet(this, _AngularRestriction_labelNext, "f").visible = false;
110
+ if (__classPrivateFieldGet(this, _AngularRestriction_labelPrevious, "f"))
111
+ __classPrivateFieldGet(this, _AngularRestriction_labelPrevious, "f").visible = false;
112
+ __classPrivateFieldSet(this, _AngularRestriction_activePolarGrids, {
113
+ next: false,
114
+ previous: false
115
+ }, "f");
116
+ const positionArray = metaData === null || metaData === void 0 ? void 0 : metaData.positionArray;
117
+ if (!positionArray)
118
+ return;
119
+ let previousIndex, nextIndex;
120
+ if (metaData !== undefined && metaData.index !== undefined) {
121
+ previousIndex = this.getPreviousIndex(metaData.index, positionArray);
122
+ nextIndex = this.getNextIndex(metaData.index, positionArray);
123
+ }
124
+ else {
125
+ // if no index was provided, it is a new point
126
+ previousIndex = positionArray.length / 3 - 1;
127
+ nextIndex = 0;
128
+ }
129
+ const previousPreviousIndex = this.getPreviousIndex(previousIndex, positionArray);
130
+ const nextNextIndex = this.getNextIndex(nextIndex, positionArray);
131
+ if (positionArray.length / 3 < 2)
132
+ return;
133
+ /**
134
+ * Explanation of the algorithm:
135
+ * 1. Project the point onto the XY-Plane
136
+ * 2. Find the next point and the previous point
137
+ * 3. Project the next and previous point onto the XY-Plane
138
+ * 4. Calculate the angle between the point and the next and previous point
139
+ * 5. Determine which if the angles are in the range to snap to
140
+ * a. If both are in the range, snap to the intersection of the two lines
141
+ * b. If only one is in the range, snap to the intersection of the line and the plane
142
+ * c. If none is in the range, return
143
+ * 6. Reverse the projection to the original coordinate system
144
+ */
145
+ // get the next and previous point from the position array
146
+ const nextPointFromData = gl_matrix_1.vec3.fromValues(positionArray.at((nextIndex * 3)), positionArray.at((nextIndex * 3) + 1), positionArray.at((nextIndex * 3) + 2));
147
+ const nextNextPointFromData = gl_matrix_1.vec3.fromValues(positionArray.at((nextNextIndex * 3)), positionArray.at((nextNextIndex * 3) + 1), positionArray.at((nextNextIndex * 3) + 2));
148
+ const previousPointFromData = gl_matrix_1.vec3.fromValues(positionArray.at((previousIndex * 3)), positionArray.at((previousIndex * 3) + 1), positionArray.at((previousIndex * 3) + 2));
149
+ const previousPreviousPointFromData = gl_matrix_1.vec3.fromValues(positionArray.at((previousPreviousIndex * 3)), positionArray.at((previousPreviousIndex * 3) + 1), positionArray.at((previousPreviousIndex * 3) + 2));
150
+ // project them onto the same plane as the point
151
+ const nextPointProjected = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), nextPointFromData, gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").normal, gl_matrix_1.vec3.dot(gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), nextPointFromData, point), __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").normal)));
152
+ const nextNextPointProjected = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), nextNextPointFromData, gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").normal, gl_matrix_1.vec3.dot(gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), nextNextPointFromData, point), __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").normal)));
153
+ const previousPointProjected = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), previousPointFromData, gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").normal, gl_matrix_1.vec3.dot(gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), previousPointFromData, point), __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").normal)));
154
+ const previousPreviousPointProjected = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), previousPreviousPointFromData, gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").normal, gl_matrix_1.vec3.dot(gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), previousPreviousPointFromData, point), __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").normal)));
155
+ // project the point onto the XY-Plane
156
+ const pointProjected = gl_matrix_1.vec3.transformMat4(gl_matrix_1.vec3.create(), point, __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").transformationToXYPlaneMatrix);
157
+ gl_matrix_1.vec3.transformMat4(nextPointProjected, nextPointProjected, __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").transformationToXYPlaneMatrix);
158
+ gl_matrix_1.vec3.transformMat4(nextNextPointProjected, nextNextPointProjected, __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").transformationToXYPlaneMatrix);
159
+ gl_matrix_1.vec3.transformMat4(previousPointProjected, previousPointProjected, __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").transformationToXYPlaneMatrix);
160
+ gl_matrix_1.vec3.transformMat4(previousPreviousPointProjected, previousPreviousPointProjected, __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").transformationToXYPlaneMatrix);
161
+ // calculate the angle between the next and previous point and the point to restrict on the axis
162
+ const { angularDifference: angularDifferenceNext, crossProduct: crossProductNext, closestAngle: closestAngleNext } = this.getAngularDifference({ start: nextPointProjected, end: nextNextPointProjected }, { start: nextPointProjected, end: pointProjected });
163
+ const { angularDifference: angularDifferencePrevious, crossProduct: crossProductPrevious, closestAngle: closestAnglePrevious } = this.getAngularDifference({ start: previousPointProjected, end: previousPreviousPointProjected }, { start: previousPointProjected, end: pointProjected });
164
+ // calculate the distances in screen space so we can check how close it is
165
+ const resultPointNextAngle = gl_matrix_1.vec3.rotateZ(gl_matrix_1.vec3.create(), pointProjected, nextPointProjected, crossProductNext[2] < 0 ? -angularDifferenceNext : angularDifferenceNext);
166
+ const screenSpaceDistanceCheckNextAngle = __classPrivateFieldGet(this, _AngularRestriction_geometryMathManager, "f").screenSpaceDistanceCheck(resultPointNextAngle, pointProjected, __classPrivateFieldGet(this, _AngularRestriction_settings, "f").points.size_0 * __classPrivateFieldGet(this, _AngularRestriction_settings, "f").distanceMultiplicationFactor);
167
+ const resultPointPreviousAngle = gl_matrix_1.vec3.rotateZ(gl_matrix_1.vec3.create(), pointProjected, previousPointProjected, crossProductPrevious[2] < 0 ? -angularDifferencePrevious : angularDifferencePrevious);
168
+ const screenSpaceDistanceCheckPreviousAngle = __classPrivateFieldGet(this, _AngularRestriction_geometryMathManager, "f").screenSpaceDistanceCheck(resultPointPreviousAngle, pointProjected, __classPrivateFieldGet(this, _AngularRestriction_settings, "f").points.size_0 * __classPrivateFieldGet(this, _AngularRestriction_settings, "f").distanceMultiplicationFactor);
169
+ if (screenSpaceDistanceCheckNextAngle.check === false && screenSpaceDistanceCheckPreviousAngle.check === false)
170
+ return;
171
+ // snap to clear defined point if both distances are smaller than threshold
172
+ if (positionArray.length > 6 && screenSpaceDistanceCheckNextAngle.check === true && screenSpaceDistanceCheckPreviousAngle.check === true) {
173
+ const rayDirectionNext = gl_matrix_1.vec3.normalize(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), resultPointNextAngle, nextPointProjected));
174
+ const rayDirectionPrevious = gl_matrix_1.vec3.normalize(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), resultPointPreviousAngle, previousPointProjected));
175
+ const crossProduct = gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), rayDirectionNext, rayDirectionPrevious);
176
+ const crossProductLength = gl_matrix_1.vec3.length(crossProduct);
177
+ if (crossProductLength < 0.001) {
178
+ gl_matrix_1.vec3.transformMat4(resultPointNextAngle, resultPointNextAngle, __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").transformationFromXYPlaneMatrix);
179
+ return { point: resultPointNextAngle, restriction: __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f"), snapRestriction: this };
180
+ }
181
+ const t = gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), previousPointProjected, nextPointProjected);
182
+ const u = gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), t, rayDirectionPrevious);
183
+ const v = gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), t, rayDirectionNext);
184
+ const tValue = gl_matrix_1.vec3.dot(u, crossProduct) / Math.pow(crossProductLength, 2);
185
+ const uValue = gl_matrix_1.vec3.dot(v, crossProduct) / Math.pow(crossProductLength, 2);
186
+ if (tValue < 0 || uValue < 0) {
187
+ gl_matrix_1.vec3.transformMat4(resultPointNextAngle, resultPointNextAngle, __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").transformationFromXYPlaneMatrix);
188
+ return { point: resultPointNextAngle, restriction: __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f"), snapRestriction: this };
189
+ }
190
+ const intersection = gl_matrix_1.vec3.add(gl_matrix_1.vec3.create(), nextPointProjected, gl_matrix_1.vec3.scale(gl_matrix_1.vec3.create(), rayDirectionNext, tValue));
191
+ __classPrivateFieldSet(this, _AngularRestriction_labelNext, this.createGrid(__classPrivateFieldGet(this, _AngularRestriction_labelNext, "f"), nextPointFromData, closestAngleNext), "f");
192
+ __classPrivateFieldGet(this, _AngularRestriction_activePolarGrids, "f").next = true;
193
+ __classPrivateFieldSet(this, _AngularRestriction_labelPrevious, this.createGrid(__classPrivateFieldGet(this, _AngularRestriction_labelPrevious, "f"), previousPointFromData, closestAnglePrevious), "f");
194
+ __classPrivateFieldGet(this, _AngularRestriction_activePolarGrids, "f").previous = true;
195
+ // reverse the projection to the original coordinate system
196
+ gl_matrix_1.vec3.transformMat4(intersection, intersection, __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").transformationFromXYPlaneMatrix);
197
+ return { point: intersection, restriction: __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f"), snapRestriction: this };
198
+ }
199
+ // check which distance to the projection is smaller
200
+ if (screenSpaceDistanceCheckNextAngle.distanceSquared < screenSpaceDistanceCheckPreviousAngle.distanceSquared) {
201
+ __classPrivateFieldSet(this, _AngularRestriction_labelNext, this.createGrid(__classPrivateFieldGet(this, _AngularRestriction_labelNext, "f"), nextPointFromData, closestAngleNext), "f");
202
+ __classPrivateFieldGet(this, _AngularRestriction_activePolarGrids, "f").next = true;
203
+ // reverse the projection to the original coordinate system
204
+ gl_matrix_1.vec3.transformMat4(resultPointNextAngle, resultPointNextAngle, __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").transformationFromXYPlaneMatrix);
205
+ return { point: resultPointNextAngle, restriction: __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f"), snapRestriction: this };
206
+ }
207
+ else {
208
+ __classPrivateFieldSet(this, _AngularRestriction_labelPrevious, this.createGrid(__classPrivateFieldGet(this, _AngularRestriction_labelPrevious, "f"), previousPointFromData, closestAnglePrevious), "f");
209
+ __classPrivateFieldGet(this, _AngularRestriction_activePolarGrids, "f").previous = true;
210
+ // reverse the projection to the original coordinate system
211
+ gl_matrix_1.vec3.transformMat4(resultPointPreviousAngle, resultPointPreviousAngle, __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f").transformationFromXYPlaneMatrix);
212
+ return { point: resultPointPreviousAngle, restriction: __classPrivateFieldGet(this, _AngularRestriction_planeRestriction, "f"), snapRestriction: this };
213
+ }
214
+ }
215
+ updatePlaneDefinition() { }
216
+ // #endregion Public Methods (2)
217
+ // #region Protected Methods (1)
218
+ visibilityChanged(visible) {
219
+ if (visible === false) {
220
+ if (__classPrivateFieldGet(this, _AngularRestriction_labelNext, "f"))
221
+ __classPrivateFieldGet(this, _AngularRestriction_labelNext, "f").visible = false;
222
+ if (__classPrivateFieldGet(this, _AngularRestriction_labelPrevious, "f"))
223
+ __classPrivateFieldGet(this, _AngularRestriction_labelPrevious, "f").visible = false;
224
+ }
225
+ }
226
+ // #endregion Protected Methods (1)
227
+ // #region Private Methods (5)
228
+ calculateAngles() {
229
+ __classPrivateFieldSet(this, _AngularRestriction_angles, [], "f");
230
+ for (let i = 0; i <= Math.PI + 0.0001; i += __classPrivateFieldGet(this, _AngularRestriction_angleStep, "f")) {
231
+ __classPrivateFieldGet(this, _AngularRestriction_angles, "f").push(i);
232
+ }
233
+ }
234
+ createGrid(label, position, angle) {
235
+ if (label)
236
+ this._object3D.remove(label);
237
+ let radius = viewer_1.sceneTree.root.boundingBox.boundingSphere.radius / 100;
238
+ if (radius === Infinity)
239
+ radius = 1;
240
+ const text = document.createElement('div');
241
+ text.className = 'label';
242
+ label = new viewer_rendering_engine_rendering_engine_threejs_1.CSS2DObject(text);
243
+ // remove the old style, if there is one
244
+ document.head.querySelectorAll('style').forEach(style => {
245
+ var _a;
246
+ if ((_a = style.textContent) === null || _a === void 0 ? void 0 : _a.includes(label.uuid))
247
+ document.head.removeChild(style);
248
+ });
249
+ const parent = document.createElement('div');
250
+ parent.className = `angular-label-parent-${label.uuid}`;
251
+ const child = document.createElement('div');
252
+ child.className = `angular-label-${label.uuid}`;
253
+ const style = document.createElement('style');
254
+ style.textContent = `
255
+ .angular-label-${label.uuid} {
256
+ display: flex;
257
+ justify-content: center;
258
+ align-items: center;
259
+ width: 32px;
260
+ height: 32px;
261
+ color: white;
262
+ background-color: ${__classPrivateFieldGet(this, _AngularRestriction_settings, "f").points.color_1};
263
+ border-radius: 50%;
264
+ font-size: 16px;
265
+ text-align: center;
266
+ }
267
+
268
+ .angular-label-parent-${label.uuid} {
269
+ display: flex;
270
+ justify-content: center;
271
+ align-items: center;
272
+ width: 40px; /* 32px + 2 * 4px border width */
273
+ height: 40px; /* 32px + 2 * 4px border width */
274
+ border-radius: 50%;
275
+ background: conic-gradient(
276
+ ${__classPrivateFieldGet(this, _AngularRestriction_settings, "f").points.color_2} 0% ${(angle / Math.PI) * 100}%,
277
+ ${__classPrivateFieldGet(this, _AngularRestriction_settings, "f").points.color_1} ${(angle / Math.PI) * 100}% 100%
278
+ );
279
+ }
280
+ `;
281
+ document.head.appendChild(style);
282
+ parent.appendChild(child);
283
+ child.textContent = `${(0, viewer_shared_services_1.numberCleaner)((angle / Math.PI) * 180)}°`;
284
+ text.appendChild(parent);
285
+ label.position.set(position[0], position[1], position[2]);
286
+ label.visible = false;
287
+ this._object3D.add(label);
288
+ return label;
289
+ }
290
+ getAngularDifference(line, referenceLine) {
291
+ const lineDirection = gl_matrix_1.vec3.normalize(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), line.end, line.start));
292
+ const referenceLineDirection = gl_matrix_1.vec3.normalize(gl_matrix_1.vec3.create(), gl_matrix_1.vec3.sub(gl_matrix_1.vec3.create(), referenceLine.end, referenceLine.start));
293
+ // calculate the angle between the lineDirection and the referenceLineDirection
294
+ const angleReference = gl_matrix_1.vec3.angle(lineDirection, referenceLineDirection);
295
+ const crossProduct = gl_matrix_1.vec3.cross(gl_matrix_1.vec3.create(), lineDirection, referenceLineDirection);
296
+ // find the angle that is closest to the angle of the previous point
297
+ let closestAngle = __classPrivateFieldGet(this, _AngularRestriction_angles, "f")[0];
298
+ for (let i = 0; i < __classPrivateFieldGet(this, _AngularRestriction_angles, "f").length; i++) {
299
+ const angle = __classPrivateFieldGet(this, _AngularRestriction_angles, "f")[i];
300
+ if (Math.abs(angleReference - angle) < Math.abs(angleReference - closestAngle))
301
+ closestAngle = angle;
302
+ }
303
+ // move the point to the closest angle
304
+ const angularDifference = closestAngle - angleReference;
305
+ return {
306
+ angularDifference,
307
+ crossProduct,
308
+ closestAngle
309
+ };
310
+ }
311
+ getNextIndex(index, positionArray) {
312
+ return index + 1 > positionArray.length / 3 - 1 ? 0 : index + 1;
313
+ }
314
+ getPreviousIndex(index, positionArray) {
315
+ return index - 1 < 0 ? positionArray.length / 3 - 1 : index - 1;
316
+ }
317
+ }
318
+ exports.AngularRestriction = AngularRestriction;
319
+ _AngularRestriction_activationKey = new WeakMap(), _AngularRestriction_geometryMathManager = new WeakMap(), _AngularRestriction_planeRestriction = new WeakMap(), _AngularRestriction_active = new WeakMap(), _AngularRestriction_activePolarGrids = new WeakMap(), _AngularRestriction_angleStep = new WeakMap(), _AngularRestriction_angleStepEditable = new WeakMap(), _AngularRestriction_angles = new WeakMap(), _AngularRestriction_labelNext = new WeakMap(), _AngularRestriction_labelPrevious = new WeakMap(), _AngularRestriction_priority = new WeakMap(), _AngularRestriction_settings = new WeakMap();
320
+ // #endregion Classes (1)
321
+ //# sourceMappingURL=AngularRestriction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AngularRestriction.js","sourceRoot":"","sources":["../../../../../src/implementation/restrictions/plane/snap/AngularRestriction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2EAAwE;AACxE,mIAA2F;AAG3F,sEAAmH;AAEnH,+CAAwE;AAExE,+EAAmE;AAEnE,yCAAiC;AAiBjC,8BAA8B;AAE9B,sBAAsB;AAEtB,MAAa,kBAAmB,SAAQ,iDAAuB;IAoB3D,6BAA6B;IAE7B,2BAA2B;IAE3B,YAAY,QAAsB,EAAE,mBAAwC,EAAE,UAAqB,EAAE,gBAAkC,EAAE,QAAgC,EAAE,UAAyC;;QAChN,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QAxB3C,0BAA0B;QAE1B,oDAAgC;QAChC,0DAAmD;QACnD,uDAA6C;QAE7C,qCAAmB,KAAK,EAAC;QACzB,+CAAoB;YAChB,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE,KAAK;SAClB,EAAC;QACF,gDAAmB;QACnB,gDAA8B,IAAI,EAAC;QACnC,qCAAoB,EAAE,EAAC;QACvB,gDAAyB;QACzB,oDAA6B;QAC7B,uCAAoB,CAAC,EAAC;QACtB,+CAAkC;QAS9B,uBAAA,IAAI,2CAAwB,mBAAmB,MAAA,CAAC;QAChD,uBAAA,IAAI,gCAAa,QAAQ,MAAA,CAAC;QAE1B,uBAAA,IAAI,wCAAqB,gBAAgB,MAAA,CAAC;QAE1C,uBAAA,IAAI,qCAAkB,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,aAAa,KAAI,GAAG,MAAA,CAAC;QACvD,IAAI,CAAC,OAAO,GAAG,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,mCAAI,KAAK,CAAC;QAC5C,IAAI,CAAC,gBAAgB,GAAG,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,eAAe,mCAAI,IAAI,CA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,GAAG,CAAC,EAAE,CAAC,GAAG,uBAAA,IAAI,kCAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC1C,MAAM,KAAK,GAAG,uBAAA,IAAI,kCAAQ,CAAC,CAAC,CAAC,CAAC;YAE9B,IAAI,IAAI,CAAC,GAAG,CAAC,cAAc,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,GAAG,YAAY,CAAC;gBAC1E,YAAY,GAAG,KAAK,CAAC;SAC5B;QAED,sCAAsC;QACtC,MAAM,iBAAiB,GAAG,YAAY,GAAG,cAAc,CAAC;QAExD,OAAO;YACH,iBAAiB;YACjB,YAAY;YACZ,YAAY;SACf,CAAC;IACN,CAAC;IAEO,YAAY,CAAC,KAAa,EAAE,aAA2B;QAC3D,OAAO,KAAK,GAAG,CAAC,GAAG,aAAa,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;IACpE,CAAC;IAEO,gBAAgB,CAAC,KAAa,EAAE,aAA2B;QAC/D,OAAO,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;IACpE,CAAC;CAGJ;AAxWD,gDAwWC;;AAED,yBAAyB"}
@@ -0,0 +1,28 @@
1
+ import { AbstractSnapRestriction } from '../../AbstractSnapRestriction';
2
+ import { ITreeNode, IViewportApi } from '@shapediver/viewer';
3
+ import { GeometryMathManager } from '../../../GeometryMathManager';
4
+ import { IRay } from '@shapediver/viewer.rendering-engine.intersection-engine';
5
+ import { ISnapRestriction, SnapRestrictionProperties } from '../../../../interfaces/ISnapRestriction';
6
+ import { PlaneRestriction } from '../PlaneRestriction';
7
+ import { RestrictionMetaData, RestrictionResult } from '../../../../interfaces/IRestriction';
8
+ import { vec3 } from 'gl-matrix';
9
+ export declare type AxisRestrictionProperties = {
10
+ activationKeyX?: string;
11
+ activationKeyY?: string;
12
+ activationKeyZ?: string;
13
+ activationKeyPlane?: string;
14
+ } & SnapRestrictionProperties;
15
+ export declare class AxisRestriction extends AbstractSnapRestriction implements ISnapRestriction {
16
+ #private;
17
+ constructor(viewport: IViewportApi, geometryMathManager: GeometryMathManager, parentNode: ITreeNode, planeRestriction: PlaneRestriction, properties?: AxisRestrictionProperties);
18
+ get active(): boolean;
19
+ set active(value: boolean);
20
+ get enabledEditable(): boolean;
21
+ get priority(): number;
22
+ set priority(value: number);
23
+ snap(ray: IRay, point: vec3, metaData?: RestrictionMetaData): RestrictionResult | undefined;
24
+ updatePlaneDefinition(): void;
25
+ protected visibilityChanged(visible: boolean): void;
26
+ private createAxesVisualization;
27
+ }
28
+ //# sourceMappingURL=AxisRestriction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AxisRestriction.d.ts","sourceRoot":"","sources":["../../../../../src/implementation/restrictions/plane/snap/AxisRestriction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAEH,SAAS,EACT,YAAY,EAEf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,yDAAyD,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,oBAAY,yBAAyB,GAAG;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B,GAAG,yBAAyB,CAAC;AAM9B,qBAAa,eAAgB,SAAQ,uBAAwB,YAAW,gBAAgB;;gBAkBxE,QAAQ,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,CAAC,EAAE,yBAAyB;IAoB/K,IAAW,MAAM,IAAI,OAAO,CAE3B;IAED,IAAW,MAAM,CAAC,KAAK,EAAE,OAAO,EAI/B;IAED,IAAW,eAAe,IAAI,OAAO,CAEpC;IAED,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,QAAQ,CAAC,KAAK,EAAE,MAAM,EAEhC;IAMM,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,mBAAmB,GAAG,iBAAiB,GAAG,SAAS;IAkC3F,qBAAqB,IAAI,IAAI;IAQpC,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAYnD,OAAO,CAAC,uBAAuB;CAqClC"}
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
26
+ if (kind === "m") throw new TypeError("Private method is not writable");
27
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
28
+ 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");
29
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
30
+ };
31
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
32
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
33
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
34
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
35
+ };
36
+ var _AxisRestriction_activationKeyPlane, _AxisRestriction_activationKeyX, _AxisRestriction_activationKeyY, _AxisRestriction_activationKeyZ, _AxisRestriction_planeRestriction, _AxisRestriction_active, _AxisRestriction_axesHelper, _AxisRestriction_geometryMathManager, _AxisRestriction_priority;
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.AxisRestriction = void 0;
39
+ const THREE = __importStar(require("three"));
40
+ const AbstractSnapRestriction_1 = require("../../AbstractSnapRestriction");
41
+ const viewer_1 = require("@shapediver/viewer");
42
+ // #endregion Type aliases (1)
43
+ // #region Classes (1)
44
+ class AxisRestriction extends AbstractSnapRestriction_1.AbstractSnapRestriction {
45
+ // #endregion Properties (9)
46
+ // #region Constructors (1)
47
+ constructor(viewport, geometryMathManager, parentNode, planeRestriction, properties) {
48
+ super(viewport, parentNode, 'axis');
49
+ // #region Properties (9)
50
+ _AxisRestriction_activationKeyPlane.set(this, void 0);
51
+ _AxisRestriction_activationKeyX.set(this, void 0);
52
+ _AxisRestriction_activationKeyY.set(this, void 0);
53
+ _AxisRestriction_activationKeyZ.set(this, void 0);
54
+ _AxisRestriction_planeRestriction.set(this, void 0);
55
+ _AxisRestriction_active.set(this, false);
56
+ _AxisRestriction_axesHelper.set(this, void 0);
57
+ _AxisRestriction_geometryMathManager.set(this, void 0);
58
+ _AxisRestriction_priority.set(this, 0);
59
+ __classPrivateFieldSet(this, _AxisRestriction_planeRestriction, planeRestriction, "f");
60
+ __classPrivateFieldSet(this, _AxisRestriction_geometryMathManager, geometryMathManager, "f");
61
+ __classPrivateFieldSet(this, _AxisRestriction_activationKeyX, (properties === null || properties === void 0 ? void 0 : properties.activationKeyX) || 'x', "f");
62
+ __classPrivateFieldSet(this, _AxisRestriction_activationKeyY, (properties === null || properties === void 0 ? void 0 : properties.activationKeyY) || 'y', "f");
63
+ __classPrivateFieldSet(this, _AxisRestriction_activationKeyZ, (properties === null || properties === void 0 ? void 0 : properties.activationKeyZ) || 'z', "f");
64
+ __classPrivateFieldSet(this, _AxisRestriction_activationKeyPlane, (properties === null || properties === void 0 ? void 0 : properties.activationKeyPlane) || 'p', "f");
65
+ __classPrivateFieldSet(this, _AxisRestriction_priority, (properties === null || properties === void 0 ? void 0 : properties.priority) || 1, "f");
66
+ // create the axes visualization
67
+ this.createAxesVisualization();
68
+ }
69
+ // #endregion Constructors (1)
70
+ // #region Public Getters And Setters (5)
71
+ get active() {
72
+ return __classPrivateFieldGet(this, _AxisRestriction_active, "f");
73
+ }
74
+ set active(value) {
75
+ __classPrivateFieldSet(this, _AxisRestriction_active, value, "f");
76
+ if (__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f"))
77
+ __classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").visible = value;
78
+ }
79
+ get enabledEditable() {
80
+ return this._enabledEditable;
81
+ }
82
+ get priority() {
83
+ return __classPrivateFieldGet(this, _AxisRestriction_priority, "f");
84
+ }
85
+ set priority(value) {
86
+ __classPrivateFieldSet(this, _AxisRestriction_priority, value, "f");
87
+ }
88
+ // #endregion Public Getters And Setters (5)
89
+ // #region Public Methods (2)
90
+ snap(ray, point, metaData) {
91
+ var _a, _b, _c, _d;
92
+ if (this.enabled === false)
93
+ return;
94
+ if (!metaData || !metaData.startPoint)
95
+ return;
96
+ const xPressed = (((_a = metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys) === null || _a === void 0 ? void 0 : _a.length) === 1 && (metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys[0]) === __classPrivateFieldGet(this, _AxisRestriction_activationKeyX, "f"));
97
+ const yPressed = (((_b = metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys) === null || _b === void 0 ? void 0 : _b.length) === 1 && (metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys[0]) === __classPrivateFieldGet(this, _AxisRestriction_activationKeyY, "f"));
98
+ const zPressed = (((_c = metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys) === null || _c === void 0 ? void 0 : _c.length) === 1 && (metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys[0]) === __classPrivateFieldGet(this, _AxisRestriction_activationKeyZ, "f"));
99
+ const pPressed = (((_d = metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys) === null || _d === void 0 ? void 0 : _d.length) === 1 && (metaData === null || metaData === void 0 ? void 0 : metaData.pressedKeys[0]) === __classPrivateFieldGet(this, _AxisRestriction_activationKeyPlane, "f"));
100
+ // we move the axes helper to the reference point
101
+ if (__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f") && (xPressed || yPressed || zPressed)) {
102
+ __classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").position.copy(new THREE.Vector3(metaData.startPoint[0], metaData.startPoint[1], metaData.startPoint[2]));
103
+ __classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").visible = false;
104
+ }
105
+ if (xPressed) {
106
+ const snappedPoint = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint({ origin: metaData.startPoint, direction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorU }, point);
107
+ const closestPointOnRay = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint(ray, snappedPoint);
108
+ return { point: snappedPoint, closestPointOnRay, restriction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f"), snapRestriction: this };
109
+ }
110
+ else if (yPressed) {
111
+ const snappedPoint = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint({ origin: metaData.startPoint, direction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorV }, point);
112
+ const closestPointOnRay = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint(ray, snappedPoint);
113
+ return { point: snappedPoint, closestPointOnRay, restriction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f"), snapRestriction: this };
114
+ }
115
+ else if (zPressed) {
116
+ const snappedPoint = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPointsRayRay({ origin: metaData.startPoint, direction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").normal }, ray).closestPointOnRay1;
117
+ const closestPointOnRay = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint(ray, snappedPoint);
118
+ return { point: snappedPoint, closestPointOnRay, restriction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f"), snapRestriction: this };
119
+ }
120
+ else if (pPressed) {
121
+ const snappedPoint = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPointOnPlane(__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").origin, __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").normal, point);
122
+ const closestPointOnRay = __classPrivateFieldGet(this, _AxisRestriction_geometryMathManager, "f").closestPoint(ray, snappedPoint);
123
+ return { point: snappedPoint, closestPointOnRay, restriction: __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f"), snapRestriction: this };
124
+ }
125
+ }
126
+ updatePlaneDefinition() {
127
+ this.createAxesVisualization();
128
+ }
129
+ // #endregion Public Methods (2)
130
+ // #region Protected Methods (1)
131
+ visibilityChanged(visible) {
132
+ if (visible === false) {
133
+ if (__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f")) {
134
+ __classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").visible = false;
135
+ }
136
+ }
137
+ }
138
+ // #endregion Protected Methods (1)
139
+ // #region Private Methods (1)
140
+ createAxesVisualization() {
141
+ if (__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f")) {
142
+ this._object3D.remove(__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f"));
143
+ __classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").dispose();
144
+ }
145
+ const bb = new viewer_1.Box();
146
+ for (let i = 0; i < viewer_1.sceneTree.root.children.length; i++) {
147
+ if (viewer_1.sceneTree.root.children[i].sessionNode === true) {
148
+ bb.union(viewer_1.sceneTree.root.children[i].boundingBox);
149
+ }
150
+ }
151
+ const radius = bb.boundingSphere.radius;
152
+ __classPrivateFieldSet(this, _AxisRestriction_axesHelper, new THREE.AxesHelper(radius), "f");
153
+ __classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").position.copy(new THREE.Vector3(__classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").origin[0], __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").origin[1], __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").origin[2]));
154
+ __classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").visible = false;
155
+ __classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").renderOrder = 100;
156
+ __classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").material.depthTest = false;
157
+ __classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").material.transparent = true;
158
+ // three.js uses a right-handed coordinate system, so we need to rotate the axes helper
159
+ const rotationMatrix = new THREE.Matrix4().fromArray([
160
+ __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorU[0], __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorU[1], __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorU[2], 0,
161
+ __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorV[0], __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorV[1], __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").vectorV[2], 0,
162
+ __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").normal[0], __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").normal[1], __classPrivateFieldGet(this, _AxisRestriction_planeRestriction, "f").normal[2], 0,
163
+ 0, 0, 0, 1
164
+ ]);
165
+ __classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f").rotation.setFromRotationMatrix(rotationMatrix);
166
+ this._object3D.add(__classPrivateFieldGet(this, _AxisRestriction_axesHelper, "f"));
167
+ }
168
+ }
169
+ exports.AxisRestriction = AxisRestriction;
170
+ _AxisRestriction_activationKeyPlane = new WeakMap(), _AxisRestriction_activationKeyX = new WeakMap(), _AxisRestriction_activationKeyY = new WeakMap(), _AxisRestriction_activationKeyZ = new WeakMap(), _AxisRestriction_planeRestriction = new WeakMap(), _AxisRestriction_active = new WeakMap(), _AxisRestriction_axesHelper = new WeakMap(), _AxisRestriction_geometryMathManager = new WeakMap(), _AxisRestriction_priority = new WeakMap();
171
+ // #endregion Classes (1)
172
+ //# sourceMappingURL=AxisRestriction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AxisRestriction.js","sourceRoot":"","sources":["../../../../../src/implementation/restrictions/plane/snap/AxisRestriction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,2EAAwE;AACxE,+CA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../../AbstractSnapRestriction';
2
+ import { ITreeNode, IViewportApi } from '@shapediver/viewer';
3
+ import { GeometryMathManager } from '../../../GeometryMathManager';
4
+ import { IRay } from '@shapediver/viewer.rendering-engine.intersection-engine';
5
+ import { RestrictionMetaData, RestrictionResult } from '../../../../interfaces/IRestriction';
6
+ import { ISnapRestriction, SnapRestrictionProperties } from '../../../../interfaces/ISnapRestriction';
7
+ import { PlaneRestriction } from '../PlaneRestriction';
8
+ import { vec3 } from 'gl-matrix';
9
+ /**
10
+ * Properties for the grid restriction
11
+ */
12
+ export declare type GridRestrictionProperties = {
13
+ /**
14
+ * Size of the grid unit
15
+ */
16
+ gridUnit?: number;
17
+ /**
18
+ * If the grid unit is editable for change to the end user.
19
+ * If it is not editable, the grid unit cannot be changed from the default value.
20
+ */
21
+ gridUnitEditable?: boolean;
22
+ } & SnapRestrictionProperties;
23
+ export declare class GridRestriction extends AbstractSnapRestriction implements ISnapRestriction {
24
+ #private;
25
+ constructor(viewport: IViewportApi, geometryMathManager: GeometryMathManager, parentNode: ITreeNode, planeRestriction: PlaneRestriction, properties?: GridRestrictionProperties);
26
+ get active(): boolean;
27
+ set active(value: boolean);
28
+ get enabledEditable(): boolean;
29
+ get gridUnit(): number;
30
+ set gridUnit(value: number);
31
+ get gridUnitEditable(): boolean;
32
+ get priority(): number;
33
+ set priority(value: number);
34
+ snap(ray: IRay, point: vec3, metaData: RestrictionMetaData): RestrictionResult | undefined;
35
+ updatePlaneDefinition(): void;
36
+ protected visibilityChanged(visible: boolean): void;
37
+ private createGridVisualization;
38
+ private createOffsetFromUnit;
39
+ }
40
+ //# sourceMappingURL=GridRestriction.d.ts.map