@aibee/owlly 1.0.25 → 1.0.29

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 (359) hide show
  1. package/lib/external/lines/line-geometry.d.ts +9 -0
  2. package/lib/external/lines/line-geometry.js +51 -0
  3. package/lib/external/lines/line-material.d.ts +10 -0
  4. package/lib/external/lines/line-material.js +376 -0
  5. package/lib/external/lines/line-segments-2.d.ts +7 -0
  6. package/lib/external/lines/line-segments-2.js +143 -0
  7. package/lib/external/lines/line-segments-geometry.d.ts +15 -0
  8. package/lib/external/lines/line-segments-geometry.js +140 -0
  9. package/lib/external/loaders/gltf-loader.d.ts +77 -0
  10. package/lib/external/loaders/gltf-loader.js +2318 -0
  11. package/lib/external/orbit-controls.d.ts +44 -0
  12. package/lib/external/orbit-controls.js +745 -0
  13. package/lib/external/renderers/css-2d-renderer.d.ts +16 -0
  14. package/lib/external/renderers/css-2d-renderer.js +121 -0
  15. package/lib/external/renderers/css-3d-renderer.d.ts +18 -0
  16. package/lib/external/renderers/css-3d-renderer.js +138 -0
  17. package/lib/external/transform-controls.d.ts +106 -0
  18. package/lib/external/transform-controls.js +1112 -0
  19. package/lib/owlly/controller/aerial-element-controller.d.ts +65 -0
  20. package/lib/owlly/controller/aerial-element-controller.js +235 -0
  21. package/lib/owlly/controller/basic-controller.d.ts +324 -0
  22. package/lib/owlly/controller/basic-controller.js +1238 -0
  23. package/lib/owlly/controller/camera-controller.d.ts +37 -0
  24. package/lib/owlly/controller/camera-controller.js +137 -0
  25. package/lib/owlly/controller/controller.d.ts +61 -0
  26. package/lib/owlly/controller/controller.js +23 -0
  27. package/lib/owlly/controller/index.d.ts +2 -0
  28. package/lib/owlly/controller/index.js +13 -0
  29. package/lib/owlly/controller/mouse-indicator-controller.d.ts +34 -0
  30. package/lib/owlly/controller/mouse-indicator-controller.js +118 -0
  31. package/lib/owlly/controller/orbit-control.d.ts +147 -0
  32. package/lib/owlly/controller/orbit-control.js +264 -0
  33. package/lib/owlly/controller/panorama-adjust-controller.d.ts +45 -0
  34. package/lib/owlly/controller/panorama-adjust-controller.js +157 -0
  35. package/lib/owlly/controller/panorama-controller.d.ts +441 -0
  36. package/lib/owlly/controller/panorama-controller.js +1943 -0
  37. package/lib/owlly/controller/panorama-transform-controller.d.ts +66 -0
  38. package/lib/owlly/controller/panorama-transform-controller.js +136 -0
  39. package/lib/owlly/controller/plane-controller.d.ts +43 -0
  40. package/lib/owlly/controller/plane-controller.js +173 -0
  41. package/lib/owlly/controller/texture-controller.d.ts +181 -0
  42. package/lib/owlly/controller/texture-controller.js +875 -0
  43. package/lib/owlly/controller/tile-panorama-controller.d.ts +308 -0
  44. package/lib/owlly/controller/tile-panorama-controller.js +1353 -0
  45. package/lib/owlly/controller/transform-controller.d.ts +106 -0
  46. package/lib/owlly/controller/transform-controller.js +545 -0
  47. package/lib/owlly/element/bottom-nav-element.d.ts +65 -0
  48. package/lib/owlly/element/bottom-nav-element.js +257 -0
  49. package/lib/owlly/element/camera.d.ts +82 -0
  50. package/lib/owlly/element/camera.js +283 -0
  51. package/lib/owlly/element/dom-2d-element.d.ts +35 -0
  52. package/lib/owlly/element/dom-2d-element.js +48 -0
  53. package/lib/owlly/element/dom-3d-element.d.ts +27 -0
  54. package/lib/owlly/element/dom-3d-element.js +33 -0
  55. package/lib/owlly/element/dom-label-2d.d.ts +116 -0
  56. package/lib/owlly/element/dom-label-2d.js +382 -0
  57. package/lib/owlly/element/element.d.ts +53 -0
  58. package/lib/owlly/element/element.js +75 -0
  59. package/lib/owlly/element/floor-model.d.ts +83 -0
  60. package/lib/owlly/element/floor-model.js +227 -0
  61. package/lib/owlly/element/gif-kit/Gif.d.ts +96 -0
  62. package/lib/owlly/element/gif-kit/Gif.js +432 -0
  63. package/lib/owlly/element/gif-kit/GifColor.d.ts +21 -0
  64. package/lib/owlly/element/gif-kit/GifColor.js +37 -0
  65. package/lib/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
  66. package/lib/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.js +50 -0
  67. package/lib/owlly/element/gif-kit/GifFrame.d.ts +31 -0
  68. package/lib/owlly/element/gif-kit/GifFrame.js +96 -0
  69. package/lib/owlly/element/gif-kit/GifImage.d.ts +23 -0
  70. package/lib/owlly/element/gif-kit/GifImage.js +7 -0
  71. package/lib/owlly/element/gif-kit/GifParser.d.ts +17 -0
  72. package/lib/owlly/element/gif-kit/GifParser.js +196 -0
  73. package/lib/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
  74. package/lib/owlly/element/gif-kit/GifPresenter.js +43 -0
  75. package/lib/owlly/element/gif-kit/GifVersion.d.ts +10 -0
  76. package/lib/owlly/element/gif-kit/GifVersion.js +12 -0
  77. package/lib/owlly/element/gltf-mesh-element.d.ts +31 -0
  78. package/lib/owlly/element/gltf-mesh-element.js +136 -0
  79. package/lib/owlly/element/index.d.ts +20 -0
  80. package/lib/owlly/element/index.js +24 -0
  81. package/lib/owlly/element/map-kit/shape.d.ts +131 -0
  82. package/lib/owlly/element/map-kit/shape.js +189 -0
  83. package/lib/owlly/element/mesh-element.d.ts +22 -0
  84. package/lib/owlly/element/mesh-element.js +63 -0
  85. package/lib/owlly/element/mesh-line-2d.d.ts +82 -0
  86. package/lib/owlly/element/mesh-line-2d.js +887 -0
  87. package/lib/owlly/element/meshline-o.d.ts +64 -0
  88. package/lib/owlly/element/meshline-o.js +678 -0
  89. package/lib/owlly/element/panorama-group.d.ts +241 -0
  90. package/lib/owlly/element/panorama-group.js +966 -0
  91. package/lib/owlly/element/panorama.d.ts +132 -0
  92. package/lib/owlly/element/panorama.js +812 -0
  93. package/lib/owlly/element/path-group.d.ts +69 -0
  94. package/lib/owlly/element/path-group.js +171 -0
  95. package/lib/owlly/element/path.d.ts +99 -0
  96. package/lib/owlly/element/path.js +531 -0
  97. package/lib/owlly/element/placeable-2d.d.ts +158 -0
  98. package/lib/owlly/element/placeable-2d.js +470 -0
  99. package/lib/owlly/element/polygon-mesh.d.ts +107 -0
  100. package/lib/owlly/element/polygon-mesh.js +307 -0
  101. package/lib/owlly/element/ring-element.d.ts +79 -0
  102. package/lib/owlly/element/ring-element.js +383 -0
  103. package/lib/owlly/element/sphere-mesh.d.ts +28 -0
  104. package/lib/owlly/element/sphere-mesh.js +69 -0
  105. package/lib/owlly/element/svg-floor-model.d.ts +22 -0
  106. package/lib/owlly/element/svg-floor-model.js +184 -0
  107. package/lib/owlly/element/svg-floors.d.ts +27 -0
  108. package/lib/owlly/element/svg-floors.js +109 -0
  109. package/lib/owlly/element/tile-panorama-group.d.ts +335 -0
  110. package/lib/owlly/element/tile-panorama-group.js +1006 -0
  111. package/lib/owlly/element/tile-panorama.d.ts +161 -0
  112. package/lib/owlly/element/tile-panorama.js +509 -0
  113. package/lib/owlly/element/tile-plane.d.ts +105 -0
  114. package/lib/owlly/element/tile-plane.js +360 -0
  115. package/lib/owlly/element/video-element.d.ts +33 -0
  116. package/lib/owlly/element/video-element.js +159 -0
  117. package/lib/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
  118. package/lib/owlly/geometries/ExtrudeGeometry2.js +210 -0
  119. package/lib/owlly/index.d.ts +13 -0
  120. package/lib/owlly/index.js +16 -0
  121. package/lib/owlly/overlay/canvas-overlay.d.ts +96 -0
  122. package/lib/owlly/overlay/canvas-overlay.js +510 -0
  123. package/lib/owlly/overlay/css-2d-overlay.d.ts +14 -0
  124. package/lib/owlly/overlay/css-2d-overlay.js +35 -0
  125. package/lib/owlly/overlay/css-3d-overlay.d.ts +16 -0
  126. package/lib/owlly/overlay/css-3d-overlay.js +36 -0
  127. package/lib/owlly/overlay/index.d.ts +6 -0
  128. package/lib/owlly/overlay/index.js +11 -0
  129. package/lib/owlly/overlay/label-overlay.d.ts +62 -0
  130. package/lib/owlly/overlay/label-overlay.js +328 -0
  131. package/lib/owlly/overlay/overlay.d.ts +14 -0
  132. package/lib/owlly/overlay/overlay.js +4 -0
  133. package/lib/owlly/overlay/path-overlay.d.ts +39 -0
  134. package/lib/owlly/overlay/path-overlay.js +124 -0
  135. package/lib/owlly/overlay/path-overlay2.d.ts +35 -0
  136. package/lib/owlly/overlay/path-overlay2.js +118 -0
  137. package/lib/owlly/overlay/poi-overlay-3d.d.ts +278 -0
  138. package/lib/owlly/overlay/poi-overlay-3d.js +1432 -0
  139. package/lib/owlly/overlay/poi-overlay.d.ts +277 -0
  140. package/lib/owlly/overlay/poi-overlay.js +1411 -0
  141. package/lib/owlly/owlly-2d/index.d.ts +28 -0
  142. package/lib/owlly/owlly-2d/index.js +92 -0
  143. package/lib/owlly/screen/index.d.ts +1 -0
  144. package/lib/owlly/screen/index.js +1 -0
  145. package/lib/owlly/screen/screen.d.ts +73 -0
  146. package/lib/owlly/screen/screen.js +236 -0
  147. package/lib/owlly/stage/externals.d.ts +19 -0
  148. package/lib/owlly/stage/externals.js +24 -0
  149. package/lib/owlly/stage/index.d.ts +4 -0
  150. package/lib/owlly/stage/index.js +6 -0
  151. package/lib/owlly/stage/owlly.d.ts +38 -0
  152. package/lib/owlly/stage/owlly.js +168 -0
  153. package/lib/owlly/stage/stage.d.ts +108 -0
  154. package/lib/owlly/stage/stage.js +234 -0
  155. package/lib/owlly/utils/alignment-utils.d.ts +20 -0
  156. package/lib/owlly/utils/alignment-utils.js +63 -0
  157. package/lib/owlly/utils/basic-calc.d.ts +18 -0
  158. package/lib/owlly/utils/basic-calc.js +129 -0
  159. package/lib/owlly/utils/basic-tools.d.ts +71 -0
  160. package/lib/owlly/utils/basic-tools.js +235 -0
  161. package/lib/owlly/utils/bvh-tree.d.ts +105 -0
  162. package/lib/owlly/utils/bvh-tree.js +539 -0
  163. package/lib/owlly/utils/camera.d.ts +37 -0
  164. package/lib/owlly/utils/camera.js +50 -0
  165. package/lib/owlly/utils/cube-texture-cache.d.ts +25 -0
  166. package/lib/owlly/utils/cube-texture-cache.js +143 -0
  167. package/lib/owlly/utils/device-utils.d.ts +18 -0
  168. package/lib/owlly/utils/device-utils.js +41 -0
  169. package/lib/owlly/utils/environment-utils.d.ts +37 -0
  170. package/lib/owlly/utils/environment-utils.js +73 -0
  171. package/lib/owlly/utils/event-hub.d.ts +50 -0
  172. package/lib/owlly/utils/event-hub.js +106 -0
  173. package/lib/owlly/utils/events.d.ts +219 -0
  174. package/lib/owlly/utils/events.js +219 -0
  175. package/lib/owlly/utils/geometry-utils.d.ts +119 -0
  176. package/lib/owlly/utils/geometry-utils.js +622 -0
  177. package/lib/owlly/utils/helper.d.ts +6 -0
  178. package/lib/owlly/utils/helper.js +24 -0
  179. package/lib/owlly/utils/index.d.ts +14 -0
  180. package/lib/owlly/utils/index.js +17 -0
  181. package/lib/owlly/utils/lru-cache.d.ts +26 -0
  182. package/lib/owlly/utils/lru-cache.js +109 -0
  183. package/lib/owlly/utils/map-utils.d.ts +7 -0
  184. package/lib/owlly/utils/map-utils.js +52 -0
  185. package/lib/owlly/utils/number-utils.d.ts +8 -0
  186. package/lib/owlly/utils/number-utils.js +72 -0
  187. package/lib/owlly/utils/panorama-model-util.d.ts +46 -0
  188. package/lib/owlly/utils/panorama-model-util.js +245 -0
  189. package/lib/owlly/utils/path-utils.d.ts +80 -0
  190. package/lib/owlly/utils/path-utils.js +728 -0
  191. package/lib/owlly/utils/svgutils.d.ts +138 -0
  192. package/lib/owlly/utils/svgutils.js +561 -0
  193. package/lib/owlly/utils/texture-cache.d.ts +29 -0
  194. package/lib/owlly/utils/texture-cache.js +115 -0
  195. package/lib/owlly/utils/tile-util.d.ts +187 -0
  196. package/lib/owlly/utils/tile-util.js +456 -0
  197. package/lib/owlly/utils/time-profiler.d.ts +21 -0
  198. package/lib/owlly/utils/time-profiler.js +48 -0
  199. package/lib/owlly/view/camera-view.d.ts +35 -0
  200. package/lib/owlly/view/camera-view.js +101 -0
  201. package/lib/owlly/view/index.d.ts +3 -0
  202. package/lib/owlly/view/index.js +5 -0
  203. package/lib/owlly/view/orthographic-view.d.ts +40 -0
  204. package/lib/owlly/view/orthographic-view.js +94 -0
  205. package/lib/owlly/view/perspective-view.d.ts +40 -0
  206. package/lib/owlly/view/perspective-view.js +95 -0
  207. package/lib/owlly/view/svg-map-view.d.ts +46 -0
  208. package/lib/owlly/view/svg-map-view.js +144 -0
  209. package/lib/owlly/view/view.d.ts +146 -0
  210. package/lib/owlly/view/view.js +317 -0
  211. package/lib/prod/owlly.esm.js +93462 -0
  212. package/lib/prod/owlly.esm.js.map +1 -0
  213. package/lib/prod/owlly.esm.min.js +54 -0
  214. package/lib/prod/owlly.iife.js +93560 -0
  215. package/lib/prod/owlly.iife.js.map +1 -0
  216. package/lib/prod/owlly.iife.min.js +69 -0
  217. package/lib/prod/owlly.miniapp.js +73845 -0
  218. package/lib/prod/owlly.miniapp.js.map +1 -0
  219. package/lib/prod/owlly.miniapp.min.js +63 -0
  220. package/lib/prod/src/external/lines/line-geometry.d.ts +9 -0
  221. package/lib/prod/src/external/lines/line-material.d.ts +10 -0
  222. package/lib/prod/src/external/lines/line-segments-2.d.ts +7 -0
  223. package/lib/prod/src/external/lines/line-segments-geometry.d.ts +15 -0
  224. package/lib/prod/src/external/loaders/gltf-loader.d.ts +77 -0
  225. package/lib/prod/src/external/orbit-controls.d.ts +44 -0
  226. package/lib/prod/src/external/renderers/css-2d-renderer.d.ts +16 -0
  227. package/lib/prod/src/external/renderers/css-3d-renderer.d.ts +18 -0
  228. package/lib/prod/src/external/transform-controls.d.ts +106 -0
  229. package/lib/prod/src/external/util/buffer-geometry-utils.d.ts +45 -0
  230. package/lib/prod/src/owlly/controller/aerial-element-controller.d.ts +65 -0
  231. package/lib/prod/src/owlly/controller/basic-controller.d.ts +324 -0
  232. package/lib/prod/src/owlly/controller/camera-controller.d.ts +37 -0
  233. package/lib/prod/src/owlly/controller/controller.d.ts +61 -0
  234. package/lib/prod/src/owlly/controller/index.d.ts +2 -0
  235. package/lib/prod/src/owlly/controller/mouse-indicator-controller.d.ts +34 -0
  236. package/lib/prod/src/owlly/controller/orbit-control.d.ts +147 -0
  237. package/lib/prod/src/owlly/controller/panorama-adjust-controller.d.ts +45 -0
  238. package/lib/prod/src/owlly/controller/panorama-controller.d.ts +441 -0
  239. package/lib/prod/src/owlly/controller/panorama-transform-controller.d.ts +66 -0
  240. package/lib/prod/src/owlly/controller/plane-controller.d.ts +43 -0
  241. package/lib/prod/src/owlly/controller/texture-controller.d.ts +183 -0
  242. package/lib/prod/src/owlly/controller/tile-panorama-controller.d.ts +308 -0
  243. package/lib/prod/src/owlly/controller/transform-controller.d.ts +106 -0
  244. package/lib/prod/src/owlly/element/bottom-nav-element.d.ts +65 -0
  245. package/lib/prod/src/owlly/element/camera.d.ts +82 -0
  246. package/lib/prod/src/owlly/element/dom-2d-element.d.ts +35 -0
  247. package/lib/prod/src/owlly/element/dom-3d-element.d.ts +27 -0
  248. package/lib/prod/src/owlly/element/dom-label-2d.d.ts +116 -0
  249. package/lib/prod/src/owlly/element/element.d.ts +53 -0
  250. package/lib/prod/src/owlly/element/floor-model.d.ts +83 -0
  251. package/lib/prod/src/owlly/element/gif-kit/Gif.d.ts +96 -0
  252. package/lib/prod/src/owlly/element/gif-kit/GifColor.d.ts +21 -0
  253. package/lib/prod/src/owlly/element/gif-kit/GifCompressedCodesToByteArrayConverter.d.ts +20 -0
  254. package/lib/prod/src/owlly/element/gif-kit/GifFrame.d.ts +31 -0
  255. package/lib/prod/src/owlly/element/gif-kit/GifImage.d.ts +23 -0
  256. package/lib/prod/src/owlly/element/gif-kit/GifParser.d.ts +17 -0
  257. package/lib/prod/src/owlly/element/gif-kit/GifPresenter.d.ts +20 -0
  258. package/lib/prod/src/owlly/element/gif-kit/GifVersion.d.ts +10 -0
  259. package/lib/prod/src/owlly/element/gltf-mesh-element.d.ts +31 -0
  260. package/lib/prod/src/owlly/element/index.d.ts +6 -0
  261. package/lib/prod/src/owlly/element/map-kit/area.d.ts +24 -0
  262. package/lib/prod/src/owlly/element/map-kit/block-set.d.ts +39 -0
  263. package/lib/prod/src/owlly/element/map-kit/block.d.ts +77 -0
  264. package/lib/prod/src/owlly/element/map-kit/index.d.ts +3 -0
  265. package/lib/prod/src/owlly/element/map-kit/shape.d.ts +131 -0
  266. package/lib/prod/src/owlly/element/mesh-element.d.ts +22 -0
  267. package/lib/prod/src/owlly/element/mesh-line-2d.d.ts +82 -0
  268. package/lib/prod/src/owlly/element/meshline-o.d.ts +64 -0
  269. package/lib/prod/src/owlly/element/panorama-group.d.ts +241 -0
  270. package/lib/prod/src/owlly/element/panorama.d.ts +132 -0
  271. package/lib/prod/src/owlly/element/path-group.d.ts +69 -0
  272. package/lib/prod/src/owlly/element/path.d.ts +99 -0
  273. package/lib/prod/src/owlly/element/placeable-2d.d.ts +158 -0
  274. package/lib/prod/src/owlly/element/polygon-mesh.d.ts +107 -0
  275. package/lib/prod/src/owlly/element/ring-element.d.ts +79 -0
  276. package/lib/prod/src/owlly/element/sphere-mesh.d.ts +28 -0
  277. package/lib/prod/src/owlly/element/svg-floor-model.d.ts +22 -0
  278. package/lib/prod/src/owlly/element/svg-floors.d.ts +27 -0
  279. package/lib/prod/src/owlly/element/tile-panorama-group.d.ts +335 -0
  280. package/lib/prod/src/owlly/element/tile-panorama.d.ts +162 -0
  281. package/lib/prod/src/owlly/element/tile-plane.d.ts +114 -0
  282. package/lib/prod/src/owlly/element/video-element.d.ts +33 -0
  283. package/lib/prod/src/owlly/geometries/ExtrudeGeometry2.d.ts +15 -0
  284. package/lib/prod/src/owlly/index.d.ts +13 -0
  285. package/lib/prod/src/owlly/overlay/canvas-overlay.d.ts +96 -0
  286. package/lib/prod/src/owlly/overlay/css-2d-overlay.d.ts +14 -0
  287. package/lib/prod/src/owlly/overlay/css-3d-overlay.d.ts +16 -0
  288. package/lib/prod/src/owlly/overlay/index.d.ts +5 -0
  289. package/lib/prod/src/owlly/overlay/label-overlay.d.ts +62 -0
  290. package/lib/prod/src/owlly/overlay/overlay.d.ts +14 -0
  291. package/lib/prod/src/owlly/overlay/path-overlay.d.ts +39 -0
  292. package/lib/prod/src/owlly/overlay/path-overlay2.d.ts +35 -0
  293. package/lib/prod/src/owlly/overlay/poi-overlay-3d.d.ts +278 -0
  294. package/lib/prod/src/owlly/overlay/poi-overlay.d.ts +277 -0
  295. package/lib/prod/src/owlly/owlly-2d/index.d.ts +28 -0
  296. package/lib/prod/src/owlly/screen/index.d.ts +1 -0
  297. package/lib/prod/src/owlly/screen/screen.d.ts +73 -0
  298. package/lib/prod/src/owlly/stage/__test__/stage.spec.d.ts +1 -0
  299. package/lib/prod/src/owlly/stage/externals.d.ts +19 -0
  300. package/lib/prod/src/owlly/stage/index.d.ts +3 -0
  301. package/lib/prod/src/owlly/stage/owlly.d.ts +38 -0
  302. package/lib/prod/src/owlly/stage/stage.d.ts +108 -0
  303. package/lib/prod/src/owlly/utils/alignment-utils.d.ts +20 -0
  304. package/lib/prod/src/owlly/utils/basic-calc.d.ts +18 -0
  305. package/lib/prod/src/owlly/utils/basic-tools.d.ts +71 -0
  306. package/lib/prod/src/owlly/utils/bvh-tree.d.ts +105 -0
  307. package/lib/prod/src/owlly/utils/camera.d.ts +37 -0
  308. package/lib/prod/src/owlly/utils/cube-texture-cache.d.ts +25 -0
  309. package/lib/prod/src/owlly/utils/device-utils.d.ts +18 -0
  310. package/lib/prod/src/owlly/utils/environment-utils.d.ts +37 -0
  311. package/lib/prod/src/owlly/utils/event-hub.d.ts +50 -0
  312. package/lib/prod/src/owlly/utils/events.d.ts +219 -0
  313. package/lib/prod/src/owlly/utils/geometry-utils.d.ts +119 -0
  314. package/lib/prod/src/owlly/utils/helper.d.ts +6 -0
  315. package/lib/prod/src/owlly/utils/index.d.ts +13 -0
  316. package/lib/prod/src/owlly/utils/lru-cache.d.ts +26 -0
  317. package/lib/prod/src/owlly/utils/map-utils.d.ts +7 -0
  318. package/lib/prod/src/owlly/utils/number-utils.d.ts +8 -0
  319. package/lib/prod/src/owlly/utils/panorama-model-util.d.ts +46 -0
  320. package/lib/prod/src/owlly/utils/path-utils.d.ts +80 -0
  321. package/lib/prod/src/owlly/utils/svgutils.d.ts +138 -0
  322. package/lib/prod/src/owlly/utils/texture-cache.d.ts +29 -0
  323. package/lib/prod/src/owlly/utils/tile-util.d.ts +187 -0
  324. package/lib/prod/src/owlly/utils/time-profiler.d.ts +21 -0
  325. package/lib/prod/src/owlly/view/__test__/perspective-view.spec.d.ts +0 -0
  326. package/lib/prod/src/owlly/view/camera-view.d.ts +35 -0
  327. package/lib/prod/src/owlly/view/index.d.ts +3 -0
  328. package/lib/prod/src/owlly/view/orthographic-view.d.ts +40 -0
  329. package/lib/prod/src/owlly/view/perspective-view.d.ts +40 -0
  330. package/lib/prod/src/owlly/view/svg-map-view.d.ts +46 -0
  331. package/lib/prod/src/owlly/view/view.d.ts +146 -0
  332. package/lib/src/owlly/controller/texture-controller.d.ts +3 -1
  333. package/lib/src/owlly/controller/texture-controller.js +16 -1
  334. package/lib/src/owlly/controller/texture-controller.js.map +1 -1
  335. package/lib/src/owlly/controller/tile-panorama-controller.js +4 -0
  336. package/lib/src/owlly/controller/tile-panorama-controller.js.map +1 -1
  337. package/lib/src/owlly/element/tile-panorama.d.ts +1 -0
  338. package/lib/src/owlly/element/tile-panorama.js +16 -3
  339. package/lib/src/owlly/element/tile-panorama.js.map +1 -1
  340. package/lib/src/owlly/element/tile-plane.d.ts +9 -0
  341. package/lib/src/owlly/element/tile-plane.js +27 -0
  342. package/lib/src/owlly/element/tile-plane.js.map +1 -1
  343. package/lib/src/owlly/overlay/poi-overlay-3d.js.map +1 -1
  344. package/lib/src/owlly/overlay/poi-overlay.js.map +1 -1
  345. package/lib/src/owlly/stage/owlly.js +7 -1
  346. package/lib/src/owlly/stage/owlly.js.map +1 -1
  347. package/lib/src/owlly/stage/stage.js +2 -0
  348. package/lib/src/owlly/stage/stage.js.map +1 -1
  349. package/lib/src/web/main.rpeng.mes.plane.js.map +1 -1
  350. package/package.json +16 -7
  351. package/src/owlly/controller/texture-controller.ts +18 -1
  352. package/src/owlly/controller/tile-panorama-controller.ts +3 -1
  353. package/src/owlly/element/tile-panorama.ts +14 -0
  354. package/src/owlly/element/tile-plane.ts +26 -0
  355. package/src/owlly/overlay/poi-overlay-3d.ts +0 -4
  356. package/src/owlly/overlay/poi-overlay.ts +0 -4
  357. package/src/owlly/stage/owlly.ts +6 -1
  358. package/src/owlly/stage/stage.ts +2 -0
  359. package/src/web/main.rpeng.mes.plane.ts +0 -6
