@fc3/wireframe-renderer 0.0.0-stage → 0.1.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 (264) hide show
  1. package/LICENSE +673 -0
  2. package/README.md +123 -2
  3. package/bin/compile +55 -0
  4. package/bin/install +5 -0
  5. package/bin/lint +12 -0
  6. package/bin/postpublish +5 -0
  7. package/bin/precompile +71 -0
  8. package/bin/prepublish +7 -0
  9. package/bin/remap-paths +172 -0
  10. package/bin/test +9 -0
  11. package/bin/test-one +32 -0
  12. package/dist/.last-compile-time +1 -0
  13. package/dist/.last-publish-time +1 -0
  14. package/dist/src/camera.d.ts +26 -0
  15. package/dist/src/camera.js +90 -0
  16. package/dist/src/camera.js.map +1 -0
  17. package/dist/src/canvas-renderer.d.ts +22 -0
  18. package/dist/src/canvas-renderer.js +183 -0
  19. package/dist/src/canvas-renderer.js.map +1 -0
  20. package/dist/src/constant/axis-colors.d.ts +3 -0
  21. package/dist/src/constant/axis-colors.js +13 -0
  22. package/dist/src/constant/axis-colors.js.map +1 -0
  23. package/dist/src/constant/box-edge-index-pairs.d.ts +2 -0
  24. package/dist/src/constant/box-edge-index-pairs.js +18 -0
  25. package/dist/src/constant/box-edge-index-pairs.js.map +1 -0
  26. package/dist/src/constant/camera-limits.d.ts +7 -0
  27. package/dist/src/constant/camera-limits.js +10 -0
  28. package/dist/src/constant/camera-limits.js.map +1 -0
  29. package/dist/src/constant/default-camera-state.d.ts +3 -0
  30. package/dist/src/constant/default-camera-state.js +19 -0
  31. package/dist/src/constant/default-camera-state.js.map +1 -0
  32. package/dist/src/constant/default-palette.d.ts +2 -0
  33. package/dist/src/constant/default-palette.js +17 -0
  34. package/dist/src/constant/default-palette.js.map +1 -0
  35. package/dist/src/constant/interaction-rates.d.ts +5 -0
  36. package/dist/src/constant/interaction-rates.js +8 -0
  37. package/dist/src/constant/interaction-rates.js.map +1 -0
  38. package/dist/src/constant/rendering-defaults.d.ts +11 -0
  39. package/dist/src/constant/rendering-defaults.js +14 -0
  40. package/dist/src/constant/rendering-defaults.js.map +1 -0
  41. package/dist/src/constant/stylesheet.d.ts +2 -0
  42. package/dist/src/constant/stylesheet.js +140 -0
  43. package/dist/src/constant/stylesheet.js.map +1 -0
  44. package/dist/src/constant/theme.d.ts +9 -0
  45. package/dist/src/constant/theme.js +12 -0
  46. package/dist/src/constant/theme.js.map +1 -0
  47. package/dist/src/constant/view-orientations.d.ts +4 -0
  48. package/dist/src/constant/view-orientations.js +19 -0
  49. package/dist/src/constant/view-orientations.js.map +1 -0
  50. package/dist/src/enum/axis.d.ts +6 -0
  51. package/dist/src/enum/axis.js +10 -0
  52. package/dist/src/enum/axis.js.map +1 -0
  53. package/dist/src/enum/opening-shape.d.ts +5 -0
  54. package/dist/src/enum/opening-shape.js +9 -0
  55. package/dist/src/enum/opening-shape.js.map +1 -0
  56. package/dist/src/enum/plane.d.ts +6 -0
  57. package/dist/src/enum/plane.js +10 -0
  58. package/dist/src/enum/plane.js.map +1 -0
  59. package/dist/src/enum/primitive-type.d.ts +8 -0
  60. package/dist/src/enum/primitive-type.js +12 -0
  61. package/dist/src/enum/primitive-type.js.map +1 -0
  62. package/dist/src/enum/view-preset.d.ts +10 -0
  63. package/dist/src/enum/view-preset.js +14 -0
  64. package/dist/src/enum/view-preset.js.map +1 -0
  65. package/dist/src/enum/viewer-class-name.d.ts +15 -0
  66. package/dist/src/enum/viewer-class-name.js +19 -0
  67. package/dist/src/enum/viewer-class-name.js.map +1 -0
  68. package/dist/src/example/house-computer.d.ts +3 -0
  69. package/dist/src/example/house-computer.js +2081 -0
  70. package/dist/src/example/house-computer.js.map +1 -0
  71. package/dist/src/index.d.ts +20 -0
  72. package/dist/src/index.js +27 -0
  73. package/dist/src/index.js.map +1 -0
  74. package/dist/src/interaction-controller.d.ts +17 -0
  75. package/dist/src/interaction-controller.js +106 -0
  76. package/dist/src/interaction-controller.js.map +1 -0
  77. package/dist/src/sidebar.d.ts +24 -0
  78. package/dist/src/sidebar.js +121 -0
  79. package/dist/src/sidebar.js.map +1 -0
  80. package/dist/src/type/bounding-box.d.ts +6 -0
  81. package/dist/src/type/bounding-box.js +3 -0
  82. package/dist/src/type/bounding-box.js.map +1 -0
  83. package/dist/src/type/camera-state.d.ts +10 -0
  84. package/dist/src/type/camera-state.js +3 -0
  85. package/dist/src/type/camera-state.js.map +1 -0
  86. package/dist/src/type/display-component.d.ts +18 -0
  87. package/dist/src/type/display-component.js +3 -0
  88. package/dist/src/type/display-component.js.map +1 -0
  89. package/dist/src/type/drag-state.d.ts +6 -0
  90. package/dist/src/type/drag-state.js +3 -0
  91. package/dist/src/type/drag-state.js.map +1 -0
  92. package/dist/src/type/inherited-style.d.ts +8 -0
  93. package/dist/src/type/inherited-style.js +3 -0
  94. package/dist/src/type/inherited-style.js.map +1 -0
  95. package/dist/src/type/plane-axes.d.ts +7 -0
  96. package/dist/src/type/plane-axes.js +3 -0
  97. package/dist/src/type/plane-axes.js.map +1 -0
  98. package/dist/src/type/polyline.d.ts +3 -0
  99. package/dist/src/type/polyline.js +3 -0
  100. package/dist/src/type/polyline.js.map +1 -0
  101. package/dist/src/type/primitive/box.d.ts +8 -0
  102. package/dist/src/type/primitive/box.js +3 -0
  103. package/dist/src/type/primitive/box.js.map +1 -0
  104. package/dist/src/type/primitive/cylinder.d.ts +11 -0
  105. package/dist/src/type/primitive/cylinder.js +3 -0
  106. package/dist/src/type/primitive/cylinder.js.map +1 -0
  107. package/dist/src/type/primitive/opening.d.ts +24 -0
  108. package/dist/src/type/primitive/opening.js +3 -0
  109. package/dist/src/type/primitive/opening.js.map +1 -0
  110. package/dist/src/type/primitive/polyline.d.ts +8 -0
  111. package/dist/src/type/primitive/polyline.js +3 -0
  112. package/dist/src/type/primitive/polyline.js.map +1 -0
  113. package/dist/src/type/primitive/sphere.d.ts +8 -0
  114. package/dist/src/type/primitive/sphere.js +3 -0
  115. package/dist/src/type/primitive/sphere.js.map +1 -0
  116. package/dist/src/type/primitive-geometry.d.ts +9 -0
  117. package/dist/src/type/primitive-geometry.js +3 -0
  118. package/dist/src/type/primitive-geometry.js.map +1 -0
  119. package/dist/src/type/primitive.d.ts +7 -0
  120. package/dist/src/type/primitive.js +3 -0
  121. package/dist/src/type/primitive.js.map +1 -0
  122. package/dist/src/type/render-options.d.ts +5 -0
  123. package/dist/src/type/render-options.js +3 -0
  124. package/dist/src/type/render-options.js.map +1 -0
  125. package/dist/src/type/screen-point.d.ts +5 -0
  126. package/dist/src/type/screen-point.js +3 -0
  127. package/dist/src/type/screen-point.js.map +1 -0
  128. package/dist/src/type/sidebar-callbacks.d.ts +9 -0
  129. package/dist/src/type/sidebar-callbacks.js +3 -0
  130. package/dist/src/type/sidebar-callbacks.js.map +1 -0
  131. package/dist/src/type/stroke.d.ts +6 -0
  132. package/dist/src/type/stroke.js +3 -0
  133. package/dist/src/type/stroke.js.map +1 -0
  134. package/dist/src/type/vector3.d.ts +6 -0
  135. package/dist/src/type/vector3.js +3 -0
  136. package/dist/src/type/vector3.js.map +1 -0
  137. package/dist/src/type/view-orientation.d.ts +5 -0
  138. package/dist/src/type/view-orientation.js +3 -0
  139. package/dist/src/type/view-orientation.js.map +1 -0
  140. package/dist/src/type/viewport.d.ts +5 -0
  141. package/dist/src/type/viewport.js +3 -0
  142. package/dist/src/type/viewport.js.map +1 -0
  143. package/dist/src/type/visibility-map.d.ts +2 -0
  144. package/dist/src/type/visibility-map.js +3 -0
  145. package/dist/src/type/visibility-map.js.map +1 -0
  146. package/dist/src/type/wireframe-component.d.ts +13 -0
  147. package/dist/src/type/wireframe-component.js +3 -0
  148. package/dist/src/type/wireframe-component.js.map +1 -0
  149. package/dist/src/type/wireframe-scene.d.ts +10 -0
  150. package/dist/src/type/wireframe-scene.js +3 -0
  151. package/dist/src/type/wireframe-scene.js.map +1 -0
  152. package/dist/src/utility/add-vectors.d.ts +3 -0
  153. package/dist/src/utility/add-vectors.js +11 -0
  154. package/dist/src/utility/add-vectors.js.map +1 -0
  155. package/dist/src/utility/build-box-outlines.d.ts +4 -0
  156. package/dist/src/utility/build-box-outlines.js +32 -0
  157. package/dist/src/utility/build-box-outlines.js.map +1 -0
  158. package/dist/src/utility/build-circle-outline.d.ts +5 -0
  159. package/dist/src/utility/build-circle-outline.js +25 -0
  160. package/dist/src/utility/build-circle-outline.js.map +1 -0
  161. package/dist/src/utility/build-cylinder-outlines.d.ts +4 -0
  162. package/dist/src/utility/build-cylinder-outlines.js +34 -0
  163. package/dist/src/utility/build-cylinder-outlines.js.map +1 -0
  164. package/dist/src/utility/build-initial-visibility.d.ts +4 -0
  165. package/dist/src/utility/build-initial-visibility.js +11 -0
  166. package/dist/src/utility/build-initial-visibility.js.map +1 -0
  167. package/dist/src/utility/build-opening-outlines.d.ts +4 -0
  168. package/dist/src/utility/build-opening-outlines.js +31 -0
  169. package/dist/src/utility/build-opening-outlines.js.map +1 -0
  170. package/dist/src/utility/build-primitive-geometry.d.ts +4 -0
  171. package/dist/src/utility/build-primitive-geometry.js +40 -0
  172. package/dist/src/utility/build-primitive-geometry.js.map +1 -0
  173. package/dist/src/utility/build-rectangle-outline.d.ts +5 -0
  174. package/dist/src/utility/build-rectangle-outline.js +23 -0
  175. package/dist/src/utility/build-rectangle-outline.js.map +1 -0
  176. package/dist/src/utility/build-sphere-outlines.d.ts +4 -0
  177. package/dist/src/utility/build-sphere-outlines.js +16 -0
  178. package/dist/src/utility/build-sphere-outlines.js.map +1 -0
  179. package/dist/src/utility/clamp.d.ts +2 -0
  180. package/dist/src/utility/clamp.js +7 -0
  181. package/dist/src/utility/clamp.js.map +1 -0
  182. package/dist/src/utility/collect-display-points.d.ts +4 -0
  183. package/dist/src/utility/collect-display-points.js +13 -0
  184. package/dist/src/utility/collect-display-points.js.map +1 -0
  185. package/dist/src/utility/compute-bounding-box.d.ts +4 -0
  186. package/dist/src/utility/compute-bounding-box.js +29 -0
  187. package/dist/src/utility/compute-bounding-box.js.map +1 -0
  188. package/dist/src/utility/compute-centroid.d.ts +3 -0
  189. package/dist/src/utility/compute-centroid.js +17 -0
  190. package/dist/src/utility/compute-centroid.js.map +1 -0
  191. package/dist/src/utility/create-element.d.ts +2 -0
  192. package/dist/src/utility/create-element.js +11 -0
  193. package/dist/src/utility/create-element.js.map +1 -0
  194. package/dist/src/utility/fit-camera-to-bounding-box.d.ts +4 -0
  195. package/dist/src/utility/fit-camera-to-bounding-box.js +23 -0
  196. package/dist/src/utility/fit-camera-to-bounding-box.js.map +1 -0
  197. package/dist/src/utility/flatten-components.d.ts +4 -0
  198. package/dist/src/utility/flatten-components.js +70 -0
  199. package/dist/src/utility/flatten-components.js.map +1 -0
  200. package/dist/src/utility/get-bounding-box-center.d.ts +4 -0
  201. package/dist/src/utility/get-bounding-box-center.js +14 -0
  202. package/dist/src/utility/get-bounding-box-center.js.map +1 -0
  203. package/dist/src/utility/get-bounding-box-size.d.ts +4 -0
  204. package/dist/src/utility/get-bounding-box-size.js +12 -0
  205. package/dist/src/utility/get-bounding-box-size.js.map +1 -0
  206. package/dist/src/utility/get-focal-length.d.ts +2 -0
  207. package/dist/src/utility/get-focal-length.js +9 -0
  208. package/dist/src/utility/get-focal-length.js.map +1 -0
  209. package/dist/src/utility/get-perpendicular-axes.d.ts +3 -0
  210. package/dist/src/utility/get-perpendicular-axes.js +18 -0
  211. package/dist/src/utility/get-perpendicular-axes.js.map +1 -0
  212. package/dist/src/utility/get-plane-axes.d.ts +4 -0
  213. package/dist/src/utility/get-plane-axes.js +19 -0
  214. package/dist/src/utility/get-plane-axes.js.map +1 -0
  215. package/dist/src/utility/get-primitive-anchor.d.ts +4 -0
  216. package/dist/src/utility/get-primitive-anchor.js +20 -0
  217. package/dist/src/utility/get-primitive-anchor.js.map +1 -0
  218. package/dist/src/utility/get-vector-component.d.ts +4 -0
  219. package/dist/src/utility/get-vector-component.js +18 -0
  220. package/dist/src/utility/get-vector-component.js.map +1 -0
  221. package/dist/src/utility/get-vector-length.d.ts +3 -0
  222. package/dist/src/utility/get-vector-length.js +7 -0
  223. package/dist/src/utility/get-vector-length.js.map +1 -0
  224. package/dist/src/utility/has-hidden-ancestor.d.ts +4 -0
  225. package/dist/src/utility/has-hidden-ancestor.js +9 -0
  226. package/dist/src/utility/has-hidden-ancestor.js.map +1 -0
  227. package/dist/src/utility/inject-stylesheet.d.ts +2 -0
  228. package/dist/src/utility/inject-stylesheet.js +21 -0
  229. package/dist/src/utility/inject-stylesheet.js.map +1 -0
  230. package/dist/src/utility/is-component-shown.d.ts +4 -0
  231. package/dist/src/utility/is-component-shown.js +10 -0
  232. package/dist/src/utility/is-component-shown.js.map +1 -0
  233. package/dist/src/utility/offset-vector-along-axis.d.ts +4 -0
  234. package/dist/src/utility/offset-vector-along-axis.js +14 -0
  235. package/dist/src/utility/offset-vector-along-axis.js.map +1 -0
  236. package/dist/src/utility/pick-palette-color.d.ts +2 -0
  237. package/dist/src/utility/pick-palette-color.js +12 -0
  238. package/dist/src/utility/pick-palette-color.js.map +1 -0
  239. package/dist/src/utility/project-vector.d.ts +6 -0
  240. package/dist/src/utility/project-vector.js +30 -0
  241. package/dist/src/utility/project-vector.js.map +1 -0
  242. package/dist/src/utility/rotate-vector.d.ts +3 -0
  243. package/dist/src/utility/rotate-vector.js +17 -0
  244. package/dist/src/utility/rotate-vector.js.map +1 -0
  245. package/dist/src/utility/scale-vector.d.ts +3 -0
  246. package/dist/src/utility/scale-vector.js +11 -0
  247. package/dist/src/utility/scale-vector.js.map +1 -0
  248. package/dist/src/utility/subtract-vectors.d.ts +3 -0
  249. package/dist/src/utility/subtract-vectors.js +11 -0
  250. package/dist/src/utility/subtract-vectors.js.map +1 -0
  251. package/dist/src/utility/unrotate-vector.d.ts +3 -0
  252. package/dist/src/utility/unrotate-vector.js +17 -0
  253. package/dist/src/utility/unrotate-vector.js.map +1 -0
  254. package/dist/src/utility/validate-scene.d.ts +3 -0
  255. package/dist/src/utility/validate-scene.js +70 -0
  256. package/dist/src/utility/validate-scene.js.map +1 -0
  257. package/dist/src/utility/with-vector-component.d.ts +4 -0
  258. package/dist/src/utility/with-vector-component.js +18 -0
  259. package/dist/src/utility/with-vector-component.js.map +1 -0
  260. package/dist/src/wireframe-viewer.d.ts +27 -0
  261. package/dist/src/wireframe-viewer.js +144 -0
  262. package/dist/src/wireframe-viewer.js.map +1 -0
  263. package/dist/tsconfig.tsbuildinfo +1 -0
  264. package/package.json +44 -5
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const offset_vector_along_axis_1 = __importDefault(require("./offset-vector-along-axis.js"));
7
+ function buildRectangleOutline(center, u_axis, v_axis, width, height) {
8
+ const half_width = width / 2;
9
+ const half_height = height / 2;
10
+ const corner_offsets = [
11
+ [half_width * -1, half_height * -1],
12
+ [half_width, half_height * -1],
13
+ [half_width, half_height],
14
+ [half_width * -1, half_height],
15
+ [half_width * -1, half_height * -1]
16
+ ];
17
+ return corner_offsets.map(([u_offset, v_offset]) => {
18
+ const u_shifted = (0, offset_vector_along_axis_1.default)(center, u_axis, u_offset);
19
+ return (0, offset_vector_along_axis_1.default)(u_shifted, v_axis, v_offset);
20
+ });
21
+ }
22
+ exports.default = buildRectangleOutline;
23
+ //# sourceMappingURL=build-rectangle-outline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-rectangle-outline.js","sourceRoot":"","sources":["../../../src/utility/build-rectangle-outline.ts"],"names":[],"mappings":";;;;;AAGA,gGAAqE;AAErE,SAAS,qBAAqB,CAC7B,MAAe,EACf,MAAY,EACZ,MAAY,EACZ,KAAa,EACb,MAAc;IAEd,MAAM,UAAU,GAAG,KAAK,GAAG,CAAC,CAAC;IAC7B,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,CAAC;IAE/B,MAAM,cAAc,GAAuB;QAC1C,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,CAAC,CAAC,CAAC;QACnC,CAAC,UAAU,EAAE,WAAW,GAAG,CAAC,CAAC,CAAC;QAC9B,CAAC,UAAU,EAAE,WAAW,CAAC;QACzB,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC;QAC9B,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,CAAC,CAAC,CAAC;KACnC,CAAC;IAEF,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE;QAClD,MAAM,SAAS,GAAG,IAAA,kCAAqB,EAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAElE,OAAO,IAAA,kCAAqB,EAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,kBAAe,qBAAqB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import Polyline from './../type/polyline';
2
+ import SpherePrimitive from './../type/primitive/sphere';
3
+ declare function buildSphereOutlines(sphere: SpherePrimitive): Polyline[];
4
+ export default buildSphereOutlines;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const axis_1 = __importDefault(require("./../enum/axis.js"));
7
+ const build_circle_outline_1 = __importDefault(require("./build-circle-outline.js"));
8
+ function buildSphereOutlines(sphere) {
9
+ const { center, radius } = sphere;
10
+ const axes = Object.values(axis_1.default);
11
+ return axes.map((axis) => {
12
+ return (0, build_circle_outline_1.default)(center, axis, radius);
13
+ });
14
+ }
15
+ exports.default = buildSphereOutlines;
16
+ //# sourceMappingURL=build-sphere-outlines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-sphere-outlines.js","sourceRoot":"","sources":["../../../src/utility/build-sphere-outlines.ts"],"names":[],"mappings":";;;;;AAAA,qDAA6B;AAG7B,wFAA8D;AAE9D,SAAS,mBAAmB,CAAC,MAAuB;IACnD,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,MAAM,CAAC;IAChC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,cAAI,CAAC,CAAC;IAEjC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,OAAO,IAAA,8BAAkB,EAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,kBAAe,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare function clamp(value: number, minimum: number, maximum: number): number;
2
+ export default clamp;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function clamp(value, minimum, maximum) {
4
+ return Math.max(minimum, Math.min(maximum, value));
5
+ }
6
+ exports.default = clamp;
7
+ //# sourceMappingURL=clamp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clamp.js","sourceRoot":"","sources":["../../../src/utility/clamp.ts"],"names":[],"mappings":";;AAAA,SAAS,KAAK,CAAC,KAAa,EAAE,OAAe,EAAE,OAAe;IAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,kBAAe,KAAK,CAAC"}
@@ -0,0 +1,4 @@
1
+ import Vector3 from './../type/vector3';
2
+ import DisplayComponent from './../type/display-component';
3
+ declare function collectDisplayPoints(components: DisplayComponent[]): Vector3[];
4
+ export default collectDisplayPoints;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function collectDisplayPoints(components) {
4
+ return components.flatMap((component) => {
5
+ const outline_points = component.outlines.flat();
6
+ const stroke_points = component.strokes.flatMap((stroke) => {
7
+ return stroke.points;
8
+ });
9
+ return [...outline_points, ...stroke_points];
10
+ });
11
+ }
12
+ exports.default = collectDisplayPoints;
13
+ //# sourceMappingURL=collect-display-points.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect-display-points.js","sourceRoot":"","sources":["../../../src/utility/collect-display-points.ts"],"names":[],"mappings":";;AAGA,SAAS,oBAAoB,CAAC,UAA8B;IAC3D,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QACvC,MAAM,cAAc,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEjD,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC1D,OAAO,MAAM,CAAC,MAAM,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,cAAc,EAAE,GAAG,aAAa,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,kBAAe,oBAAoB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import Vector3 from './../type/vector3';
2
+ import BoundingBox from './../type/bounding-box';
3
+ declare function computeBoundingBox(points: Vector3[]): BoundingBox;
4
+ export default computeBoundingBox;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const EMPTY_BOUNDING_BOX = {
4
+ minimum: { x: 0, y: 0, z: 0 },
5
+ maximum: { x: 0, y: 0, z: 0 }
6
+ };
7
+ function computeBoundingBox(points) {
8
+ const [first_point, ...remaining_points] = points;
9
+ if (first_point === undefined) {
10
+ return EMPTY_BOUNDING_BOX;
11
+ }
12
+ let minimum = first_point;
13
+ let maximum = first_point;
14
+ remaining_points.forEach((point) => {
15
+ minimum = {
16
+ x: Math.min(minimum.x, point.x),
17
+ y: Math.min(minimum.y, point.y),
18
+ z: Math.min(minimum.z, point.z)
19
+ };
20
+ maximum = {
21
+ x: Math.max(maximum.x, point.x),
22
+ y: Math.max(maximum.y, point.y),
23
+ z: Math.max(maximum.z, point.z)
24
+ };
25
+ });
26
+ return { minimum, maximum };
27
+ }
28
+ exports.default = computeBoundingBox;
29
+ //# sourceMappingURL=compute-bounding-box.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute-bounding-box.js","sourceRoot":"","sources":["../../../src/utility/compute-bounding-box.ts"],"names":[],"mappings":";;AAGA,MAAM,kBAAkB,GAAgB;IACvC,OAAO,EAAE,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAC;IAC3B,OAAO,EAAE,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAC;CAC3B,CAAC;AAEF,SAAS,kBAAkB,CAAC,MAAiB;IAC5C,MAAM,CAAC,WAAW,EAAE,GAAG,gBAAgB,CAAC,GAAG,MAAM,CAAC;IAElD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,kBAAkB,CAAC;IAC3B,CAAC;IAED,IAAI,OAAO,GAAG,WAAW,CAAC;IAC1B,IAAI,OAAO,GAAG,WAAW,CAAC;IAE1B,gBAAgB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAClC,OAAO,GAAG;YACT,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;YAC/B,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;YAC/B,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;SAC/B,CAAC;QAEF,OAAO,GAAG;YACT,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;YAC/B,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;YAC/B,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;SAC/B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,CAAC;AAC3B,CAAC;AAED,kBAAe,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import Vector3 from './../type/vector3';
2
+ declare function computeCentroid(points: Vector3[]): Vector3;
3
+ export default computeCentroid;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const add_vectors_1 = __importDefault(require("./add-vectors.js"));
7
+ const scale_vector_1 = __importDefault(require("./scale-vector.js"));
8
+ const ORIGIN = { x: 0, y: 0, z: 0 };
9
+ function computeCentroid(points) {
10
+ if (points.length === 0) {
11
+ return ORIGIN;
12
+ }
13
+ const sum = points.reduce(add_vectors_1.default, ORIGIN);
14
+ return (0, scale_vector_1.default)(sum, 1 / points.length);
15
+ }
16
+ exports.default = computeCentroid;
17
+ //# sourceMappingURL=compute-centroid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute-centroid.js","sourceRoot":"","sources":["../../../src/utility/compute-centroid.ts"],"names":[],"mappings":";;;;;AACA,sEAA6C;AAC7C,wEAA+C;AAE/C,MAAM,MAAM,GAAY,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAC,CAAC;AAE3C,SAAS,eAAe,CAAC,MAAiB;IACzC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,MAAM,CAAC;IACf,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAU,EAAE,MAAM,CAAC,CAAC;IAE9C,OAAO,IAAA,sBAAW,EAAC,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED,kBAAe,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare function createElement<Tag extends keyof HTMLElementTagNameMap>(tag: Tag, class_name?: string | null): HTMLElementTagNameMap[Tag];
2
+ export default createElement;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function createElement(tag, class_name = null) {
4
+ const element = document.createElement(tag);
5
+ if (class_name !== null) {
6
+ element.className = class_name;
7
+ }
8
+ return element;
9
+ }
10
+ exports.default = createElement;
11
+ //# sourceMappingURL=create-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-element.js","sourceRoot":"","sources":["../../../src/utility/create-element.ts"],"names":[],"mappings":";;AAAA,SAAS,aAAa,CACrB,GAAQ,EACR,aAA4B,IAAI;IAEhC,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAE5C,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACzB,OAAO,CAAC,SAAS,GAAG,UAAU,CAAC;IAChC,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,kBAAe,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ import BoundingBox from './../type/bounding-box';
2
+ import CameraState from './../type/camera-state';
3
+ declare function fitCameraToBoundingBox(camera: CameraState, bounding_box: BoundingBox): CameraState;
4
+ export default fitCameraToBoundingBox;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const camera_limits_1 = __importDefault(require("./../constant/camera-limits.js"));
7
+ const get_vector_length_1 = __importDefault(require("./get-vector-length.js"));
8
+ const rendering_defaults_1 = __importDefault(require("./../constant/rendering-defaults.js"));
9
+ const get_bounding_box_size_1 = __importDefault(require("./get-bounding-box-size.js"));
10
+ const get_bounding_box_center_1 = __importDefault(require("./get-bounding-box-center.js"));
11
+ function fitCameraToBoundingBox(camera, bounding_box) {
12
+ const target = (0, get_bounding_box_center_1.default)(bounding_box);
13
+ const size = (0, get_bounding_box_size_1.default)(bounding_box);
14
+ const diagonal = (0, get_vector_length_1.default)(size);
15
+ const radius = diagonal / 2;
16
+ const half_angle = camera.field_of_view / 2;
17
+ const fitted_distance = radius / Math.sin(half_angle);
18
+ const padded_distance = fitted_distance * rendering_defaults_1.default.FIT_DISTANCE_FACTOR;
19
+ const distance = Math.max(camera_limits_1.default.MINIMUM_DISTANCE, padded_distance);
20
+ return { ...camera, target, distance };
21
+ }
22
+ exports.default = fitCameraToBoundingBox;
23
+ //# sourceMappingURL=fit-camera-to-bounding-box.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fit-camera-to-bounding-box.js","sourceRoot":"","sources":["../../../src/utility/fit-camera-to-bounding-box.ts"],"names":[],"mappings":";;;;;AAEA,2EAAmD;AACnD,kFAAwD;AACxD,qFAA6D;AAC7D,0FAA+D;AAC/D,8FAAmE;AAEnE,SAAS,sBAAsB,CAC9B,MAAmB,EACnB,YAAyB;IAEzB,MAAM,MAAM,GAAG,IAAA,iCAAoB,EAAC,YAAY,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,IAAA,+BAAkB,EAAC,YAAY,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,IAAA,2BAAe,EAAC,IAAI,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,QAAQ,GAAG,CAAC,CAAC;IAC5B,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC;IAC5C,MAAM,eAAe,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACtD,MAAM,eAAe,GACpB,eAAe,GAAG,4BAAkB,CAAC,mBAAmB,CAAC;IAC1D,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,uBAAa,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IAE3E,OAAO,EAAC,GAAG,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAC,CAAC;AACtC,CAAC;AAED,kBAAe,sBAAsB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import DisplayComponent from './../type/display-component';
2
+ import WireframeComponent from './../type/wireframe-component';
3
+ declare function flattenComponents(components: WireframeComponent[], palette?: string[]): DisplayComponent[];
4
+ export default flattenComponents;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const default_palette_1 = __importDefault(require("./../constant/default-palette.js"));
7
+ const compute_centroid_1 = __importDefault(require("./compute-centroid.js"));
8
+ const pick_palette_color_1 = __importDefault(require("./pick-palette-color.js"));
9
+ const rendering_defaults_1 = __importDefault(require("./../constant/rendering-defaults.js"));
10
+ const build_primitive_geometry_1 = __importDefault(require("./build-primitive-geometry.js"));
11
+ function flattenComponent(component, inherited) {
12
+ const color = component.color ?? inherited.color;
13
+ const alpha = component.alpha ?? inherited.alpha;
14
+ const line_width = component.line_width ?? inherited.line_width;
15
+ const label = component.label ?? component.id;
16
+ const note = component.note ?? '';
17
+ const initially_visible = component.visible ?? true;
18
+ const primitives = component.primitives ?? [];
19
+ const children = component.children ?? [];
20
+ const outlines = [];
21
+ const strokes = [];
22
+ const anchors = [];
23
+ primitives.forEach((primitive) => {
24
+ const geometry = (0, build_primitive_geometry_1.default)(primitive);
25
+ outlines.push(...geometry.outlines);
26
+ strokes.push(...geometry.strokes);
27
+ anchors.push(geometry.anchor);
28
+ });
29
+ const centroid = (0, compute_centroid_1.default)(anchors);
30
+ const display_component = {
31
+ id: component.id,
32
+ label,
33
+ note,
34
+ color,
35
+ alpha,
36
+ line_width,
37
+ depth: inherited.depth,
38
+ initially_visible,
39
+ ancestor_ids: inherited.ancestor_ids,
40
+ outlines,
41
+ strokes,
42
+ centroid
43
+ };
44
+ const child_style = {
45
+ color,
46
+ alpha,
47
+ line_width,
48
+ depth: inherited.depth + 1,
49
+ ancestor_ids: [...inherited.ancestor_ids, component.id]
50
+ };
51
+ const descendants = children.flatMap((child) => {
52
+ return flattenComponent(child, child_style);
53
+ });
54
+ return [display_component, ...descendants];
55
+ }
56
+ function flattenComponents(components, palette = default_palette_1.default) {
57
+ return components.flatMap((component, index) => {
58
+ const color = (0, pick_palette_color_1.default)(index, palette);
59
+ const root_style = {
60
+ color,
61
+ alpha: rendering_defaults_1.default.ALPHA,
62
+ line_width: rendering_defaults_1.default.LINE_WIDTH,
63
+ depth: 0,
64
+ ancestor_ids: []
65
+ };
66
+ return flattenComponent(component, root_style);
67
+ });
68
+ }
69
+ exports.default = flattenComponents;
70
+ //# sourceMappingURL=flatten-components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flatten-components.js","sourceRoot":"","sources":["../../../src/utility/flatten-components.ts"],"names":[],"mappings":";;;;;AAIA,+EAAuD;AACvD,gFAAuD;AAEvD,oFAA0D;AAE1D,qFAA6D;AAC7D,gGAAsE;AAEtE,SAAS,gBAAgB,CACxB,SAA6B,EAC7B,SAAyB;IAEzB,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC;IACjD,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC;IACjD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC;IAChE,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE,CAAC;IAC9C,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC;IAClC,MAAM,iBAAiB,GAAG,SAAS,CAAC,OAAO,IAAI,IAAI,CAAC;IACpD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,IAAI,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAC;IAC1C,MAAM,QAAQ,GAAe,EAAE,CAAC;IAChC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAc,EAAE,CAAC;IAE9B,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QAChC,MAAM,QAAQ,GAAG,IAAA,kCAAsB,EAAC,SAAS,CAAC,CAAC;QAEnD,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAA,0BAAe,EAAC,OAAO,CAAC,CAAC;IAE1C,MAAM,iBAAiB,GAAqB;QAC3C,EAAE,EAAE,SAAS,CAAC,EAAE;QAChB,KAAK;QACL,IAAI;QACJ,KAAK;QACL,KAAK;QACL,UAAU;QACV,KAAK,EAAE,SAAS,CAAC,KAAK;QACtB,iBAAiB;QACjB,YAAY,EAAE,SAAS,CAAC,YAAY;QACpC,QAAQ;QACR,OAAO;QACP,QAAQ;KACR,CAAC;IAEF,MAAM,WAAW,GAAmB;QACnC,KAAK;QACL,KAAK;QACL,UAAU;QACV,KAAK,EAAE,SAAS,CAAC,KAAK,GAAG,CAAC;QAC1B,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC,YAAY,EAAE,SAAS,CAAC,EAAE,CAAC;KACvD,CAAC;IAEF,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QAC9C,OAAO,gBAAgB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,iBAAiB,EAAE,GAAG,WAAW,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,iBAAiB,CACzB,UAAgC,EAChC,UAAoB,yBAAe;IAEnC,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;QAC9C,MAAM,KAAK,GAAG,IAAA,4BAAgB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAE/C,MAAM,UAAU,GAAmB;YAClC,KAAK;YACL,KAAK,EAAE,4BAAkB,CAAC,KAAK;YAC/B,UAAU,EAAE,4BAAkB,CAAC,UAAU;YACzC,KAAK,EAAE,CAAC;YACR,YAAY,EAAE,EAAE;SAChB,CAAC;QAEF,OAAO,gBAAgB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,kBAAe,iBAAiB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import Vector3 from './../type/vector3';
2
+ import BoundingBox from './../type/bounding-box';
3
+ declare function getBoundingBoxCenter(bounding_box: BoundingBox): Vector3;
4
+ export default getBoundingBoxCenter;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const add_vectors_1 = __importDefault(require("./add-vectors.js"));
7
+ const scale_vector_1 = __importDefault(require("./scale-vector.js"));
8
+ function getBoundingBoxCenter(bounding_box) {
9
+ const { minimum, maximum } = bounding_box;
10
+ const sum = (0, add_vectors_1.default)(minimum, maximum);
11
+ return (0, scale_vector_1.default)(sum, 0.5);
12
+ }
13
+ exports.default = getBoundingBoxCenter;
14
+ //# sourceMappingURL=get-bounding-box-center.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-bounding-box-center.js","sourceRoot":"","sources":["../../../src/utility/get-bounding-box-center.ts"],"names":[],"mappings":";;;;;AACA,sEAA6C;AAE7C,wEAA+C;AAE/C,SAAS,oBAAoB,CAAC,YAAyB;IACtD,MAAM,EAAC,OAAO,EAAE,OAAO,EAAC,GAAG,YAAY,CAAC;IACxC,MAAM,GAAG,GAAG,IAAA,qBAAU,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAEzC,OAAO,IAAA,sBAAW,EAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED,kBAAe,oBAAoB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import Vector3 from './../type/vector3';
2
+ import BoundingBox from './../type/bounding-box';
3
+ declare function getBoundingBoxSize(bounding_box: BoundingBox): Vector3;
4
+ export default getBoundingBoxSize;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const subtract_vectors_1 = __importDefault(require("./subtract-vectors.js"));
7
+ function getBoundingBoxSize(bounding_box) {
8
+ const { minimum, maximum } = bounding_box;
9
+ return (0, subtract_vectors_1.default)(maximum, minimum);
10
+ }
11
+ exports.default = getBoundingBoxSize;
12
+ //# sourceMappingURL=get-bounding-box-size.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-bounding-box-size.js","sourceRoot":"","sources":["../../../src/utility/get-bounding-box-size.ts"],"names":[],"mappings":";;;;;AAEA,gFAAuD;AAEvD,SAAS,kBAAkB,CAAC,YAAyB;IACpD,MAAM,EAAC,OAAO,EAAE,OAAO,EAAC,GAAG,YAAY,CAAC;IAExC,OAAO,IAAA,0BAAe,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED,kBAAe,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare function getFocalLength(field_of_view: number, viewport_height: number): number;
2
+ export default getFocalLength;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function getFocalLength(field_of_view, viewport_height) {
4
+ const half_height = viewport_height / 2;
5
+ const half_angle = field_of_view / 2;
6
+ return half_height / Math.tan(half_angle);
7
+ }
8
+ exports.default = getFocalLength;
9
+ //# sourceMappingURL=get-focal-length.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-focal-length.js","sourceRoot":"","sources":["../../../src/utility/get-focal-length.ts"],"names":[],"mappings":";;AAAA,SAAS,cAAc,CACtB,aAAqB,EACrB,eAAuB;IAEvB,MAAM,WAAW,GAAG,eAAe,GAAG,CAAC,CAAC;IACxC,MAAM,UAAU,GAAG,aAAa,GAAG,CAAC,CAAC;IAErC,OAAO,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC;AAED,kBAAe,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ import Axis from './../enum/axis';
2
+ declare function getPerpendicularAxes(axis: Axis): [Axis, Axis];
3
+ export default getPerpendicularAxes;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const axis_1 = __importDefault(require("./../enum/axis.js"));
7
+ function getPerpendicularAxes(axis) {
8
+ switch (axis) {
9
+ case axis_1.default.X:
10
+ return [axis_1.default.Y, axis_1.default.Z];
11
+ case axis_1.default.Y:
12
+ return [axis_1.default.X, axis_1.default.Z];
13
+ case axis_1.default.Z:
14
+ return [axis_1.default.X, axis_1.default.Y];
15
+ }
16
+ }
17
+ exports.default = getPerpendicularAxes;
18
+ //# sourceMappingURL=get-perpendicular-axes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-perpendicular-axes.js","sourceRoot":"","sources":["../../../src/utility/get-perpendicular-axes.ts"],"names":[],"mappings":";;;;;AAAA,qDAA6B;AAE7B,SAAS,oBAAoB,CAAC,IAAU;IACvC,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,cAAI,CAAC,CAAC;YACV,OAAO,CAAC,cAAI,CAAC,CAAC,EAAE,cAAI,CAAC,CAAC,CAAC,CAAC;QACzB,KAAK,cAAI,CAAC,CAAC;YACV,OAAO,CAAC,cAAI,CAAC,CAAC,EAAE,cAAI,CAAC,CAAC,CAAC,CAAC;QACzB,KAAK,cAAI,CAAC,CAAC;YACV,OAAO,CAAC,cAAI,CAAC,CAAC,EAAE,cAAI,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;AACF,CAAC;AAED,kBAAe,oBAAoB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import Plane from './../enum/plane';
2
+ import PlaneAxes from './../type/plane-axes';
3
+ declare function getPlaneAxes(plane: Plane): PlaneAxes;
4
+ export default getPlaneAxes;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const axis_1 = __importDefault(require("./../enum/axis.js"));
7
+ const plane_1 = __importDefault(require("./../enum/plane.js"));
8
+ function getPlaneAxes(plane) {
9
+ switch (plane) {
10
+ case plane_1.default.XY:
11
+ return { u: axis_1.default.X, v: axis_1.default.Y, normal: axis_1.default.Z };
12
+ case plane_1.default.XZ:
13
+ return { u: axis_1.default.X, v: axis_1.default.Z, normal: axis_1.default.Y };
14
+ case plane_1.default.YZ:
15
+ return { u: axis_1.default.Y, v: axis_1.default.Z, normal: axis_1.default.X };
16
+ }
17
+ }
18
+ exports.default = getPlaneAxes;
19
+ //# sourceMappingURL=get-plane-axes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-plane-axes.js","sourceRoot":"","sources":["../../../src/utility/get-plane-axes.ts"],"names":[],"mappings":";;;;;AAAA,qDAA6B;AAC7B,uDAA+B;AAG/B,SAAS,YAAY,CAAC,KAAY;IACjC,QAAQ,KAAK,EAAE,CAAC;QACf,KAAK,eAAK,CAAC,EAAE;YACZ,OAAO,EAAC,CAAC,EAAE,cAAI,CAAC,CAAC,EAAE,CAAC,EAAE,cAAI,CAAC,CAAC,EAAE,MAAM,EAAE,cAAI,CAAC,CAAC,EAAC,CAAC;QAC/C,KAAK,eAAK,CAAC,EAAE;YACZ,OAAO,EAAC,CAAC,EAAE,cAAI,CAAC,CAAC,EAAE,CAAC,EAAE,cAAI,CAAC,CAAC,EAAE,MAAM,EAAE,cAAI,CAAC,CAAC,EAAC,CAAC;QAC/C,KAAK,eAAK,CAAC,EAAE;YACZ,OAAO,EAAC,CAAC,EAAE,cAAI,CAAC,CAAC,EAAE,CAAC,EAAE,cAAI,CAAC,CAAC,EAAE,MAAM,EAAE,cAAI,CAAC,CAAC,EAAC,CAAC;IAChD,CAAC;AACF,CAAC;AAED,kBAAe,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ import Vector3 from './../type/vector3';
2
+ import Primitive from './../type/primitive';
3
+ declare function getPrimitiveAnchor(primitive: Primitive): Vector3;
4
+ export default getPrimitiveAnchor;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const primitive_type_1 = __importDefault(require("./../enum/primitive-type.js"));
7
+ const compute_centroid_1 = __importDefault(require("./compute-centroid.js"));
8
+ function getPrimitiveAnchor(primitive) {
9
+ if (primitive.type === primitive_type_1.default.POLYLINE) {
10
+ const middle_index = Math.floor(primitive.points.length / 2);
11
+ const middle_point = primitive.points[middle_index];
12
+ if (middle_point === undefined) {
13
+ return (0, compute_centroid_1.default)([]);
14
+ }
15
+ return middle_point;
16
+ }
17
+ return primitive.center;
18
+ }
19
+ exports.default = getPrimitiveAnchor;
20
+ //# sourceMappingURL=get-primitive-anchor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-primitive-anchor.js","sourceRoot":"","sources":["../../../src/utility/get-primitive-anchor.ts"],"names":[],"mappings":";;;;;AAEA,yEAAgD;AAChD,gFAAuD;AAEvD,SAAS,kBAAkB,CAAC,SAAoB;IAC/C,IAAI,SAAS,CAAC,IAAI,KAAK,wBAAa,CAAC,QAAQ,EAAE,CAAC;QAC/C,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC7D,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAEpD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAChC,OAAO,IAAA,0BAAe,EAAC,EAAE,CAAC,CAAC;QAC5B,CAAC;QAED,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,OAAO,SAAS,CAAC,MAAM,CAAC;AACzB,CAAC;AAED,kBAAe,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import Axis from './../enum/axis';
2
+ import Vector3 from './../type/vector3';
3
+ declare function getVectorComponent(vector: Vector3, axis: Axis): number;
4
+ export default getVectorComponent;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const axis_1 = __importDefault(require("./../enum/axis.js"));
7
+ function getVectorComponent(vector, axis) {
8
+ switch (axis) {
9
+ case axis_1.default.X:
10
+ return vector.x;
11
+ case axis_1.default.Y:
12
+ return vector.y;
13
+ case axis_1.default.Z:
14
+ return vector.z;
15
+ }
16
+ }
17
+ exports.default = getVectorComponent;
18
+ //# sourceMappingURL=get-vector-component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-vector-component.js","sourceRoot":"","sources":["../../../src/utility/get-vector-component.ts"],"names":[],"mappings":";;;;;AAAA,qDAA6B;AAG7B,SAAS,kBAAkB,CAAC,MAAe,EAAE,IAAU;IACtD,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,cAAI,CAAC,CAAC;YACV,OAAO,MAAM,CAAC,CAAC,CAAC;QACjB,KAAK,cAAI,CAAC,CAAC;YACV,OAAO,MAAM,CAAC,CAAC,CAAC;QACjB,KAAK,cAAI,CAAC,CAAC;YACV,OAAO,MAAM,CAAC,CAAC,CAAC;IAClB,CAAC;AACF,CAAC;AAED,kBAAe,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import Vector3 from './../type/vector3';
2
+ declare function getVectorLength(vector: Vector3): number;
3
+ export default getVectorLength;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function getVectorLength(vector) {
4
+ return Math.hypot(vector.x, vector.y, vector.z);
5
+ }
6
+ exports.default = getVectorLength;
7
+ //# sourceMappingURL=get-vector-length.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-vector-length.js","sourceRoot":"","sources":["../../../src/utility/get-vector-length.ts"],"names":[],"mappings":";;AAEA,SAAS,eAAe,CAAC,MAAe;IACvC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,kBAAe,eAAe,CAAC"}
@@ -0,0 +1,4 @@
1
+ import VisibilityMap from './../type/visibility-map';
2
+ import DisplayComponent from './../type/display-component';
3
+ declare function hasHiddenAncestor(component: DisplayComponent, visibility: VisibilityMap): boolean;
4
+ export default hasHiddenAncestor;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function hasHiddenAncestor(component, visibility) {
4
+ return component.ancestor_ids.some((id) => {
5
+ return visibility.get(id) === false;
6
+ });
7
+ }
8
+ exports.default = hasHiddenAncestor;
9
+ //# sourceMappingURL=has-hidden-ancestor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-hidden-ancestor.js","sourceRoot":"","sources":["../../../src/utility/has-hidden-ancestor.ts"],"names":[],"mappings":";;AAGA,SAAS,iBAAiB,CACzB,SAA2B,EAC3B,UAAyB;IAEzB,OAAO,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;QACzC,OAAO,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC;IACrC,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,kBAAe,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare function injectStylesheet(): void;
2
+ export default injectStylesheet;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const stylesheet_1 = __importDefault(require("./../constant/stylesheet.js"));
7
+ const create_element_1 = __importDefault(require("./create-element.js"));
8
+ const viewer_class_name_1 = __importDefault(require("./../enum/viewer-class-name.js"));
9
+ const STYLE_ELEMENT_ID = `${viewer_class_name_1.default.ROOT}-stylesheet`;
10
+ function injectStylesheet() {
11
+ const existing_element = document.getElementById(STYLE_ELEMENT_ID);
12
+ if (existing_element !== null) {
13
+ return;
14
+ }
15
+ const style_element = (0, create_element_1.default)('style');
16
+ style_element.id = STYLE_ELEMENT_ID;
17
+ style_element.textContent = stylesheet_1.default;
18
+ document.head.appendChild(style_element);
19
+ }
20
+ exports.default = injectStylesheet;
21
+ //# sourceMappingURL=inject-stylesheet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inject-stylesheet.js","sourceRoot":"","sources":["../../../src/utility/inject-stylesheet.ts"],"names":[],"mappings":";;;;;AAAA,qEAA6C;AAC7C,4EAAmD;AACnD,+EAAqD;AAErD,MAAM,gBAAgB,GAAG,GAAG,2BAAe,CAAC,IAAI,aAAa,CAAC;AAE9D,SAAS,gBAAgB;IACxB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAEnE,IAAI,gBAAgB,KAAK,IAAI,EAAE,CAAC;QAC/B,OAAO;IACR,CAAC;IAED,MAAM,aAAa,GAAG,IAAA,wBAAa,EAAC,OAAO,CAAC,CAAC;IAE7C,aAAa,CAAC,EAAE,GAAG,gBAAgB,CAAC;IACpC,aAAa,CAAC,WAAW,GAAG,oBAAU,CAAC;IACvC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;AAC1C,CAAC;AAED,kBAAe,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import VisibilityMap from './../type/visibility-map';
2
+ import DisplayComponent from './../type/display-component';
3
+ declare function isComponentShown(component: DisplayComponent, visibility: VisibilityMap): boolean;
4
+ export default isComponentShown;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function isComponentShown(component, visibility) {
4
+ const lineage_ids = [...component.ancestor_ids, component.id];
5
+ return lineage_ids.every((id) => {
6
+ return visibility.get(id) === true;
7
+ });
8
+ }
9
+ exports.default = isComponentShown;
10
+ //# sourceMappingURL=is-component-shown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-component-shown.js","sourceRoot":"","sources":["../../../src/utility/is-component-shown.ts"],"names":[],"mappings":";;AAGA,SAAS,gBAAgB,CACxB,SAA2B,EAC3B,UAAyB;IAEzB,MAAM,WAAW,GAAG,CAAC,GAAG,SAAS,CAAC,YAAY,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;IAE9D,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE;QAC/B,OAAO,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;IACpC,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,kBAAe,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import Axis from './../enum/axis';
2
+ import Vector3 from './../type/vector3';
3
+ declare function offsetVectorAlongAxis(vector: Vector3, axis: Axis, offset: number): Vector3;
4
+ export default offsetVectorAlongAxis;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const get_vector_component_1 = __importDefault(require("./get-vector-component.js"));
7
+ const with_vector_component_1 = __importDefault(require("./with-vector-component.js"));
8
+ function offsetVectorAlongAxis(vector, axis, offset) {
9
+ const current_value = (0, get_vector_component_1.default)(vector, axis);
10
+ const new_value = current_value + offset;
11
+ return (0, with_vector_component_1.default)(vector, axis, new_value);
12
+ }
13
+ exports.default = offsetVectorAlongAxis;
14
+ //# sourceMappingURL=offset-vector-along-axis.js.map