@@ -0,0 +1,622 @@
1
+ import earcut from 'earcut';
2
+ import polygonClipping from 'polygon-clipping';
3
+ import { vec2, vec3 } from 'gl-matrix';
4
+ import { Externals } from '../stage/externals';
5
+ /**
6
+ * 图形相关的工具函数
7
+ * @ignore
8
+ */
9
+ class GeometryUtils {
10
+ /**
11
+ * 计算环多边形面积
12
+ * @param polygon 二维顶点数组
13
+ * 借鉴area-polygon的实现
14
+ */
15
+ static RingPolygonArea(points, signed) {
16
+ const l = points.length;
17
+ let det = 0;
18
+ const isSigned = signed || false;
19
+ function normalize(point) {
20
+ if (!Array.isArray(point))
21
+ return point;
22
+ return {
23
+ x: point[0],
24
+ y: point[1],
25
+ };
26
+ }
27
+ let opoints = points.map(normalize);
28
+ if (opoints[0] !== opoints[opoints.length - 1]) {
29
+ opoints = opoints.concat(opoints[0]);
30
+ }
31
+ for (let i = 0; i < l; i++) {
32
+ det += opoints[i].x * opoints[i + 1].y
33
+ - opoints[i].y * opoints[i + 1].x;
34
+ }
35
+ if (isSigned)
36
+ return det / 2;
37
+ return Math.abs(det) / 2;
38
+ }
39
+ /**
40
+ * 求多边形质心
41
+ * https://jingsam.github.io/2016/10/05/centroid.html
42
+ * @param polygon 按逆时针排列的二维顶点数组
43
+ */
44
+ static Centroid(polygon) {
45
+ let totalArea = 0;
46
+ let totalX = 0;
47
+ let totalY = 0;
48
+ for (let i = 0; i < polygon.length; i += 1) {
49
+ // p1, p2以及原点构成一个三角形
50
+ const p1 = polygon[i];
51
+ const p2 = (i === polygon.length - 1) ? polygon[0] : polygon[i + 1];
52
+ const area = 0.5 * (p1[0] * p2[1] - p2[0] * p1[1]); // 计算面积
53
+ const x = (p1[0] + p2[0]) / 3; // 计算x方向质心
54
+ const y = (p1[1] + p2[1]) / 3; // 计算y方向质心
55
+ totalArea += area;
56
+ totalX += area * x;
57
+ totalY += area * y;
58
+ }
59
+ return [totalX / totalArea, totalY / totalArea];
60
+ }
61
+ /**
62
+ * 求点到线段的距离
63
+ * https://jingsam.github.io/2016/09/26/polydist.html
64
+ * @param p 求到线段距离的点
65
+ * @param a 线段端点1
66
+ * @param b 线段端点2
67
+ */
68
+ static PointToSegmentDistance(p, a, b) {
69
+ const AB = [b[0] - a[0], b[1] - a[1]];
70
+ const AP = [p[0] - a[0], p[1] - a[1]];
71
+ const AB_AP = AB[0] * AP[0] + AB[1] * AP[1];
72
+ const distAB2 = AB[0] * AB[0] + AB[1] * AB[1];
73
+ let D = [a[0], a[1]];
74
+ if (distAB2 !== 0) {
75
+ const t = AB_AP / distAB2;
76
+ if (t > 1) {
77
+ D = [b[0], b[1]];
78
+ }
79
+ else if (t > 0) {
80
+ D = [a[0] + AB[0] * t, a[1] + AB[1] * t];
81
+ }
82
+ else {
83
+ D = [a[0], a[1]];
84
+ }
85
+ }
86
+ const DP = [p[0] - D[0], p[1] - D[1]];
87
+ return Math.sqrt(DP[0] * DP[0] + DP[1] * DP[1]);
88
+ }
89
+ /**
90
+ * 判断点是否在多边形内部
91
+ * @param p 二维点
92
+ * @param polygonLoops 二维多边形顶点环数组,至少有一个环,第二个及以后的环代表内部孔
93
+ */
94
+ static PointInPolygon(p, polygonLoops) {
95
+ // 统计p点右边交点的个数
96
+ let count = 0;
97
+ for (let k = 0; k < polygonLoops.length; k += 1) {
98
+ const loop = polygonLoops[k];
99
+ for (let i = 0; i < loop.length; i += 1) {
100
+ const v1 = loop[i];
101
+ const v2 = (i === loop.length - 1) ? loop[0] : loop[i + 1];
102
+ if ((v1[1] > p[1]) !== (v2[1] > p[1])
103
+ && (p[0] < (v2[0] - v1[0]) * (p[1] - v1[1]) / (v2[1] - v1[1]) + v1[0])) {
104
+ count += 1;
105
+ }
106
+ }
107
+ }
108
+ return (count % 2) !== 0;
109
+ }
110
+ /**
111
+ * 不考虑点是否在多边形内部,求最小距离
112
+ * https://jingsam.github.io/2016/09/26/polydist.html
113
+ * @param p 二维点
114
+ * @param polygonLoops 二维多边形顶点环数组,至少有一个环,第二个及以后的环代表内部孔
115
+ */
116
+ static MinDistanceFromPointToPolygon(p, polygonLoops) {
117
+ let minDist = Infinity;
118
+ for (let k = 0; k < polygonLoops.length; k += 1) {
119
+ const loop = polygonLoops[k];
120
+ for (let i = 0; i < loop.length; i += 1) {
121
+ const v1 = loop[i];
122
+ const v2 = (i === loop.length - 1) ? loop[0] : loop[i + 1];
123
+ minDist = Math.min(minDist, this.PointToSegmentDistance(p, v1, v2));
124
+ }
125
+ }
126
+ return minDist;
127
+ }
128
+ /**
129
+ * 考虑点是否在多边形内部,求最小距离。若在多边形外部,距离为负值
130
+ * https://jingsam.github.io/2016/09/26/polydist.html
131
+ * @param p 二维点
132
+ * @param polygonLoops 二维多边形顶点环数组,至少有一个环,第二个及以后的环代表内部孔
133
+ */
134
+ static PointDistanceToPolygon(p, polygonLoops) {
135
+ const dist = this.MinDistanceFromPointToPolygon(p, polygonLoops);
136
+ if (!this.PointInPolygon(p, polygonLoops)) {
137
+ // console.info(`#Centroid# PointDistanceToPolygon()=${dist}: p out of polygon:`, p, polygonLoops);
138
+ return -dist;
139
+ }
140
+ return dist;
141
+ }
142
+ static CellOfPolygon(x, y, h, polygon) {
143
+ const d = this.PointDistanceToPolygon([x, y], polygon);
144
+ const max = d + h * Math.SQRT2;
145
+ const ret = {
146
+ x,
147
+ y,
148
+ h,
149
+ d,
150
+ max,
151
+ };
152
+ return ret;
153
+ }
154
+ /**
155
+ * 得到多边形标注中心
156
+ * https://jingsam.github.io/2016/09/26/polylabel2.html
157
+ * @param polygonLoops 多边形
158
+ */
159
+ static CentroidForPOI(polygonLoops) {
160
+ if (!polygonLoops || polygonLoops.length === 0 || polygonLoops[0].length === 0) {
161
+ return [0, 0];
162
+ }
163
+ const polygon = polygonLoops[0];
164
+ let minX = polygon[0][0];
165
+ let minY = polygon[0][1];
166
+ let maxX = polygon[0][0];
167
+ let maxY = polygon[0][1];
168
+ for (let i = 1; i < polygon.length; i += 1) {
169
+ const [x, y] = polygon[i];
170
+ if (x < minX)
171
+ minX = x;
172
+ if (y < minY)
173
+ minY = y;
174
+ if (x > maxX)
175
+ maxX = x;
176
+ if (y > maxY)
177
+ maxY = y;
178
+ }
179
+ const width = maxX - minX;
180
+ const height = maxY - minY;
181
+ const cellSize = Math.min(width, height);
182
+ // console.log(`#Centroid# Bound=(${minX}, ${minY})~(${maxX}, ${maxY}), cellSize=${cellSize}`);
183
+ let h = cellSize / 2;
184
+ let candidates = [];
185
+ // 将多边形切分
186
+ for (let x = minX; x < maxX; x += cellSize) {
187
+ for (let y = minY; y < maxY; y += cellSize) {
188
+ const cell = this.CellOfPolygon(x + h, y + h, h, polygonLoops);
189
+ candidates.push(cell);
190
+ }
191
+ }
192
+ // 最优格网
193
+ // let bestCell = candidates[0];
194
+ const [x, y] = this.Centroid(polygon);
195
+ let bestCell = this.CellOfPolygon(x, y, h, polygonLoops);
196
+ candidates.push(bestCell);
197
+ // console.info('#Centroid# Best cell:', bestCell);
198
+ const minH = cellSize / 1024;
199
+ while (candidates.length > 1 && candidates[0].h >= minH) {
200
+ candidates = candidates.sort((cell1, cell2) => cell2.max - cell1.max);
201
+ // console.info('#Centroid# After sorting:', candidates);
202
+ for (let i = 0; i < candidates.length; i += 1) {
203
+ const cell = candidates[i];
204
+ if (cell.d > bestCell.d) {
205
+ // console.info('#Centroid# New bestCell:', cell);
206
+ bestCell = cell;
207
+ }
208
+ }
209
+ for (let i = 0; i < candidates.length; i += 1) {
210
+ const cell = candidates[i];
211
+ if (cell.max - bestCell.d <= this.Epsilon) {
212
+ candidates = candidates.slice(0, i);
213
+ break;
214
+ }
215
+ }
216
+ // console.info('#Centroid# After slicing:', candidates);
217
+ const nextCandidates = [];
218
+ // 将格网裂为4个小格网
219
+ h = candidates[0].h / 2;
220
+ for (let i = 0; i < candidates.length; i += 1) {
221
+ const cell = candidates[i];
222
+ nextCandidates.push(this.CellOfPolygon(cell.x - h, cell.y - h, h, polygonLoops));
223
+ nextCandidates.push(this.CellOfPolygon(cell.x + h, cell.y - h, h, polygonLoops));
224
+ nextCandidates.push(this.CellOfPolygon(cell.x - h, cell.y + h, h, polygonLoops));
225
+ nextCandidates.push(this.CellOfPolygon(cell.x + h, cell.y + h, h, polygonLoops));
226
+ }
227
+ candidates = nextCandidates;
228
+ // console.info('#Centroid# After splitting:', candidates);
229
+ }
230
+ return [bestCell.x, bestCell.y];
231
+ }
232
+ // (x - px) * nx + (y - py) * ny + (z - pz) * nz = 0;
233
+ // (x - x1) / (x2 - x1) = (y - y1) / (y2 - y1) = (z - z1) / (z2 - z1)
234
+ static LinePlaneIntersection(lineP0, lineP1, planeP, planeNormal) {
235
+ const { THREE } = Externals.getInstance();
236
+ const { x: x0, y: y0, z: z0 } = lineP0;
237
+ const { x: x1, y: y1, z: z1 } = lineP1;
238
+ const dx = x1 - x0;
239
+ const dy = y1 - y0;
240
+ const dz = z1 - z0;
241
+ const { x: nx, y: ny, z: nz } = planeNormal;
242
+ const { x: px, y: py, z: pz } = planeP;
243
+ const den = nx * dx + ny * dy + nz * dz;
244
+ const num = nx * (px - x0) + ny * (py - y0) + nz * (pz - z0);
245
+ const t = num / den;
246
+ const ret = new THREE.Vector3(x0 + t * dx, y0 + t * dy, z0 + t * dz);
247
+ // console.info('#CutPlane# LinePlaneIntersection of line(v0, v1) with plane(p, n) is:', lineP0, lineP1, planeP, planeNormal, ret);
248
+ return ret;
249
+ }
250
+ static SegmentPlaneIntersection(lineP0, lineP1, planeP, planeNormal) {
251
+ const interPoint = this.LinePlaneIntersection(lineP0, lineP1, planeP, planeNormal);
252
+ if (Number.isNaN(interPoint.x) || !Number.isFinite(interPoint.x))
253
+ return undefined;
254
+ if (Number.isNaN(interPoint.y) || !Number.isFinite(interPoint.y))
255
+ return undefined;
256
+ if (Number.isNaN(interPoint.z) || !Number.isFinite(interPoint.z))
257
+ return undefined;
258
+ const dot = interPoint.clone().sub(lineP0).dot(interPoint.clone().sub(lineP1));
259
+ if (dot <= 0) {
260
+ // console.info('#CutPlane# SegmentPlaneIntersection of line(v0, v1) with plane(p, n) is:', lineP0, lineP1, planeP, planeNormal, interPoint);
261
+ return interPoint;
262
+ }
263
+ // console.info('#CutPlane# SegmentPlaneIntersection of line(v0, v1) with plane(p, n) is undefined', lineP0, lineP1, planeP, planeNormal);
264
+ return undefined;
265
+ }
266
+ static MapPointOnPlane(v, planeP, planeNormal) {
267
+ const { THREE } = Externals.getInstance();
268
+ let up = new THREE.Vector3(0, 1, 0);
269
+ if (up.angleTo(planeNormal) < this.Epsilon) {
270
+ up = new THREE.Vector3(0, 0, 1);
271
+ }
272
+ const m = new THREE.Matrix4().lookAt(planeP, planeP.clone().add(planeNormal), up);
273
+ return v.clone().applyMatrix4(m);
274
+ }
275
+ static ParameterToPlane(a, b, c, d) {
276
+ const { THREE } = Externals.getInstance();
277
+ const distance = Math.abs(d) / Math.sqrt(a * a + b * b + c * c);
278
+ return { normal: new THREE.Vector3(a, b, c), constant: distance };
279
+ }
280
+ static PlaneCutMeshPolygon(p, n, meshVertices, meshTriangles) {
281
+ // Collect intersections:
282
+ const vertices = [];
283
+ const segments = [];
284
+ for (let i = 0; i < meshTriangles.length; i += 3) {
285
+ const v0 = meshVertices[meshTriangles[i]];
286
+ const v1 = meshVertices[meshTriangles[i + 1]];
287
+ const v2 = meshVertices[meshTriangles[i + 2]];
288
+ const trimmedIntersections = [];
289
+ const intersections = [];
290
+ intersections.push(this.SegmentPlaneIntersection(v0, v1, p, n));
291
+ intersections.push(this.SegmentPlaneIntersection(v0, v2, p, n));
292
+ intersections.push(this.SegmentPlaneIntersection(v2, v1, p, n));
293
+ // console.info(`## intersections of #${meshTriangles[i]}, #${meshTriangles[i + 1]}, #${meshTriangles[i + 2]}:`, v0, v1, v2);
294
+ // console.info('## with plane p,n:', p, n);
295
+ // console.info('## is:', intersections);
296
+ intersections.forEach((v) => {
297
+ if (!v)
298
+ return;
299
+ let collide = false;
300
+ for (let j = 0; j < trimmedIntersections.length; j += 1) {
301
+ if (v.distanceTo(trimmedIntersections[j]) <= this.Epsilon) {
302
+ collide = true;
303
+ break;
304
+ }
305
+ }
306
+ if (!collide) {
307
+ trimmedIntersections.push(v);
308
+ }
309
+ });
310
+ if (trimmedIntersections.length === 1) {
311
+ trimmedIntersections.push(trimmedIntersections[0]);
312
+ }
313
+ if (trimmedIntersections.length > 0) {
314
+ segments.push([vertices.length, vertices.length + 1]);
315
+ vertices.push(trimmedIntersections[0], trimmedIntersections[1]);
316
+ }
317
+ }
318
+ // console.info(`## PlaneCutMeshPolygon : segments(${segments.length})=`, segments);
319
+ // console.info(`## PlaneCutMeshPolygon : vertices(${vertices.length})=`, vertices);
320
+ // Link segments to polygon:
321
+ const polygonWithIndex = [];
322
+ const polygon2D = [];
323
+ while (segments.length > 0) {
324
+ let edge = segments.pop();
325
+ const loop = [edge[0], edge[1]];
326
+ let nextEdge;
327
+ do {
328
+ const e01 = vertices[edge[1]];
329
+ nextEdge = undefined;
330
+ // console.info(`## PlaneCutMeshPolygon #1 : segments.length=${segments.length}`);
331
+ for (let i = 0; i < segments.length; i += 1) {
332
+ const segment = segments[i];
333
+ const e10 = vertices[segment[0]];
334
+ const e11 = vertices[segment[1]];
335
+ if (e10.distanceTo(e01) <= this.Epsilon) {
336
+ nextEdge = [segment[0], segment[1]];
337
+ segments.splice(i, 1);
338
+ // console.info(`## PlaneCutMeshPolygon #2A : segments.length=${segments.length}`);
339
+ break;
340
+ }
341
+ else if (e11.distanceTo(e01) <= this.Epsilon) {
342
+ nextEdge = [segment[1], segment[0]];
343
+ segments.splice(i, 1);
344
+ // console.info(`## PlaneCutMeshPolygon #2B : segments.length=${segments.length}`);
345
+ break;
346
+ }
347
+ }
348
+ if (nextEdge) {
349
+ loop.push(nextEdge[1]);
350
+ edge = nextEdge;
351
+ }
352
+ } while (nextEdge);
353
+ // console.info('## PlaneCutMeshPolygon #3');
354
+ polygonWithIndex.push({
355
+ loop: loop.map((vid) => vertices[vid]),
356
+ index: polygon2D.length,
357
+ });
358
+ const loop2D = loop.map((vid) => this.MapPointOnPlane(vertices[vid], p, n));
359
+ polygon2D.push(loop2D.map((v) => [v.x, v.y]));
360
+ }
361
+ // Distinguish outline from holes:
362
+ polygonWithIndex.sort((a, b) => {
363
+ const loopA = polygon2D[a.index];
364
+ const loopB = polygon2D[b.index];
365
+ if (loopB.length === 0)
366
+ return -1;
367
+ if (loopA.length === 0)
368
+ return 1;
369
+ if (this.PointInPolygon(loopB[0], [loopA])) {
370
+ return -1;
371
+ }
372
+ if (this.PointInPolygon(loopA[0], [loopB])) {
373
+ return 1;
374
+ }
375
+ return 0;
376
+ });
377
+ const polygonVertices = [];
378
+ const vertices2D = [];
379
+ const holeIndices = [];
380
+ if (polygonWithIndex.length > 1) {
381
+ for (let i = 0; i < polygonWithIndex.length; i += 1) {
382
+ polygonVertices.push(...polygonWithIndex[i].loop);
383
+ vertices2D.push(...polygon2D[polygonWithIndex[i].index]);
384
+ holeIndices.push(polygonVertices.length);
385
+ }
386
+ }
387
+ else {
388
+ for (let i = 0; i < polygonWithIndex.length; i += 1) {
389
+ polygonVertices.push(...polygonWithIndex[i].loop);
390
+ vertices2D.push(...polygon2D[polygonWithIndex[i].index]);
391
+ }
392
+ }
393
+ const ret = {
394
+ vertices: polygonVertices,
395
+ holeIndices,
396
+ vertices2D,
397
+ };
398
+ return ret;
399
+ }
400
+ static TriangulatePolygon2D(vertices, holeIndices) {
401
+ const plainVertices = [];
402
+ vertices.forEach((vertex) => {
403
+ plainVertices.push(...vertex);
404
+ });
405
+ const triangleIndices = earcut(plainVertices, holeIndices, 2);
406
+ return triangleIndices;
407
+ }
408
+ static TriangulatePolygonLoops2D(polygonLoops) {
409
+ const vertices = [];
410
+ const holes = [];
411
+ polygonLoops.forEach((loop) => {
412
+ vertices.push(...loop);
413
+ holes.push(vertices.length);
414
+ });
415
+ if (holes.length > 0) {
416
+ holes.splice(holes.length - 1, 1);
417
+ }
418
+ const triangles = GeometryUtils.TriangulatePolygon2D(vertices, holes);
419
+ return {
420
+ vertices,
421
+ triangles,
422
+ };
423
+ }
424
+ static LookAtMatrix(eye, target, up) {
425
+ const { THREE } = Externals.getInstance();
426
+ const Fc = target.clone().sub(eye);
427
+ const Rc = Fc.clone().cross(up);
428
+ const Uc = Rc.clone().cross(Fc);
429
+ Fc.normalize();
430
+ Rc.normalize();
431
+ Uc.normalize();
432
+ const tx = -Rc.dot(eye);
433
+ const ty = -Uc.dot(eye);
434
+ const tz = Fc.dot(eye);
435
+ const m = new THREE.Matrix4();
436
+ m.set(Rc.x, Rc.y, Rc.z, tx, Uc.x, Uc.y, Uc.z, ty, -Fc.x, -Fc.y, -Fc.z, tz, 0, 0, 0, 1);
437
+ return m;
438
+ }
439
+ static FrustumMesh(eye, target, up, fovYDegrees, aspectRatio, near, far) {
440
+ const { THREE } = Externals.getInstance();
441
+ const triangles = [0, 1, 3, 3, 1, 2, 0, 4, 1, 1, 4, 5, 1, 5, 6, 1, 6, 2,
442
+ 2, 6, 7, 2, 7, 3, 3, 7, 4, 3, 4, 0, 4, 5, 7, 7, 5, 6];
443
+ const t = Math.tan(Math.PI * fovYDegrees / 360);
444
+ const halfHNear = near * t;
445
+ const halfWNear = near * aspectRatio * t;
446
+ const halfHFar = far * t;
447
+ const halfWFar = far * aspectRatio * t;
448
+ const vertices = [];
449
+ vertices.push(new THREE.Vector3(-halfWNear, -halfHNear, -near));
450
+ vertices.push(new THREE.Vector3(-halfWNear, halfHNear, -near));
451
+ vertices.push(new THREE.Vector3(halfWNear, halfHNear, -near));
452
+ vertices.push(new THREE.Vector3(halfWNear, -halfHNear, -near));
453
+ vertices.push(new THREE.Vector3(-halfWFar, -halfHFar, -far));
454
+ vertices.push(new THREE.Vector3(-halfWFar, halfHFar, -far));
455
+ vertices.push(new THREE.Vector3(halfWFar, halfHFar, -far));
456
+ vertices.push(new THREE.Vector3(halfWFar, -halfHFar, -far));
457
+ const lookAt = this.LookAtMatrix(eye, target, up);
458
+ const m = lookAt.clone().invert();
459
+ // console.info('## lookAt=, m=', lookAt, m);
460
+ return { vertices: vertices.map((v) => v.applyMatrix4(m)), triangles };
461
+ }
462
+ static PolygonIntersection(geom, ...geoms) {
463
+ return polygonClipping.intersection(geom, ...geoms);
464
+ }
465
+ static PolygonDiff(geom, ...geoms) {
466
+ return polygonClipping.difference(geom, ...geoms);
467
+ }
468
+ static PolygonUnion(geom, ...geoms) {
469
+ return polygonClipping.union(geom, ...geoms);
470
+ }
471
+ static PolygonXOR(geom, ...geoms) {
472
+ return polygonClipping.xor(geom, ...geoms);
473
+ }
474
+ /**
475
+ * 计算路径每个路径点与初始点在路径上的距离
476
+ * @param pathPoints 路径点数组
477
+ * @returns 距离数组
478
+ */
479
+ static GetPathDistances(pathPoints) {
480
+ if (!pathPoints.length)
481
+ return [];
482
+ const result = [0];
483
+ if (pathPoints[0].length === 2) {
484
+ for (let i = 1, l = pathPoints.length, prevVec = vec2.set(vec2.create(), pathPoints[0][0], pathPoints[0][1]), currentVec = vec2.create(); i < l; i += 1) {
485
+ vec2.set(currentVec, pathPoints[i][0], pathPoints[i][1]);
486
+ result.push(result[i - 1] + vec2.dist(prevVec, currentVec));
487
+ vec2.copy(prevVec, currentVec);
488
+ }
489
+ }
490
+ else {
491
+ for (let i = 1, l = pathPoints.length, prevVec = vec3.set(vec3.create(), pathPoints[0][0], pathPoints[0][1], pathPoints[0][2]), currentVec = vec3.create(); i < l; i += 1) {
492
+ vec3.set(currentVec, pathPoints[i][0], pathPoints[i][1], pathPoints[i][2]);
493
+ result.push(result[i - 1] + vec3.dist(prevVec, currentVec));
494
+ vec3.copy(prevVec, currentVec);
495
+ }
496
+ }
497
+ return result;
498
+ }
499
+ /**
500
+ * 获取路径上某个距离上的点
501
+ * @param path 路径
502
+ * @param distances 距离数组
503
+ * @param targetDistance 目标距离
504
+ */
505
+ static GetPointOnDistance(path, distances, targetDistance) {
506
+ let left = 0;
507
+ let right = path.length - 1;
508
+ let p = -1;
509
+ while (left < right - 1) {
510
+ p = Math.floor((left + right) / 2);
511
+ if (distances[p] > targetDistance)
512
+ right = p;
513
+ else if (distances[p] < targetDistance)
514
+ left = p;
515
+ else {
516
+ left = p;
517
+ break;
518
+ }
519
+ }
520
+ p = left;
521
+ if (p > -1) {
522
+ if (path[0].length === 2) {
523
+ const from = vec2.set(vec2.create(), path[p][0], path[p][1]);
524
+ if (p === path.length - 1 || targetDistance <= 0)
525
+ return [from[0], from[1]];
526
+ const fromDist = distances[p];
527
+ const to = vec2.set(vec2.create(), path[p + 1][0], path[p + 1][1]);
528
+ const toDist = distances[p + 1];
529
+ const distDiff = toDist - fromDist;
530
+ const vecDiff = vec2.sub(vec2.create(), to, from);
531
+ const result = vec2.add(vec2.create(), from, vec2.scale(vec2.create(), vecDiff, (targetDistance - fromDist) / distDiff));
532
+ return [result[0], result[1]];
533
+ }
534
+ if (path[0].length === 3) {
535
+ const from = vec3.set(vec3.create(), path[p][0], path[p][1], path[p][2]);
536
+ if (p === path.length - 1 || targetDistance <= 0)
537
+ return [from[0], from[1], from[2]];
538
+ const fromDist = distances[p];
539
+ const to = vec3.set(vec3.create(), path[p + 1][0], path[p + 1][1], path[p + 1][2]);
540
+ const toDist = distances[p + 1];
541
+ const distDiff = toDist - fromDist;
542
+ const vecDiff = vec3.sub(vec3.create(), to, from);
543
+ const result = vec3.add(vec3.create(), from, vec3.scale(vec3.create(), vecDiff, (targetDistance - fromDist) / distDiff));
544
+ return [result[0], result[1], result[2]];
545
+ }
546
+ }
547
+ throw new Error(`Cannot find point on distance ${targetDistance}`);
548
+ }
549
+ /**
550
+ * 获取路径上距离某位置最近的点
551
+ * @param position 目标点
552
+ * @param path 路径
553
+ * @param distances 距离数组
554
+ * @param targetPrecision 计算精度, 默认为0.1
555
+ * @param stepLength 搜索步长距离, 默认为8
556
+ */
557
+ static GetNearestPoint(position, path, distances, targetPrecision = 0.1, stepLength = 8) {
558
+ const pathLength = distances[distances.length - 1];
559
+ let precision = stepLength;
560
+ let best = position.length === 2 ? [0, 0] : [0, 0, 0];
561
+ let bestLength = 0;
562
+ let bestDistance = Infinity;
563
+ for (let scan, scanLength = 0, scanDistance; scanLength <= pathLength; scanLength += precision) {
564
+ scan = this.GetPointOnDistance(path, distances, scanLength);
565
+ if (position.length === 2) {
566
+ scanDistance = vec2.dist(vec2.set(vec2.create(), position[0], position[1]), vec2.set(vec2.create(), scan[0], scan[1]));
567
+ }
568
+ else {
569
+ scanDistance = vec3.dist(vec3.set(vec3.create(), position[0], position[1], position[2]), vec3.set(vec3.create(), scan[0], scan[1], scan[2]));
570
+ }
571
+ if (scanDistance < bestDistance) {
572
+ best = scan;
573
+ bestLength = scanLength;
574
+ bestDistance = scanDistance;
575
+ }
576
+ }
577
+ let before;
578
+ let after;
579
+ let beforeLength;
580
+ let afterLength;
581
+ let beforeDistance;
582
+ let afterDistance;
583
+ precision /= 2;
584
+ while (precision > targetPrecision) {
585
+ beforeLength = bestLength - precision;
586
+ before = this.GetPointOnDistance(path, distances, beforeLength);
587
+ if (position.length === 2) {
588
+ beforeDistance = vec2.dist(vec2.set(vec2.create(), position[0], position[1]), vec2.set(vec2.create(), before[0], before[1]));
589
+ }
590
+ else {
591
+ beforeDistance = vec3.dist(vec3.set(vec3.create(), position[0], position[1], position[2]), vec3.set(vec3.create(), before[0], before[1], before[2]));
592
+ }
593
+ afterLength = bestLength + precision;
594
+ after = this.GetPointOnDistance(path, distances, afterLength);
595
+ if (position.length === 2) {
596
+ afterDistance = vec2.dist(vec2.set(vec2.create(), position[0], position[1]), vec2.set(vec2.create(), after[0], after[1]));
597
+ }
598
+ else {
599
+ afterDistance = vec3.dist(vec3.set(vec3.create(), position[0], position[1], position[2]), vec3.set(vec3.create(), after[0], after[1], after[2]));
600
+ }
601
+ if (beforeLength >= 0 && beforeDistance < bestDistance) {
602
+ best = before;
603
+ bestLength = beforeLength;
604
+ bestDistance = beforeDistance;
605
+ }
606
+ else if (afterLength <= pathLength && afterDistance < bestDistance) {
607
+ best = after;
608
+ bestLength = afterLength;
609
+ bestDistance = afterDistance;
610
+ }
611
+ else {
612
+ precision /= 2;
613
+ }
614
+ }
615
+ return {
616
+ point: best,
617
+ distance: bestLength,
618
+ };
619
+ }
620
+ }
621
+ GeometryUtils.Epsilon = 1e-6;
622
+ export { GeometryUtils, };
@@ -0,0 +1,6 @@
1
+ import { Line, AxesHelper } from 'three';
2
+ declare class Helper {
3
+ static createLine(points: [number, number, number][], color?: string, order?: number): Line;
4
+ static createAxes(position: [number, number, number], size?: number, order?: number): AxesHelper;
5
+ }
6
+ export { Helper };
@@ -0,0 +1,24 @@
1
+ import { Vector3, BufferGeometry, DoubleSide, LineBasicMaterial, Line, AxesHelper, } from 'three';
2
+ class Helper {
3
+ static createLine(points, color = '0000ff', order = 10) {
4
+ const vecs = points.map((pt) => new Vector3(...pt));
5
+ const geometry = new BufferGeometry().setFromPoints(vecs);
6
+ const lineMaterial = new LineBasicMaterial({
7
+ color,
8
+ side: DoubleSide,
9
+ depthTest: false,
10
+ });
11
+ const line = new Line(geometry, lineMaterial);
12
+ lineMaterial.needsUpdate = true;
13
+ line.renderOrder = order;
14
+ return line;
15
+ }
16
+ static createAxes(position, size = 10, order = 10) {
17
+ const axesHelper = new AxesHelper(size);
18
+ axesHelper.visible = true;
19
+ axesHelper.position.set(...position);
20
+ axesHelper.renderOrder = order;
21
+ return axesHelper;
22
+ }
23
+ }
24
+ export { Helper };
@@ -0,0 +1,14 @@
1
+ export * from './svgutils';
2
+ export * from './map-utils';
3
+ export * from './event-hub';
4
+ export * from './events';
5
+ export * from './bvh-tree';
6
+ export * from './alignment-utils';
7
+ export * from './geometry-utils';
8
+ export * from './device-utils';
9
+ export * from './environment-utils';
10
+ export * from './basic-tools';
11
+ export * from './path-utils';
12
+ export * from './basic-calc';
13
+ export * from './helper';
14
+ export * from './tile-util';
@@ -0,0 +1,17 @@
1
+ // #if WEB_ONLY
2
+ export * from './svgutils';
3
+ // #endif
4
+ export * from './map-utils';
5
+ export * from './event-hub';
6
+ export * from './events';
7
+ export * from './bvh-tree';
8
+ export * from './alignment-utils';
9
+ export * from './geometry-utils';
10
+ export * from './device-utils';
11
+ export * from './environment-utils';
12
+ // edited by kxiao
13
+ export * from './basic-tools';
14
+ export * from './path-utils';
15
+ export * from './basic-calc';
16
+ export * from './helper';
17
+ export * from './tile-util';