@xort/cga 0.0.93 → 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 (369) hide show
  1. package/THIRD_PARTY_NOTICES.md +47 -0
  2. package/build/@xort_cga.js +14187 -12097
  3. package/build/cga.d.ts +2284 -1983
  4. package/build/cga.esm.js +14179 -0
  5. package/dist/THIRD_PARTY_NOTICES.md +47 -0
  6. package/dist/index.cjs +14320 -0
  7. package/dist/index.cjs.map +1 -0
  8. package/dist/index.d.cts +2358 -0
  9. package/dist/index.d.ts +2358 -38
  10. package/dist/index.js +14181 -56
  11. package/dist/index.js.map +1 -0
  12. package/package.json +59 -47
  13. package/readme.md +162 -247
  14. package/.github/FUNDING.yml +0 -12
  15. package/cga/1./347/202/271/344/270/216/347/272/277/346/200/247/345/205/203/347/264/240/347/232/204/350/267/235/347/246/273.html +0 -601
  16. package/cga/1./347/202/271/344/270/216/347/272/277/346/200/247/345/205/203/347/264/240/347/232/204/350/267/235/347/246/273.md +0 -111
  17. package/cga/2./347/202/271/344/270/216/351/235/242/346/200/247/345/205/203/347/264/240.md +0 -4
  18. package/cga/img//347/202/271/344/270/216/345/260/204/347/272/277.png +0 -0
  19. package/cga/img//347/202/271/344/270/216/347/233/264/347/272/277.png +0 -0
  20. package/cga/img//347/202/271/344/270/216/347/272/277/346/256/265.png +0 -0
  21. package/cga/img//347/233/264/347/272/277/347/232/204/350/241/250/350/276/276/345/274/217.png +0 -0
  22. package/deploy.sh +0 -39
  23. package/dist/IKanimation/Bone.d.ts +0 -7
  24. package/dist/IKanimation/Bone.js +0 -20
  25. package/dist/IKanimation/CCDSolver.d.ts +0 -37
  26. package/dist/IKanimation/CCDSolver.js +0 -93
  27. package/dist/IKanimation/Joint.d.ts +0 -3
  28. package/dist/IKanimation/Joint.js +0 -17
  29. package/dist/IKanimation/constaint/constraint.d.ts +0 -10
  30. package/dist/IKanimation/constaint/constraint.js +0 -25
  31. package/dist/IKanimation/constaint/hinge.d.ts +0 -12
  32. package/dist/IKanimation/constaint/hinge.js +0 -46
  33. package/dist/IKanimation/constaint/slider.d.ts +0 -12
  34. package/dist/IKanimation/constaint/slider.js +0 -44
  35. package/dist/IKanimation/index.d.ts +0 -0
  36. package/dist/IKanimation/index.js +0 -9
  37. package/dist/IKanimation/isolver.d.ts +0 -4
  38. package/dist/IKanimation/isolver.js +0 -10
  39. package/dist/IKanimation/skeleton.d.ts +0 -13
  40. package/dist/IKanimation/skeleton.js +0 -31
  41. package/dist/alg/common.d.ts +0 -114
  42. package/dist/alg/common.js +0 -302
  43. package/dist/alg/curve.d.ts +0 -4
  44. package/dist/alg/curve.js +0 -11
  45. package/dist/alg/delaunator.d.ts +0 -29
  46. package/dist/alg/delaunator.js +0 -442
  47. package/dist/alg/delaunay.d.ts +0 -20
  48. package/dist/alg/delaunay.js +0 -199
  49. package/dist/alg/delaunayslow.d.ts +0 -18
  50. package/dist/alg/delaunayslow.js +0 -140
  51. package/dist/alg/extrude/extrude.d.ts +0 -3
  52. package/dist/alg/extrude/extrude.js +0 -17
  53. package/dist/alg/extrude.d.ts +0 -199
  54. package/dist/alg/extrude.js +0 -728
  55. package/dist/alg/offset/index.d.ts +0 -0
  56. package/dist/alg/offset/index.js +0 -9
  57. package/dist/alg/offset.d.ts +0 -0
  58. package/dist/alg/offset.js +0 -472
  59. package/dist/alg/pointset.d.ts +0 -94
  60. package/dist/alg/pointset.js +0 -223
  61. package/dist/alg/recognition.d.ts +0 -14
  62. package/dist/alg/recognition.js +0 -37
  63. package/dist/alg/result.d.ts +0 -22
  64. package/dist/alg/result.js +0 -2
  65. package/dist/alg/segmentset.d.ts +0 -11
  66. package/dist/alg/segmentset.js +0 -45
  67. package/dist/alg/sort.d.ts +0 -2
  68. package/dist/alg/sort.js +0 -14
  69. package/dist/alg/split.d.ts +0 -8
  70. package/dist/alg/split.js +0 -10
  71. package/dist/alg/trianglution.d.ts +0 -15
  72. package/dist/alg/trianglution.js +0 -70
  73. package/dist/alg/vol.d.ts +0 -6
  74. package/dist/alg/vol.js +0 -18
  75. package/dist/alg/voronoi.d.ts +0 -31
  76. package/dist/alg/voronoi.js +0 -418
  77. package/dist/app.d.ts +0 -1
  78. package/dist/app.js +0 -248
  79. package/dist/basic/distance.d.ts +0 -12
  80. package/dist/basic/distance.js +0 -39
  81. package/dist/csg/bsp.d.ts +0 -9
  82. package/dist/csg/bsp.js +0 -22
  83. package/dist/csg/node.d.ts +0 -12
  84. package/dist/csg/node.js +0 -75
  85. package/dist/csg/polygon.d.ts +0 -43
  86. package/dist/csg/polygon.js +0 -161
  87. package/dist/diamondMaterialShader.d.ts +0 -92
  88. package/dist/diamondMaterialShader.js +0 -118
  89. package/dist/effect/breath-light.d.ts +0 -4
  90. package/dist/effect/breath-light.js +0 -39
  91. package/dist/extends/geometryaid.d.ts +0 -28
  92. package/dist/extends/geometryaid.js +0 -71
  93. package/dist/extends/split.d.ts +0 -3
  94. package/dist/extends/split.js +0 -13
  95. package/dist/glview.d.ts +0 -112
  96. package/dist/glview.js +0 -564
  97. package/dist/math/Color.d.ts +0 -33
  98. package/dist/math/Color.js +0 -235
  99. package/dist/math/Euler.d.ts +0 -46
  100. package/dist/math/Euler.js +0 -225
  101. package/dist/math/HVec3.d.ts +0 -43
  102. package/dist/math/HVec3.js +0 -176
  103. package/dist/math/Mat3.d.ts +0 -29
  104. package/dist/math/Mat3.js +0 -244
  105. package/dist/math/Mat4.d.ts +0 -85
  106. package/dist/math/Mat4.js +0 -791
  107. package/dist/math/Math.d.ts +0 -130
  108. package/dist/math/Math.js +0 -198
  109. package/dist/math/Quat.d.ts +0 -82
  110. package/dist/math/Quat.js +0 -418
  111. package/dist/math/Vec2.d.ts +0 -68
  112. package/dist/math/Vec2.js +0 -328
  113. package/dist/math/Vec3.d.ts +0 -240
  114. package/dist/math/Vec3.js +0 -1082
  115. package/dist/math/Vec4.d.ts +0 -81
  116. package/dist/math/Vec4.js +0 -475
  117. package/dist/math/vecs.d.ts +0 -134
  118. package/dist/math/vecs.js +0 -464
  119. package/dist/render/bufferAttribute.d.ts +0 -104
  120. package/dist/render/bufferAttribute.js +0 -344
  121. package/dist/render/geometry.d.ts +0 -87
  122. package/dist/render/geometry.js +0 -769
  123. package/dist/render/mesh.d.ts +0 -30
  124. package/dist/render/mesh.js +0 -87
  125. package/dist/render/types.d.ts +0 -3
  126. package/dist/render/types.js +0 -8
  127. package/dist/robust/plane.d.ts +0 -7
  128. package/dist/robust/plane.js +0 -17
  129. package/dist/robust/vec.d.ts +0 -15
  130. package/dist/robust/vec.js +0 -71
  131. package/dist/struct/3d/Box.d.ts +0 -23
  132. package/dist/struct/3d/Box.js +0 -109
  133. package/dist/struct/3d/Capsule.d.ts +0 -12
  134. package/dist/struct/3d/Capsule.js +0 -36
  135. package/dist/struct/3d/Circle.d.ts +0 -52
  136. package/dist/struct/3d/Circle.js +0 -138
  137. package/dist/struct/3d/Disk.d.ts +0 -10
  138. package/dist/struct/3d/Disk.js +0 -22
  139. package/dist/struct/3d/Frustum.d.ts +0 -35
  140. package/dist/struct/3d/Frustum.js +0 -159
  141. package/dist/struct/3d/Line.d.ts +0 -40
  142. package/dist/struct/3d/Line.js +0 -340
  143. package/dist/struct/3d/Path.d.ts +0 -75
  144. package/dist/struct/3d/Path.js +0 -308
  145. package/dist/struct/3d/Plane.d.ts +0 -74
  146. package/dist/struct/3d/Plane.js +0 -298
  147. package/dist/struct/3d/Point.d.ts +0 -4
  148. package/dist/struct/3d/Point.js +0 -30
  149. package/dist/struct/3d/Polygon.d.ts +0 -8
  150. package/dist/struct/3d/Polygon.js +0 -55
  151. package/dist/struct/3d/Polyline.d.ts +0 -34
  152. package/dist/struct/3d/Polyline.js +0 -130
  153. package/dist/struct/3d/Ray.d.ts +0 -21
  154. package/dist/struct/3d/Ray.js +0 -262
  155. package/dist/struct/3d/Rectangle.d.ts +0 -7
  156. package/dist/struct/3d/Rectangle.js +0 -35
  157. package/dist/struct/3d/Segment.d.ts +0 -32
  158. package/dist/struct/3d/Segment.js +0 -334
  159. package/dist/struct/3d/Shape.d.ts +0 -4
  160. package/dist/struct/3d/Shape.js +0 -27
  161. package/dist/struct/3d/Sphere.d.ts +0 -11
  162. package/dist/struct/3d/Sphere.js +0 -30
  163. package/dist/struct/3d/Triangle.d.ts +0 -8
  164. package/dist/struct/3d/Triangle.js +0 -53
  165. package/dist/struct/bsp.d.ts +0 -9
  166. package/dist/struct/bsp.js +0 -44
  167. package/dist/struct/btree.d.ts +0 -0
  168. package/dist/struct/btree.js +0 -1
  169. package/dist/struct/data/ArrayList.d.ts +0 -42
  170. package/dist/struct/data/ArrayList.js +0 -172
  171. package/dist/struct/data/ArrayObject.d.ts +0 -30
  172. package/dist/struct/data/ArrayObject.js +0 -131
  173. package/dist/struct/data/type.d.ts +0 -13
  174. package/dist/struct/data/type.js +0 -18
  175. package/dist/struct/kdtree.d.ts +0 -0
  176. package/dist/struct/kdtree.js +0 -1
  177. package/dist/struct/polyTree.d.ts +0 -4
  178. package/dist/struct/polyTree.js +0 -27
  179. package/dist/struct/quatTree.d.ts +0 -0
  180. package/dist/struct/quatTree.js +0 -1
  181. package/dist/struct/tree.d.ts +0 -11
  182. package/dist/struct/tree.js +0 -26
  183. package/dist/utils/array.d.ts +0 -24
  184. package/dist/utils/array.js +0 -89
  185. package/dist/utils/types.d.ts +0 -24
  186. package/dist/utils/types.js +0 -20
  187. package/docs/.vuepress/components/distance.vue +0 -125
  188. package/docs/.vuepress/components/intersect.vue +0 -0
  189. package/docs/.vuepress/components/trianglution.vue +0 -121
  190. package/docs/.vuepress/components/utils.js +0 -314
  191. package/docs/.vuepress/config.js +0 -99
  192. package/docs/.vuepress/enhanceApp.js +0 -13
  193. package/docs/.vuepress/public/delaunay.png +0 -0
  194. package/docs/.vuepress/public/logo.png +0 -0
  195. package/docs/.vuepress/public/plane-set-convex.png +0 -0
  196. package/docs/.vuepress/public/sponsor/alipay.jpg +0 -0
  197. package/docs/.vuepress/public/sponsor/wechat.png +0 -0
  198. package/docs/README.md +0 -14
  199. package/docs/demo/README.md +0 -9
  200. package/docs/guide/README.md +0 -94
  201. package/docs/guide/array.md +0 -10
  202. package/docs/guide/cy/trianglution.html +0 -2
  203. package/docs/guide/distLineAll.md +0 -85
  204. package/docs/guide/distPointAll.md +0 -137
  205. package/docs/guide/distRayAll.md +0 -69
  206. package/docs/guide/distSegmentAll.md +0 -19
  207. package/docs/guide/point.vue +0 -12
  208. package/docs/guide/vector.md +0 -10
  209. package/docs/guide//345/270/270/347/224/250.md +0 -156
  210. package/docs/sponsor/README.md +0 -15
  211. package/docs//345/274/200/345/217/221/346/227/245/345/277/227/2020/345/271/2643/346/234/21013/346/227/245.md +0 -6
  212. package/effect/common.glsl +0 -34
  213. package/effect/drawing.glsl +0 -36
  214. package/effect/shape.arc.glsl +0 -13
  215. package/effect/shape.circle.glsl +0 -13
  216. package/effect/shape.grid.glsl +0 -42
  217. package/effect/shape.line.glsl +0 -18
  218. package/effect/shape.pie.glsl +0 -18
  219. package/effect/shape.plot.glsl +0 -10
  220. package/effect/shape.poly.glsl +0 -15
  221. package/effect/shape.rect.glsl +0 -14
  222. package/effect/shape.rectround.glsl +0 -15
  223. package/effect/shape.segment.glsl +0 -10
  224. package/effect/shape.spiral.glsl +0 -12
  225. package/effect/shape.star.glsl +0 -16
  226. package/examples/index.html +0 -31
  227. package/git.sh +0 -12
  228. package/gitproxy.sh +0 -6
  229. package/image/readme/1640758500266.png +0 -0
  230. package/image/readme/1640758513361.png +0 -0
  231. package/index.html +0 -14
  232. package/linear algorithm//346/225/260/345/255/246/350/241/250/350/276/276/345/274/217.md" +0 -122
  233. package/linear algorithm//347/237/251/351/230/265.md" +0 -91
  234. package/rollup.config.js +0 -82
  235. package/scripttest.html +0 -23
  236. package/src/IKanimation/Bone.ts +0 -20
  237. package/src/IKanimation/CCDSolver.ts +0 -114
  238. package/src/IKanimation/Joint.ts +0 -13
  239. package/src/IKanimation/constaint/constraint.ts +0 -23
  240. package/src/IKanimation/constaint/hinge.ts +0 -29
  241. package/src/IKanimation/constaint/slider.ts +0 -25
  242. package/src/IKanimation/index.ts +0 -8
  243. package/src/IKanimation/isolver.ts +0 -13
  244. package/src/IKanimation/skeleton.ts +0 -30
  245. package/src/alg/common.ts +0 -304
  246. package/src/alg/curve.ts +0 -9
  247. package/src/alg/delaunator.ts +0 -519
  248. package/src/alg/delaunay.ts +0 -163
  249. package/src/alg/delaunayslow.ts +0 -183
  250. package/src/alg/extrude/extrude.ts +0 -19
  251. package/src/alg/extrude.ts +0 -941
  252. package/src/alg/offset/index.ts +0 -8
  253. package/src/alg/offset.ts +0 -501
  254. package/src/alg/pointset.ts +0 -219
  255. package/src/alg/recognition.ts +0 -43
  256. package/src/alg/result.ts +0 -24
  257. package/src/alg/segmentset.ts +0 -44
  258. package/src/alg/sort.ts +0 -11
  259. package/src/alg/split.ts +0 -15
  260. package/src/alg/trianglution.ts +0 -53
  261. package/src/alg/vol.ts +0 -18
  262. package/src/alg/voronoi.ts +0 -303
  263. package/src/app.css +0 -12
  264. package/src/app.ts +0 -285
  265. package/src/assets/color.jpg +0 -0
  266. package/src/basic/distance.ts +0 -40
  267. package/src/clipper/clipper.d.ts +0 -323
  268. package/src/clipper/clipper.js +0 -7626
  269. package/src/clipper/clipper_float.js +0 -185
  270. package/src/clipper/clipper_float_unminified.js +0 -5639
  271. package/src/clipper/clipperint.js +0 -7626
  272. package/src/csg/bsp.ts +0 -24
  273. package/src/csg/csg.js +0 -583
  274. package/src/csg/node.ts +0 -91
  275. package/src/csg/polygon.ts +0 -177
  276. package/src/diamondMaterialShader.ts +0 -93
  277. package/src/effect/breath-light.ts +0 -24
  278. package/src/extends/geometryaid.ts +0 -86
  279. package/src/extends/split.ts +0 -15
  280. package/src/glview.ts +0 -570
  281. package/src/index.ts +0 -47
  282. package/src/math/Color.ts +0 -225
  283. package/src/math/Euler.ts +0 -238
  284. package/src/math/HVec3.ts +0 -1144
  285. package/src/math/Mat3.ts +0 -365
  286. package/src/math/Mat4.ts +0 -1134
  287. package/src/math/Math.ts +0 -213
  288. package/src/math/Quat.ts +0 -536
  289. package/src/math/Vec2.ts +0 -408
  290. package/src/math/Vec3.ts +0 -1307
  291. package/src/math/Vec4.ts +0 -587
  292. package/src/math/vecs.ts +0 -486
  293. package/src/render/bufferAttribute.ts +0 -491
  294. package/src/render/geometry.ts +0 -1329
  295. package/src/render/mesh.ts +0 -82
  296. package/src/render/types.ts +0 -17
  297. package/src/robust/plane.ts +0 -12
  298. package/src/robust/readme.md +0 -1
  299. package/src/robust/vec.ts +0 -61
  300. package/src/shader/cga.glsl +0 -202
  301. package/src/shader/common.glsl +0 -87
  302. package/src/shader/noise/GLSL-Noise.md +0 -1108
  303. package/src/shader/noise/cellular2D.glsl +0 -69
  304. package/src/shader/noise/cellular2x2.glsl +0 -64
  305. package/src/shader/noise/cellular2x2x2.glsl +0 -88
  306. package/src/shader/noise/cellular3D.glsl +0 -187
  307. package/src/shader/noise/classicnoise2D.glsl +0 -113
  308. package/src/shader/noise/classicnoise3D.glsl +0 -177
  309. package/src/shader/noise/classicnoise4D.glsl +0 -302
  310. package/src/shader/noise/noise2D.glsl +0 -71
  311. package/src/shader/noise/noise3D.glsl +0 -103
  312. package/src/shader/noise/noise3Dgrad.glsl +0 -111
  313. package/src/shader/noise/noise4D.glsl +0 -129
  314. package/src/shader/noise/psrdnoise2D.glsl +0 -462
  315. package/src/struct/3d/Box.ts +0 -124
  316. package/src/struct/3d/Capsule.ts +0 -18
  317. package/src/struct/3d/Circle.ts +0 -149
  318. package/src/struct/3d/Disk.ts +0 -22
  319. package/src/struct/3d/Frustum.ts +0 -189
  320. package/src/struct/3d/Line.ts +0 -378
  321. package/src/struct/3d/Path.ts +0 -314
  322. package/src/struct/3d/Plane.ts +0 -341
  323. package/src/struct/3d/Point.ts +0 -7
  324. package/src/struct/3d/PolyLine.ts +0 -115
  325. package/src/struct/3d/Polygon.ts +0 -46
  326. package/src/struct/3d/Ray.ts +0 -285
  327. package/src/struct/3d/Rectangle.ts +0 -18
  328. package/src/struct/3d/Segment.ts +0 -330
  329. package/src/struct/3d/Shape.ts +0 -7
  330. package/src/struct/3d/Sphere.ts +0 -31
  331. package/src/struct/3d/Triangle.ts +0 -28
  332. package/src/struct/bsp.ts +0 -18
  333. package/src/struct/btree.ts +0 -0
  334. package/src/struct/data/ArrayList.ts +0 -144
  335. package/src/struct/data/ArrayObject.ts +0 -105
  336. package/src/struct/data/type.ts +0 -14
  337. package/src/struct/kdtree.ts +0 -0
  338. package/src/struct/polyTree.ts +0 -8
  339. package/src/struct/quatTree.ts +0 -0
  340. package/src/struct/tree.ts +0 -30
  341. package/src/utils/array.ts +0 -106
  342. package/src/utils/types.ts +0 -42
  343. package/src-gis/app.ts +0 -7
  344. package/src-gis/core/Cartographic.ts +0 -48
  345. package/src-gis/core/EllipsoidGeodesic.ts +0 -56
  346. package/src-gis/core/EllipsoidTerrainProvider.ts +0 -35
  347. package/src-gis/core/HeightmapTerrainData.ts +0 -5
  348. package/src-gis/core/Rectangle.ts +0 -112
  349. package/src-gis/core/TaskProcessor.ts +0 -222
  350. package/src-gis/gis.ts +0 -25
  351. package/src-gis/globe.ts +0 -54
  352. package/src-gis/math/Cartographic.ts +0 -24
  353. package/src-gis/math/GVec3.ts +0 -55
  354. package/src-gis/math/ellipsoid.ts +0 -13
  355. package/src-gis/provider/DcTerrainProvider.ts +0 -36
  356. package/src-gis/provider/TerrainProvider.ts +0 -12
  357. package/src-gis/scene/DcImageryProvider.ts +0 -36
  358. package/src-gis/scene/GeographicTilingScheme.ts +0 -65
  359. package/src-gis/scene/Globe.ts +0 -76
  360. package/src-gis/scene/GlobeSurfaceShaderSet.ts +0 -9
  361. package/src-gis/scene/GlobeSurfaceTileProvider.ts +0 -25
  362. package/src-gis/scene/ImageryLayerCollection.ts +0 -75
  363. package/src-gis/scene/ImageryProvider.ts +0 -28
  364. package/src-gis/scene/QuadtreeTile.ts +0 -162
  365. package/src-gis/scene/UrlTemplateImageryProvider.ts +0 -32
  366. package/src-gis/scene/quadtree_primitive.ts +0 -58
  367. package/tsconfig.json +0 -77
  368. package/webpack.config.js +0 -112
  369. package//350/256/241/347/256/227/345/207/240/344/275/225/351/227/256/351/242/230.md +0 -26
package/build/cga.d.ts CHANGED
@@ -1,2057 +1,2358 @@
1
- /**
2
- * 遍历多级数组中所有对象
3
- * @param {Array} array
4
- * @param {Function} method
5
- */
6
- declare function forall(array: Array<any>, method: (arg0: any, index?: number, that?: Array<any>) => void): void;
7
- declare function flat(array: any[]): any[];
8
- /**
9
- * 分类
10
- * example:
11
- * var arry = [1,2,3,4,5,6]
12
- * var result = classify(array,(a)={return a%2===0})
13
- *
14
- * @param {Array} array
15
- * @param {Function} classifyMethod 分类方法
16
- */
17
- declare function classify(array: Array<any>, classifyMethod: (arg0: any, arg1: any, arg2: any[]) => any): any;
18
- /**
19
- * 去掉重复元素
20
- * @param {Array} array
21
- * @param {Function} uniqueMethod 去重复
22
- * @param {Function} sortMethod 排序 存在就先排序再去重复
23
- */
24
- declare function unique(array: any[], uniqueMethod: (arg0: any, arg1: any) => boolean, sortMethod?: (a: any, b: any) => number): any[];
25
-
26
- declare class Euler {
27
- _x: number;
28
- _y: number;
29
- _z: number;
30
- _order: string;
31
- isEuler: boolean;
32
- constructor(_x?: number, _y?: number, _z?: number, _order?: string);
33
- get x(): number;
34
- set x(value: number);
35
- get y(): number;
36
- set y(value: number);
37
- get z(): number;
38
- set z(value: number);
39
- get order(): string;
40
- set order(value: string);
41
- set(x: number, y: number, z: number, order: string): this;
42
- clone(): Euler;
43
- copy(Euler: {
44
- _x: number;
45
- _y: number;
46
- _z: number;
47
- _order: string;
48
- }): this;
49
- setFromRotationMat(m: Mat4, order: string, update: boolean | undefined): this | undefined;
50
- setFromQuat(q: Quat, order?: any, update?: boolean): this | undefined;
51
- setFromVec3(v: {
52
- x: any;
53
- y: any;
54
- z: any;
55
- }, order: any): this;
56
- reorder(newOrder: any): this | undefined;
57
- equals(Euler: {
58
- _x: number;
59
- _y: number;
60
- _z: number;
61
- _order: string;
62
- }): boolean;
63
- fromArray(array: any[]): this;
64
- toArray(array?: any[], offset?: number): any[];
65
- toVec3(optionalResult: {
66
- set: (arg0: number, arg1: number, arg2: number) => any;
67
- }): any;
68
- }
69
- declare function euler(x?: number, y?: number, z?: number): Euler;
70
-
71
- declare class Quat {
72
- _x: number;
73
- _y: number;
74
- _z: number;
75
- _w: number;
76
- isQuat: boolean;
77
- constructor(_x?: number, _y?: number, _z?: number, _w?: number);
78
- get x(): number;
79
- set x(value: number);
80
- get y(): number;
81
- set y(value: number);
82
- get z(): number;
83
- set z(value: number);
84
- get w(): number;
85
- set w(value: number);
86
- static slerp(qa: any, qb: any, qm: {
87
- copy: (arg0: any) => {
88
- (): any;
89
- new (): any;
90
- slerp: {
91
- (arg0: any, arg1: any): any;
92
- new (): any;
93
- };
94
- };
95
- }, t: any): any;
96
- static slerpFlat(dst: {
97
- [x: string]: any;
98
- }, dstOffset: number, src0: {
99
- [x: string]: any;
100
- }, srcOffset0: number, src1: {
101
- [x: string]: any;
102
- }, srcOffset1: number, t: number): void;
103
- static multiplyQuatsFlat(dst: {
104
- [x: string]: number;
105
- }, dstOffset: number, src0: {
106
- [x: string]: any;
107
- }, srcOffset0: number, src1: {
108
- [x: string]: any;
109
- }, srcOffset1: number): {
110
- [x: string]: number;
111
- };
112
- set(x: number, y: number, z: number, w: number): this;
113
- clone(): Quat;
114
- copy(quat: Quat): this;
115
- setFromEuler(euler: Euler, update?: boolean): this;
116
- setFromAxisAngle(axis: {
117
- x: number;
118
- y: number;
119
- z: number;
120
- }, angle: number): this;
121
- setFromRotationMat(m: {
122
- elements: any;
123
- }): this;
124
- setFromUnitVecs(vFrom: {
125
- dot: (arg0: any) => number;
126
- x: number;
127
- z: number;
128
- y: number;
129
- }, vTo: {
130
- z: number;
131
- y: number;
132
- x: number;
133
- }): this;
134
- angleTo(q: any): number;
135
- rotateTowards(q: any, step: number): this;
136
- inverse(): this;
137
- invert(): this;
138
- conjugate(): this;
139
- dot(v: Quat): number;
140
- lengthSq(): number;
141
- length(): number;
142
- normalize(): this;
143
- multiply(q: Quat, p?: Quat): this;
144
- premultiply(q: Quat): this;
145
- multiplyQuats(a: Quat, b: Quat): this;
146
- slerp(qb: Quat, t: number): this;
147
- equals(quat: Quat): boolean;
148
- fromArray(array: Array<number>, offset?: number): this;
149
- toArray(array?: number[], offset?: number): number[];
150
- }
1
+ declare class Quat {
2
+ _x: number;
3
+ _y: number;
4
+ _z: number;
5
+ _w: number;
6
+ isQuat: boolean;
7
+ constructor(_x?: number, _y?: number, _z?: number, _w?: number);
8
+ get x(): number;
9
+ set x(value: number);
10
+ get y(): number;
11
+ set y(value: number);
12
+ get z(): number;
13
+ set z(value: number);
14
+ get w(): number;
15
+ set w(value: number);
16
+ static slerp(qa: any, qb: any, qm: {
17
+ copy: (arg0: any) => {
18
+ (): any;
19
+ new (): any;
20
+ slerp: {
21
+ (arg0: any, arg1: any): any;
22
+ new (): any;
23
+ };
24
+ };
25
+ }, t: any): any;
26
+ static slerpFlat(dst: {
27
+ [x: string]: any;
28
+ }, dstOffset: number, src0: {
29
+ [x: string]: any;
30
+ }, srcOffset0: number, src1: {
31
+ [x: string]: any;
32
+ }, srcOffset1: number, t: number): void;
33
+ static multiplyQuatsFlat(dst: {
34
+ [x: string]: number;
35
+ }, dstOffset: number, src0: {
36
+ [x: string]: any;
37
+ }, srcOffset0: number, src1: {
38
+ [x: string]: any;
39
+ }, srcOffset1: number): {
40
+ [x: string]: number;
41
+ };
42
+ set(x: number, y: number, z: number, w: number): this;
43
+ clone(): Quat;
44
+ copy(quat: Quat): this;
45
+ setFromEuler(euler: Euler, update?: boolean): this;
46
+ setFromAxisAngle(axis: {
47
+ x: number;
48
+ y: number;
49
+ z: number;
50
+ }, angle: number): this;
51
+ setFromRotationMat(m: {
52
+ elements: any;
53
+ }): this;
54
+ setFromUnitVecs(vFrom: {
55
+ dot: (arg0: any) => number;
56
+ x: number;
57
+ z: number;
58
+ y: number;
59
+ }, vTo: {
60
+ z: number;
61
+ y: number;
62
+ x: number;
63
+ }): this;
64
+ angleTo(q: any): number;
65
+ rotateTowards(q: any, step: number): this;
66
+ inverse(): this;
67
+ invert(): this;
68
+ conjugate(): this;
69
+ dot(v: Quat): number;
70
+ lengthSq(): number;
71
+ length(): number;
72
+ normalize(): this;
73
+ multiply(q: Quat, p?: Quat): this;
74
+ premultiply(q: Quat): this;
75
+ multiplyQuats(a: Quat, b: Quat): this;
76
+ slerp(qb: Quat, t: number): this;
77
+ equals(quat: Quat): boolean;
78
+ fromArray(array: Array<number>, offset?: number): this;
79
+ toArray(array?: number[], offset?: number): number[];
80
+ }
151
81
  declare function quat(x?: number, y?: number, z?: number, w?: number): Quat;
152
82
 
153
- interface DistanceResult {
154
- rayParameter?: any;
155
- lineParameter?: any;
156
- closests?: Array<any>;
157
- parameters?: Array<any>;
158
- distance?: number;
159
- distanceSqr?: number;
160
- equidistant?: boolean;
161
- interior?: boolean;
162
- triangleParameters?: Array<any>;
163
- rectangleParameters?: Array<any>;
164
- circleClosest?: Vec3;
165
- signedDistance?: number;
166
- segmentIndex?: number;
167
- diskClosest?: Vec3;
168
- }
169
- interface IntersectResult extends DistanceResult {
170
- interserct?: boolean;
171
- equals?: boolean;
172
- intersetctPts: Array<Array<Vec3>>;
83
+ type DistanceParameter = number | number[];
84
+ interface DistanceResult {
85
+ rayParameter?: number;
86
+ lineParameter?: number;
87
+ closests: [Vec3, Vec3];
88
+ parameters: [DistanceParameter, DistanceParameter];
89
+ distance: number;
90
+ distanceSqr: number;
91
+ equidistant?: boolean;
92
+ interior?: boolean;
93
+ triangleParameters?: number[];
94
+ rectangleParameters?: number[];
95
+ circleClosest?: Vec3;
96
+ signedDistance?: number;
97
+ segmentIndex?: number;
98
+ diskClosest?: Vec3;
173
99
  }
174
-
175
- declare enum Orientation {
176
- None = -1,
177
- Positive = 1,
178
- Negative = 2,
179
- Common = 3,
180
- Intersect = 3
100
+ interface IntersectResult extends DistanceResult {
101
+ interserct?: boolean;
102
+ equals?: boolean;
103
+ intersetctPts: Array<Array<Vec3>>;
181
104
  }
182
105
 
183
- declare class Triangle extends Array {
184
- constructor(_p0: Vec3, _p1: Vec3, _p2: Vec3);
185
- get p0(): any;
186
- get p1(): any;
187
- get p2(): any;
188
- distanceTriangle(triangle: Triangle): void;
106
+ /** Shared contract of the basic geometric primitives. Set/copy mutate and chain;
107
+ * clone owns its coordinates; queries do not mutate either operand. */
108
+ interface GeometryQuery<T> {
109
+ readonly kind: GeometryKind;
110
+ copy(source: T): this;
111
+ clone(): T;
112
+ distancePoint(point: Vec3): DistanceResult;
113
+ toJSON(): GeometryData;
114
+ }
115
+ type GeometryKind = 'Point' | 'Line' | 'Ray' | 'Segment' | 'Triangle' | 'Plane' | 'Rectangle' | 'Circle' | 'Disk' | 'Sphere' | 'Capsule' | 'Box' | 'Polyline' | 'Polygon';
116
+ interface GeometryData {
117
+ kind: GeometryKind;
118
+ vertices: number[][];
119
+ normal?: number[];
120
+ radius?: number;
121
+ w?: number;
122
+ startAngle?: number;
123
+ lengthAngle?: number;
124
+ empty?: boolean;
189
125
  }
190
126
 
191
- type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
127
+ type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
192
128
  type TypedArrayLike = number[] | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
193
129
 
194
- /**
195
- * 几何体buffer属性
196
- * 记录每个几何数据属性的细节
197
- */
198
- declare class BufferAttribute {
199
- name: string;
200
- itemSize: number;
201
- array: TypedArray;
202
- version: number;
203
- normalized: boolean;
204
- count: number;
205
- updateRange: {
206
- offset: number;
207
- count: number;
208
- };
209
- readonly isBufferAttribute: true;
210
- /**
211
- *
212
- * @param array {BufferArray} Buffer数据
213
- * @param itemSize 单元长度,vec3是3,vec4是4
214
- * @param normalized
215
- */
216
- constructor(array: TypedArray, itemSize: number, normalized?: boolean);
217
- set needsUpdate(value: boolean);
218
- onUploadCallback?: () => void;
219
- onUpload(callback: () => void): this;
220
- setUsage(usage: any): this;
221
- copy(source: BufferAttribute): this;
222
- copyAt(index1: number, attribute: BufferAttribute, index2: number): this;
223
- copyArray(array: ArrayLike<number>): this;
224
- copyColorsArray(colors: {
225
- r: number;
226
- g: number;
227
- b: number;
228
- }[]): this;
229
- copyVec2sArray(vectors: {
230
- x: number;
231
- y: number;
232
- }[]): this;
233
- copyVec3sArray(vectors: {
234
- x: number;
235
- y: number;
236
- z: number;
237
- }[]): this;
238
- copyVec4sArray(vectors: {
239
- x: number;
240
- y: number;
241
- z: number;
242
- w: number;
243
- }[]): this;
244
- applyMat3(m: Mat3): this;
245
- applyMat4(m: Mat4): this;
246
- applyNormalMat(m: Mat3): this;
247
- transformDirection(m: Mat4): this;
248
- set(value: ArrayLike<number>, offset: number): this;
249
- getX(index: number): number;
250
- setX(index: number, x: number): this;
251
- getY(index: number): number;
252
- setY(index: number, y: number): this;
253
- getZ(index: number): number;
254
- setZ(index: number, z: number): this;
255
- getW(index: number): number;
256
- setW(index: number, w: number): this;
257
- setXY(index: number, x: number, y: number): this;
258
- setXYZ(index: number, x: number, y: number, z: number): this;
259
- setXYZW(index: number, x: number, y: number, z: number, w: number): this;
260
- clone(): BufferAttribute;
261
- toJSON(): {
262
- itemSize: number;
263
- type: string;
264
- array: number[];
265
- normalized: boolean;
266
- };
267
- }
268
- declare class Int8BufferAttribute extends BufferAttribute {
269
- constructor(array: any, itemSize: number, normalized?: boolean);
270
- }
271
- declare class Uint8BufferAttribute extends BufferAttribute {
272
- constructor(array: any, itemSize: number, normalized?: boolean);
273
- }
274
- declare class Uint8ClampedBufferAttribute extends BufferAttribute {
275
- constructor(array: any, itemSize: number, normalized?: boolean);
276
- }
277
- declare class Int16BufferAttribute extends BufferAttribute {
278
- constructor(array: any, itemSize: number, normalized?: boolean);
279
- }
280
- declare class Uint16BufferAttribute extends BufferAttribute {
281
- constructor(array: any, itemSize: number, normalized?: boolean);
282
- }
283
- declare class Int32BufferAttribute extends BufferAttribute {
284
- constructor(array: any, itemSize: number, normalized?: boolean);
285
- }
286
- declare class Uint32BufferAttribute extends BufferAttribute {
287
- constructor(array: any, itemSize: number, normalized?: boolean);
288
- }
289
- declare class Float32BufferAttribute extends BufferAttribute {
290
- constructor(array: any, itemSize: number, normalized?: boolean);
291
- }
292
- declare class Float64BufferAttribute extends BufferAttribute {
293
- constructor(array: any, itemSize: number, normalized?: boolean);
130
+ declare enum IntersectType {
131
+ None = 0,
132
+ Parallel = 1,
133
+ Perpendicular = 2,
134
+ Collineation = 3
135
+ }
136
+ declare enum Orientation {
137
+ None = -1,
138
+ Positive = 1,
139
+ Negative = 2,
140
+ Common = 3,//共面
141
+ Intersect = 3
294
142
  }
295
143
 
296
- declare class Box {
297
- min: Vec3;
298
- max: Vec3;
299
- _center: Vec3;
300
- constructor(min?: Vec3, max?: Vec3);
301
- get center(): Vec3;
302
- /**
303
- *
304
- * @param {Array<Vec3>} points
305
- */
306
- setFromPoints(points: any): void;
307
- expand(...points: any[]): void;
308
- makeEmpty(): this;
309
- clone(): Box | undefined;
310
- copy(box: Box): Box;
311
- setFromCenterAndSize(center: Vec3, size: Vec3): this;
312
- setFromBufferAttribute(attribute: BufferAttribute): this;
313
- expandByPoint(point: Vec3): this;
314
- isEmpty(): boolean;
315
- getCenter(target: Vec3): Vec3;
144
+ interface ISplitResult {
145
+ negative: Vec3[];
146
+ positive: Vec3[];
147
+ common: Vec3[];
148
+ orientation: Orientation;
316
149
  }
317
150
 
318
- declare class Sphere {
319
- applyMat4(mat: Mat4): void;
320
- center: Vec3;
321
- radius: number;
322
- constructor(center?: Vec3, radius?: number);
323
- setComponents(cx: number, cy: number, cz: number, radius: number): this;
324
- copy(sphere: Sphere): this;
325
- clone(): Sphere | undefined;
151
+ declare class Mat3 {
152
+ elements: number[];
153
+ isMat3: boolean;
154
+ constructor();
155
+ set(n11: number, n12: number, n13: number, n21: number, n22: number, n23: number, n31: number, n32: number, n33: number): this;
156
+ identity(): this;
157
+ clone(): Mat3;
158
+ copy(m: Mat3): this;
159
+ setFromMat4(m: Mat4): this;
160
+ applyToBufferAttribute(attribute: any): any;
161
+ multiply(m: Mat3): this;
162
+ premultiply(m: Mat3): this;
163
+ multiplyMatrices(a: Mat3, b: Mat3): this;
164
+ multiplyScalar(s: number): this;
165
+ determinant(): number;
166
+ getInverse(matrix: Mat3 | Mat4 | any, throwOnDegenerate?: boolean): this;
167
+ transpose(): this;
168
+ getNormalMat(mat4: Mat4): this;
169
+ transposeIntoArray(r: number[]): this;
170
+ setUvTransform(tx: any, ty: any, sx: number, sy: number, rotation: number, cx: number, cy: number): void;
171
+ scale(sx: number, sy: number): this;
172
+ rotate(theta: number): this;
173
+ translate(tx: number, ty: number): this;
174
+ equals(matrix: Mat3): boolean;
175
+ fromArray(array: number[], offset?: number): this;
176
+ toArray(array?: number[], offset?: number): number[];
326
177
  }
178
+ declare function m3(): Mat3;
327
179
 
328
- declare class Vec4 {
329
- private _x;
330
- private _y;
331
- private _z;
332
- private _w;
333
- isVec4: boolean;
334
- constructor(_x?: number, _y?: number, _z?: number, _w?: number);
335
- get x(): number;
336
- set x(value: number);
337
- get y(): number;
338
- set y(value: number);
339
- get z(): number;
340
- set z(value: number);
341
- get w(): number;
342
- set w(value: number);
343
- static isVec4(v: Vec4): boolean;
344
- get width(): number;
345
- set width(value: number);
346
- get height(): number;
347
- set height(value: number);
348
- set(x: number, y: number, z: number, w: number): this;
349
- setScalar(scalar: number): this;
350
- setX(x: number): this;
351
- setY(y: number): this;
352
- setZ(z: number): this;
353
- setW(w: number): this;
354
- setComponent(index: number, value: number): this;
355
- getComponent(index: number): number;
356
- clone(): Vec4;
357
- copy(v: {
358
- x: number;
359
- y: number;
360
- z: number;
361
- w: number | undefined;
362
- }): this;
363
- add(v: Vec4, w?: Vec4): Vec4;
364
- addScalar(s: number): this;
365
- addVecs(a: Vec4, b: Vec4): this;
366
- addScaledVec(v: Vec4, s: number): this;
367
- sub(v: Vec4, w?: Vec4): this;
368
- subScalar(s: number): this;
369
- subVecs(a: Vec4, b: Vec4): this;
370
- multiplyScalar(scalar: number): this;
371
- applyMat4(m: {
372
- elements: any;
373
- }): this;
374
- divideScalar(scalar: number): this;
375
- setAxisAngleFromQuat(q: {
376
- w: number;
377
- x: number;
378
- y: number;
379
- z: number;
380
- }): this;
381
- setAxisAngleFromRotationMat(m: {
382
- elements: any;
383
- }): this;
384
- min(v: Vec4): this;
385
- max(v: Vec4): this;
386
- clamp(min: Vec4, max: Vec4): this;
387
- clampScalar(minVal: number, maxVal: number): this;
388
- clampLength(min: number, max: number): this;
389
- floor(): this;
390
- ceil(): this;
391
- round(): this;
392
- roundToZero(): this;
393
- negate(): this;
394
- dot(v: Vec4): number;
395
- lengthSq(): number;
396
- length(): number;
397
- manhattanLength(): number;
398
- normalize(): this;
399
- setLength(length: any): this;
400
- lerp(v: Vec4, alpha: number): this;
401
- lerpVecs(v1: Vec4, v2: any, alpha: any): Vec4;
402
- equals(v: Vec4): boolean;
403
- fromArray(array: TypedArrayLike, offset?: number): this;
404
- toArray(array?: TypedArrayLike, offset?: number): TypedArrayLike;
405
- fromBufferAttribute(attribute: any, index: any, offset: undefined): this;
406
- }
180
+ declare class Vec2 {
181
+ private _x;
182
+ private _y;
183
+ isVec2: boolean;
184
+ constructor(_x?: number, _y?: number);
185
+ get x(): number;
186
+ set x(value: number);
187
+ get y(): number;
188
+ set y(value: number);
189
+ static isVec2(v: any): boolean;
190
+ get width(): number;
191
+ set width(value: number);
192
+ get height(): number;
193
+ set height(value: number);
194
+ static get UnitX(): Vec2;
195
+ static get UnitY(): Vec2;
196
+ set(x: number, y: number): this;
197
+ setScalar(scalar: number): this;
198
+ setX(x: number): this;
199
+ setY(y: number): this;
200
+ setComponent(index: number, value: number): this;
201
+ getComponent(index: number): number;
202
+ clone(): Vec2;
203
+ copy(v: Vec2): Vec2;
204
+ add(v: Vec2, w?: Vec2): this;
205
+ addScalar(s: number): this;
206
+ addVecs(a: Vec2, b: Vec2): this;
207
+ addScaledVec(v: Vec2, s: number): this;
208
+ sub(v: Vec2, w: Vec2): this;
209
+ subScalar(s: number): this;
210
+ subVecs(a: Vec2, b: Vec2): this;
211
+ multiply(v: Vec2): this;
212
+ multiplyScalar(scalar: number): this;
213
+ divide(v: Vec2): this;
214
+ divideScalar(scalar: number): this;
215
+ applyMat3(m: Mat3): this;
216
+ min(v: Vec2): this;
217
+ max(v: Vec2): this;
218
+ clamp(min: Vec2, max: Vec2): this;
219
+ clampScalar(minVal: number, maxVal: number): this;
220
+ clampLength(min: number, max: number): this;
221
+ floor(): this;
222
+ ceil(): this;
223
+ round(): this;
224
+ roundToZero(): this;
225
+ negate(): this;
226
+ dot(v: Vec2): number;
227
+ cross(v: Vec2): number;
228
+ lengthSq(): number;
229
+ length(): number;
230
+ manhattanLength(): number;
231
+ normalize(): this;
232
+ angle(): number;
233
+ distanceTo(v: Vec2): number;
234
+ distanceToSquared(v: Vec2): number;
235
+ manhattanDistanceTo(v: Vec2): number;
236
+ setLength(length: number): this;
237
+ lerp(v: Vec2, alpha: number): this;
238
+ lerpVecs(v1: Vec2, v2: Vec2, alpha: number): this;
239
+ equals(v: Vec2): boolean;
240
+ fromArray(array: TypedArrayLike, offset?: number): this;
241
+ toArray(array?: TypedArrayLike, offset?: number): TypedArrayLike;
242
+ fromBufferAttribute(attribute: any, index: number, offset: any): this;
243
+ rotateAround(center: Vec2, angle: number): this;
244
+ }
245
+ declare function v2(): Vec2;
246
+
247
+ declare class Vec4 {
248
+ private _x;
249
+ private _y;
250
+ private _z;
251
+ private _w;
252
+ isVec4: boolean;
253
+ constructor(_x?: number, _y?: number, _z?: number, _w?: number);
254
+ get x(): number;
255
+ set x(value: number);
256
+ get y(): number;
257
+ set y(value: number);
258
+ get z(): number;
259
+ set z(value: number);
260
+ get w(): number;
261
+ set w(value: number);
262
+ static isVec4(v: Vec4): boolean;
263
+ get width(): number;
264
+ set width(value: number);
265
+ get height(): number;
266
+ set height(value: number);
267
+ set(x: number, y: number, z: number, w: number): this;
268
+ setScalar(scalar: number): this;
269
+ setX(x: number): this;
270
+ setY(y: number): this;
271
+ setZ(z: number): this;
272
+ setW(w: number): this;
273
+ setComponent(index: number, value: number): this;
274
+ getComponent(index: number): number;
275
+ clone(): Vec4;
276
+ copy(v: {
277
+ x: number;
278
+ y: number;
279
+ z: number;
280
+ w: number | undefined;
281
+ }): this;
282
+ add(v: Vec4, w?: Vec4): Vec4;
283
+ addScalar(s: number): this;
284
+ addVecs(a: Vec4, b: Vec4): this;
285
+ addScaledVec(v: Vec4, s: number): this;
286
+ sub(v: Vec4, w?: Vec4): this;
287
+ subScalar(s: number): this;
288
+ subVecs(a: Vec4, b: Vec4): this;
289
+ multiplyScalar(scalar: number): this;
290
+ applyMat4(m: {
291
+ elements: any;
292
+ }): this;
293
+ divideScalar(scalar: number): this;
294
+ setAxisAngleFromQuat(q: {
295
+ w: number;
296
+ x: number;
297
+ y: number;
298
+ z: number;
299
+ }): this;
300
+ setAxisAngleFromRotationMat(m: {
301
+ elements: any;
302
+ }): this;
303
+ min(v: Vec4): this;
304
+ max(v: Vec4): this;
305
+ clamp(min: Vec4, max: Vec4): this;
306
+ clampScalar(minVal: number, maxVal: number): this;
307
+ clampLength(min: number, max: number): this;
308
+ floor(): this;
309
+ ceil(): this;
310
+ round(): this;
311
+ roundToZero(): this;
312
+ negate(): this;
313
+ dot(v: Vec4): number;
314
+ lengthSq(): number;
315
+ length(): number;
316
+ manhattanLength(): number;
317
+ normalize(): this;
318
+ setLength(length: any): this;
319
+ lerp(v: Vec4, alpha: number): this;
320
+ lerpVecs(v1: Vec4, v2: any, alpha: any): Vec4;
321
+ equals(v: Vec4): boolean;
322
+ fromArray(array: TypedArrayLike, offset?: number): this;
323
+ toArray(array?: TypedArrayLike, offset?: number): TypedArrayLike;
324
+ fromBufferAttribute(attribute: any, index: any, offset: undefined): this;
325
+ }
407
326
  declare function v4(x?: number, y?: number, z?: number, w?: number): Vec4;
408
327
 
409
- interface IGeometry {
410
- position: number[];
411
- normal?: number[];
412
- index?: number[];
413
- uv?: number[];
414
- uv2?: number[];
415
- tangent?: number[];
416
- }
417
- interface IBufferGeometry {
418
- position: Float32Array | undefined;
419
- index?: Uint32Array | Uint16Array;
420
- normal?: Float32Array;
421
- uv?: Float32Array;
422
- uv2?: Float32Array;
423
- tangent?: Float32Array;
424
- }
425
- /**
426
- * BufferType 几何体,用于独立计算几何体
427
- */
428
- declare class BufferGeometry {
429
- name: string;
430
- boundingBox: Box | undefined;
431
- boundingSphere: Sphere | undefined;
432
- morphAttributes: any;
433
- morphTargetsRelative: boolean;
434
- index: BufferAttribute | undefined;
435
- attributes: {
436
- [key: string]: BufferAttribute;
437
- };
438
- groups: {
439
- start: number;
440
- count: number;
441
- materialIndex?: number;
442
- }[];
443
- drawRange: {
444
- start: number;
445
- count: number;
446
- };
447
- parameters: any;
448
- readonly isBufferGeometry: true;
449
- constructor();
450
- /**
451
- * 转化成BufferArray来计算
452
- * @param geo
453
- */
454
- setFromGeometry(geo: IGeometry | IBufferGeometry): this;
455
- getIndex(): BufferAttribute | undefined;
456
- setIndex(index: BufferAttribute | TypedArray | number[]): void;
457
- getAttribute(name: string): BufferAttribute;
458
- setAttribute(name: string, attribute: BufferAttribute): this;
459
- addAttribute(name: string, attribute: BufferAttribute | TypedArray | Array<number | Vec2 | Vec3 | Vec4>, itemSize?: number): this;
460
- deleteAttribute(name: string): this;
461
- addGroup(start: number, count: number, materialIndex?: number): void;
462
- clearGroups(): void;
463
- setDrawRange(start: number, count: number): void;
464
- applyMat4(matrix: Mat4): this;
465
- rotateX(angle: number): this;
466
- rotateY(angle: number): this;
467
- rotateZ(angle: number): this;
468
- translate(x: number, y: number, z: number): this;
469
- scale(x: number, y: number, z: number): this;
470
- lookAt(vector: Vec3): this;
471
- center(): this;
472
- setFromObject(object: any): this;
473
- setFromPoints(points: Vec3[]): this;
474
- updateFromObject(object: any): this;
475
- computeBoundingBox(): void;
476
- computeBoundingSphere(): void;
477
- computeFaceNormals(): void;
478
- computeVertexNormals(): void;
479
- merge(geometry: BufferGeometry, offset: number): this | undefined;
480
- normalizeNormals(): void;
481
- toFlat(): BufferGeometry;
482
- toNonIndexed(): BufferGeometry;
483
- toJSON(): any;
484
- userData(userData: any): void;
485
- clone(): BufferGeometry;
486
- copy(source: BufferGeometry): this;
328
+ declare class ArrayList<T> {
329
+ protected _array: Array<T>;
330
+ isArrayList: boolean;
331
+ constructor(data?: Array<T> | ArrayList<T>);
332
+ get array(): T[];
333
+ set array(val: T[]);
334
+ get length(): number;
335
+ get last(): any;
336
+ get first(): T;
337
+ map(callbackfn: (value: T, index: number, array: T[]) => unknown): unknown[];
338
+ push(...values: any[]): void;
339
+ reverse(): this;
340
+ pop(): any;
341
+ unshift(...items: any[]): number;
342
+ insertAt(i: number, ...value: T[]): void;
343
+ splice(start: number, deleteCount: number, ...items: any[]): void;
344
+ get(index: number): any;
345
+ /**
346
+ * 遍历
347
+ * @param {*} method
348
+ */
349
+ forall(method: (arg0: any) => void): void;
350
+ /**
351
+ * 克隆
352
+ */
353
+ clone(): any;
354
+ /**
355
+ * 分类
356
+ * example:
357
+ * var arry = [1,2,3,4,5,6]
358
+ * var result = classify(this._array,(a)={return a%2===0})
359
+ *
360
+ * @param {Function} classifyMethod 分类方法
361
+ */
362
+ classify(classifyMethod: (value: T, representative: T, group: T[]) => boolean): T[][];
363
+ /**
364
+ * 去掉重复元素
365
+ * @param {Function} uniqueMethod 去重复
366
+ * @param {Function} sortMethod 排序
367
+ */
368
+ unique(uniqueMethod: (arg0: T, arg1: T) => boolean, sortMethod?: (a: T, b: T) => number): this;
487
369
  }
488
370
 
489
- interface ISplitResult {
490
- negative: Vec3[];
491
- positive: Vec3[];
492
- common: Vec3[];
493
- orientation: Orientation;
371
+ type AxisPlane = 'xy' | 'xz' | 'yz' | 'xyz';
372
+ interface ITriangulationOption {
373
+ feature?: AxisPlane;
374
+ dim?: number;
375
+ normal?: Vec3;
494
376
  }
377
+ /**
378
+ * 三角剖分 earcut.js
379
+ * @param {Array} boundary 边界
380
+ * @param {Array<Array>} holes 洞的数组
381
+ * @param {options:{feature,dim,normal}} feature 选择平平面
382
+ * @returns {Array<Number>} 三角形索引数组
383
+ */
384
+ declare function triangulation(boundary: Vec3[], holes?: Vec3[][], options?: ITriangulationOption): number[];
495
385
 
496
- declare class Plane {
497
- normal: Vec3;
498
- w: number;
499
- origin: Vec3;
500
- constructor(normal?: Vec3, w?: number);
501
- static setFromPointNormal(p: Vec3, normal: Vec3): Plane;
502
- setFromPointNormal(p: Vec3, normal: Vec3): void;
503
- set(normal: Vec3, w: number): void;
504
- setComponents(x: number, y: number, z: number, w: number): this;
505
- normalize(): this;
506
- setFromThreePoint(p0: Vec3, p1: Vec3, p2: Vec3): void;
507
- negate(): void;
508
- /**
509
- * 判断一个点在平面的正面或者反面
510
- * @param {Vec3} point
511
- * @returns {Number} -1 or 1 or z
512
- */
513
- frontback(point: any): 0 | 1 | -1;
514
- distancePoint(point: any): number;
515
- distanceRay(ray: any): void;
516
- distanceLine(line: any): void;
517
- distanceSegment(segment: any): void;
518
- distancePlane(plane: any): void;
519
- /**
520
- * 只返回交点
521
- * Lw --Lightweight
522
- * @param {Segment|Array<Vec3> segment
523
- */
524
- intersectSegmentLw(segment: Segment | Vec3[]): Vec3 | Vec3[] | Segment | null;
525
- intersectLine(line: Line, result?: Vec3): Vec3 | undefined;
526
- /**
527
- * 切割线段 代码完成 等待测试
528
- * @param {Segment} segment
529
- * @returns {
530
- * positive: [], //正面点
531
- * negative: [],// 反面位置点
532
- * common: [], 在平面上的点
533
- * orientation: Orientation.None 线段的总体位置
534
- * };
535
- */
536
- splitSegment(segment: Segment | Vec3[]): any;
537
- /**
538
- * 切割三角形 编码完成 等待测试
539
- * @param {Triangle} triangle
540
- */
541
- splitTriangle(triangle: Triangle | Vec3[]): ISplitResult;
542
- /**
543
- * 平面切割线段
544
- * @param polygon
545
- */
546
- splitConvexPolygon(polygon: Vec3[]): void;
547
- /**
548
- * 点在平面的位置判断
549
- * @param {Point} point
550
- * @returns {Orientation} 方位
551
- */
552
- orientationPoint(point: Vec3): Orientation;
553
- /**
554
- * @description : 平面分割几何体
555
- * @param {Plane} plane
556
- * @param {IGeometry} geometry
557
- * @return {IGeometry[]} 返回多个几何体
558
- * @example :
559
- */
560
- static splitGeometry(plane: Plane, geometry: IGeometry): void;
386
+ interface ILinkSideOption {
387
+ side0: {
388
+ x: number;
389
+ y: number;
390
+ z: number;
391
+ index?: number;
392
+ }[] | number[];
393
+ side1: {
394
+ x: number;
395
+ y: number;
396
+ z: number;
397
+ index?: number;
398
+ }[] | number[];
399
+ holes0?: Array<Array<Vec3>>;
400
+ holes1?: Array<Array<Vec3>>;
401
+ shapeClosed?: boolean;
402
+ autoUV?: boolean;
403
+ uvScalars?: number[];
404
+ segs?: [];
405
+ }
406
+ /**
407
+ * 常用shape几何操作
408
+ */
409
+ /**
410
+ * @description : 缝合两个边 不提供uv生成 uv有@linkSides 生成
411
+ * @param { ILinkSideOption } options
412
+ * @returns { Array<Vec3>} 三角形数组,每三个为一个三角形
413
+ * @example :
414
+ */
415
+ declare function linkSide(options: ILinkSideOption): number[];
416
+ /**
417
+ * 缝合shape集合
418
+ * @param {Array<Array<Point|Vec3>} shapes 路基 点集的集合, 每个shape的点数量一致
419
+ * @param {Boolean} sealStart 每一个shape是否是封闭的界面 默认false
420
+ * @param {Boolean} isClosed 每一个shape是否是封闭的界面 默认false
421
+ * @param {Boolean} isClosed2 每一个shape是否是封闭的首尾 默认false
422
+ * @returns {Array} 返回三角形集合 如果有所用范围索引,否则返回顶点
423
+ */
424
+ interface ILinkSideOptions {
425
+ shapes: Array<Array<IVec3 | any | IVec3>>;
426
+ orgShape?: Array<IVec3 | any | IVec3>;
427
+ orgHoles?: any;
428
+ sealStart?: boolean;
429
+ sealEnd?: boolean;
430
+ shapeClosed?: boolean;
431
+ pathClosed?: boolean;
432
+ index?: {
433
+ index: number;
434
+ };
435
+ autoIndex?: boolean;
436
+ generateUV?: boolean;
437
+ axisPlane?: AxisPlane;
438
+ holes?: Array<Array<IVec3 | any | IVec3>>[];
439
+ }
440
+ /**
441
+ * @description : 链接多个shape 生成几何体
442
+ * @param {ILinkSideOptions} optionsILinkSideOptions {
443
+ * shapes: Array<Array<IVec3 | number | any>>;
444
+ * sealStart?: boolean,//开始封面
445
+ * sealEnd?: boolean;//结束封面
446
+ * shapeClosed?: boolean,//shape是否闭合
447
+ * pathClosed?: boolean,//路径是否闭合
448
+ * index?: { index: number },
449
+ * generateUV?: boolean
450
+ * }
451
+ *
452
+ * @return {*}
453
+ * @example :
454
+ *
455
+ */
456
+ declare function linkSides(options: ILinkSideOptions): IGeometry;
457
+ interface IExtrudeOptions {
458
+ fixedY?: boolean;
459
+ shapeClosed?: boolean;
460
+ isClosed2?: boolean;
461
+ textureEnable?: boolean;
462
+ textureScale?: Vec2;
463
+ smoothAngle?: number;
464
+ sealStart?: boolean;
465
+ sealEnd?: boolean;
466
+ normal?: Vec3;
467
+ }
468
+ interface IExtrudeOptionsEx {
469
+ shape: Array<Vec3 | IVec3 | Vec2 | IVec2>;
470
+ path: Array<Vec3 | IVec3>;
471
+ ups?: Array<Vec3 | IVec3>;
472
+ up?: Vec3 | IVec3;
473
+ right?: Vec3;
474
+ shapeClosed?: boolean;
475
+ pathClosed?: boolean;
476
+ textureEnable?: boolean;
477
+ smoothAngle?: number;
478
+ enableSmooth?: boolean;
479
+ sealStart?: boolean;
480
+ sealEnd?: boolean;
481
+ normal?: Vec3;
482
+ autoIndex?: boolean;
483
+ axisPlane?: AxisPlane;
484
+ generateUV?: boolean;
485
+ index?: {
486
+ index: number;
487
+ };
488
+ holes?: Array<Vec3 | IVec3 | Vec2 | IVec2>[];
561
489
  }
490
+ /**
491
+ * @description : 挤压形状生成几何体
492
+ * @param {IExtrudeOptionsEx} options
493
+ * IExtrudeOptionsEx {
494
+ * shape: Array<Vec3 | IVec3 | Vec2 | IVec2>;//shape默认的矩阵为正交矩阵
495
+ * path: Array<Vec3 | IVec3>;//挤压路径
496
+ * ups?: Array<Vec3 | IVec3>;
497
+ * up?: Vec3 | IVec3;
498
+ * shapeClosed?: boolean;//闭合为多边形 界面
499
+ * pathClosed?: boolean;//首尾闭合为圈
500
+ * textureEnable?: boolean;
501
+ * smoothAngle?: number;
502
+ * sealStart?: boolean;
503
+ * sealEnd?: boolean;
504
+ * normal?: Vec3,//面的法线
505
+ * autoIndex?: boolean,
506
+ * index?: { index: number }
507
+ * holes?: Array<Vec3 | IVec3 | Vec2 | IVec2>[]
508
+ *}
509
+ * @return {IGeometry}
510
+ * @example :
511
+ *
512
+ */
513
+ declare function extrude(options: IExtrudeOptionsEx): IGeometry;
514
+ /**
515
+ * 挤压
516
+ * @param {Polygon|Array<Point|Vec3> } shape 多边形或顶点数组
517
+ * @param {Path|Array<Point|Vec3> } path 路径或者或顶点数组
518
+ * @param {Object} options {
519
+ * isClosed: false,闭合为多边形 界面
520
+ * isClosed2: false, 闭合为圈
521
+ * textureEnable: true, 计算纹理坐标
522
+ * textureScale: new Vec2(1, 1),纹理坐标缩放
523
+ * smoothAngle: Math.PI / 180 * 30,大于这个角度则不平滑
524
+ * sealStart: true, 是否密封开始面
525
+ * sealEnd: true,是否密封结束面}
526
+ */
527
+ declare function extrude_obsolete<T extends Vec3>(shape: ArrayList<T>, arg_path: Array<Vec3> | any, options?: IExtrudeOptions): {
528
+ vertices: any[];
529
+ index: number[] | undefined;
530
+ uvs: any[];
531
+ };
532
+ declare enum JoinType {
533
+ Square = 0,
534
+ Round = 1,
535
+ Miter = 2,
536
+ Bevel = 0
537
+ }
538
+ declare enum EndType {
539
+ Square = 0,
540
+ Round = 1,
541
+ Butt = 2,
542
+ etClosedLine = 3,
543
+ etClosedPolygon = 4,
544
+ etOpenButt = 5,
545
+ etOpenSquare = 6
546
+ }
547
+ interface IExtrudeOptionsNext {
548
+ shape: Array<Vec3>;
549
+ path: Array<Vec3 | IVec3>;
550
+ up?: Array<Vec3 | IVec3> | Vec3 | IVec3;
551
+ right?: Array<Vec3> | Vec3;
552
+ shapeClosed?: boolean;
553
+ pathClosed?: boolean;
554
+ textureEnable?: boolean;
555
+ shapeCenter?: Vec3;
556
+ smoothAngle?: number;
557
+ enableSmooth?: boolean;
558
+ sealStart?: boolean;
559
+ sealEnd?: boolean;
560
+ normal?: Vec3;
561
+ autoIndex?: boolean;
562
+ axisPlane?: AxisPlane;
563
+ generateUV?: boolean;
564
+ index?: {
565
+ index: number;
566
+ };
567
+ holes?: Array<Vec3 | IVec3 | Vec2 | IVec2>[];
568
+ jtType?: JoinType;
569
+ etType?: EndType;
570
+ bevelSize?: any;
571
+ }
572
+ /**
573
+ * 将路径看做挤压操作中心
574
+ *
575
+ * @param shape
576
+ * @param followPath
577
+ * @param options
578
+ */
579
+ declare function extrudeNext(options: IExtrudeOptionsNext): IGeometry;
562
580
 
563
- declare class Segment extends Array {
564
- center: Vec3;
565
- extentDirection: Vec3;
566
- extentSqr: number;
567
- extent: number;
568
- direction: Vec3;
569
- normal: Vec3 | undefined;
570
- /**
571
- * 线段
572
- * @param {Point|Vec3} p0
573
- * @param {Point|Vec3} p1
574
- */
575
- constructor(_p0?: Vec3, _p1?: Vec3);
576
- set(p0: Vec3, p1: Vec3): void;
577
- private change;
578
- get p0(): Vec3;
579
- set p0(v: Vec3);
580
- get p1(): Vec3;
581
- set p1(v: Vec3);
582
- offset(distance: number, normal?: Vec3): void;
583
- /**
584
- * 线段到线段的距离
585
- * @param {Segment} segment
586
- */
587
- distanceSegment(segment: Segment): DistanceResult;
588
- distancePlane(plane: Plane): void;
589
- intersectSegment(segment: Segment): void;
590
- }
581
+ declare class Polygon<T> extends Polyline<T> {
582
+ readonly kind: GeometryKind;
583
+ isPolygon: boolean;
584
+ constructor(vs?: any[], normal?: Vec3);
585
+ offset(distance: number, normal?: Vec3): Polygon<T>;
586
+ containPoint(point: Vec3, tolerance?: number): boolean;
587
+ containsPoint(point: Vec3, tolerance?: number): boolean;
588
+ distancePoint(point: Vec3): DistanceResult;
589
+ }
590
+
591
+ declare enum ClipType {
592
+ Intersection = 0,
593
+ Union = 1,
594
+ Difference = 2,
595
+ Xor = 3
596
+ }
597
+ /**
598
+ * 线段正反原则:右手坐标系中,所在平面为XZ平面,把指向方向看着负Z轴,x正为正方向,x负为负方向
599
+ */
600
+ declare class Polyline<T> extends ArrayList<T> implements GeometryQuery<Polyline<T>> {
601
+ readonly kind: GeometryKind;
602
+ isCoPlanar: boolean;
603
+ isPolyline: boolean;
604
+ normal: Vec3;
605
+ constructor(vs?: Array<T> | Polyline<T> | Polygon<T>, normal?: Vec3);
606
+ static CleanPolygon(points: Vec3[], delta?: number): Vec3[];
607
+ static OffsetPaths(paths: Vec3[][], delta: number, jointype?: JoinType, endtype?: EndType, limit?: number): Vec3[][];
608
+ static SimplifyPolygon(points: Vec3[]): Vec3[][];
609
+ /**
610
+ * 偏移
611
+ * @param {Number} distance 偏移距离
612
+ * @param {Vector3} normal 折线所在平面法线
613
+ */
614
+ offset(distance: number, normal?: Vec3, endtype?: EndType, jointype?: JoinType): Polyline<T>;
615
+ /**
616
+ * 圆角 将折线拐点圆角化
617
+ * @param {Number} useDistance 圆角段距离
618
+ * @param {Number} segments 分切割段数
619
+ */
620
+ corner(useDistance: number, normal?: Vec3): Polyline<T>;
621
+ set(points: T[]): this;
622
+ copy(source: Polyline<T>): this;
623
+ clone(): this;
624
+ distancePoint(point: Vec3): DistanceResult;
625
+ toJSON(): GeometryData;
626
+ }
627
+
628
+ /** A fixed-size geometry owns its vertices; array operations cannot change its arity. */
629
+ declare abstract class FixedVertices implements Iterable<Vec3> {
630
+ readonly [index: number]: Vec3;
631
+ protected readonly vertices: Vec3[];
632
+ protected constructor(points: readonly Vec3[]);
633
+ get length(): number;
634
+ [Symbol.iterator](): IterableIterator<Vec3>;
635
+ map<T>(callback: (point: Vec3, index: number) => T): T[];
636
+ forEach(callback: (point: Vec3, index: number) => void): void;
637
+ slice(start?: number, end?: number): Vec3[];
638
+ toArray(): Vec3[];
639
+ }
640
+
641
+ declare class Triangle extends FixedVertices implements GeometryQuery<Triangle> {
642
+ constructor(a: Vec3, b: Vec3, c: Vec3);
643
+ get p0(): Vec3;
644
+ get p1(): Vec3;
645
+ get p2(): Vec3;
646
+ distanceTriangle(triangle: Triangle): DistanceResult;
647
+ distancePoint(point: Vec3): DistanceResult;
648
+ distanceSegment(segment: Segment): DistanceResult;
649
+ distancePlane(plane: Plane): DistanceResult;
650
+ set(a: Vec3, b: Vec3, c: Vec3): this;
651
+ copy(source: Triangle): this;
652
+ clone(): Triangle;
653
+ distanceLine(line: Line): DistanceResult;
654
+ distanceRay(ray: Ray): DistanceResult;
655
+ readonly kind: GeometryKind;
656
+ distanceSphere(sphere: Sphere): DistanceResult;
657
+ distanceCapsule(capsule: Capsule): DistanceResult;
658
+ distanceRectangle(rectangle: Rectangle): DistanceResult;
659
+ toJSON(): GeometryData;
660
+ }
661
+
662
+ declare class Segment extends FixedVertices implements GeometryQuery<Segment> {
663
+ normal: Vec3 | undefined;
664
+ /**
665
+ * 线段
666
+ * @param {Point|Vec3} p0
667
+ * @param {Point|Vec3} p1
668
+ */
669
+ constructor(p0?: Vec3, p1?: Vec3);
670
+ set(p0: Vec3, p1: Vec3): this;
671
+ get center(): Vec3;
672
+ get extentDirection(): Vec3;
673
+ get extentSqr(): number;
674
+ get extent(): number;
675
+ get direction(): Vec3;
676
+ get p0(): Vec3;
677
+ set p0(v: Vec3);
678
+ get p1(): Vec3;
679
+ set p1(v: Vec3);
680
+ offset(distance: number, normal?: Vec3): this;
681
+ /**
682
+ * 线段到线段的距离
683
+ * @param {Segment} segment
684
+ */
685
+ distanceSegment(segment: Segment): DistanceResult;
686
+ distancePlane(plane: Plane): DistanceResult;
687
+ intersectSegment(segment: Segment, tolerance?: number): {
688
+ colinear: boolean;
689
+ intersected: boolean;
690
+ points: Vec3[];
691
+ rayParameter?: number;
692
+ lineParameter?: number;
693
+ closests: [Vec3, Vec3];
694
+ parameters: [DistanceParameter, DistanceParameter];
695
+ distance: number;
696
+ distanceSqr: number;
697
+ equidistant?: boolean;
698
+ interior?: boolean;
699
+ triangleParameters?: number[];
700
+ rectangleParameters?: number[];
701
+ circleClosest?: Vec3;
702
+ signedDistance?: number;
703
+ segmentIndex?: number;
704
+ diskClosest?: Vec3;
705
+ };
706
+ distancePoint(point: Vec3): DistanceResult;
707
+ distanceLine(line: Line): DistanceResult;
708
+ distanceRay(ray: Ray): DistanceResult;
709
+ distanceTriangle(triangle: Triangle): DistanceResult;
710
+ intersectPlane(plane: Plane): Vec3 | Vec3[] | null;
711
+ distanceSphere(sphere: Sphere): DistanceResult;
712
+ distanceCapsule(capsule: Capsule): DistanceResult;
713
+ copy(source: Segment): this;
714
+ clone(): Segment;
715
+ readonly kind: GeometryKind;
716
+ distanceBox(box: Box): DistanceResult;
717
+ distanceRectangle(rectangle: Rectangle): DistanceResult;
718
+ toJSON(): GeometryData;
719
+ }
591
720
  declare function segment(p0: Vec3, p1: Vec3): Segment;
592
721
 
593
- declare class Ray {
594
- origin: Vec3;
595
- direction: Vec3;
596
- constructor(origin: Vec3, direction: Vec3);
597
- /**
598
- * 射线到射线的距离
599
- * @param {Ray} ray
600
- */
601
- distanceRay(ray: Ray): DistanceResult;
602
- /**
603
- * 射线到线段的距离
604
- * @param segment
605
- */
606
- distanceSegment(segment: Segment): DistanceResult;
607
- distanceTriangle(triangle: Triangle): DistanceResult;
608
- distancePloyline(): DistanceResult;
722
+ declare class Rectangle extends FixedVertices implements GeometryQuery<Rectangle> {
723
+ constructor(a: Vec3, b: Vec3, c: Vec3, d?: Vec3);
724
+ set(a: Vec3, b: Vec3, c: Vec3, d?: Vec3): this;
725
+ get center(): Vec3;
726
+ get axis(): Vec3[];
727
+ get extent(): number[];
728
+ copy(source: Rectangle): this;
729
+ clone(): Rectangle;
730
+ distancePoint(point: Vec3): DistanceResult;
731
+ private query;
732
+ distanceLine(line: Line): DistanceResult;
733
+ distanceRay(ray: Ray): DistanceResult;
734
+ distanceSegment(segment: Segment): DistanceResult;
735
+ distanceTriangle(triangle: Triangle): DistanceResult;
736
+ distancePlane(plane: Plane): DistanceResult;
737
+ distanceRectangle(rectangle: Rectangle): DistanceResult;
738
+ readonly kind: GeometryKind;
739
+ toJSON(): GeometryData;
609
740
  }
610
741
 
611
- type AxisPlane = 'xy' | 'xz' | 'yz' | 'xyz';
612
- interface ITriangulationOption {
613
- feature?: AxisPlane;
614
- dim?: number;
615
- normal?: Vec3;
616
- }
617
- /**
618
- * 三角剖分 earcut.js
619
- * @param {Array} boundary 边界
620
- * @param {Array<Array>} holes 洞的数组
621
- * @param {options:{feature,dim,normal}} feature 选择平平面
622
- * @returns {Array<Number>} 三角形索引数组
623
- */
624
- declare function triangulation(inboundary: any, holes?: any[], options?: ITriangulationOption): number[];
742
+ declare class Ray implements GeometryQuery<Ray> {
743
+ origin: Vec3;
744
+ direction: Vec3;
745
+ constructor(origin: Vec3, direction: Vec3);
746
+ /**
747
+ * 射线到射线的距离
748
+ * @param {Ray} ray
749
+ */
750
+ distanceRay(ray: Ray): DistanceResult;
751
+ /**
752
+ * 射线到线段的距离
753
+ * @param segment
754
+ */
755
+ distanceSegment(segment: Segment): DistanceResult;
756
+ distanceTriangle(triangle: Triangle): DistanceResult;
757
+ /** @deprecated Use distancePolyline. */
758
+ distancePloyline(polyline: Polyline<Vec3> | Vec3[]): DistanceResult;
759
+ distancePolyline(polyline: Polyline<Vec3> | Vec3[]): DistanceResult;
760
+ distancePoint(point: Vec3): DistanceResult;
761
+ intersectPlane(plane: Plane, result?: Vec3): Vec3 | undefined;
762
+ distancePlane(plane: Plane): DistanceResult;
763
+ distanceSphere(sphere: Sphere): DistanceResult;
764
+ distanceCapsule(capsule: Capsule): DistanceResult;
765
+ set(origin: Vec3, direction: Vec3): this;
766
+ copy(source: Ray): this;
767
+ clone(): Ray;
768
+ distanceLine(line: Line): DistanceResult;
769
+ readonly kind: GeometryKind;
770
+ distanceBox(box: Box): DistanceResult;
771
+ distanceRectangle(rectangle: Rectangle): DistanceResult;
772
+ toJSON(): GeometryData;
773
+ }
625
774
 
626
- declare class ArrayList<T> {
627
- protected _array: Array<T>;
628
- isArrayList: boolean;
629
- constructor(data?: Array<T> | ArrayList<T>);
630
- get array(): T[];
631
- set array(val: T[]);
632
- get length(): number;
633
- get last(): any;
634
- get first(): T;
635
- map(callbackfn: (value: T, index: number, array: T[]) => unknown): unknown[];
636
- push(...values: any[]): void;
637
- reverse(): this;
638
- pop(): any;
639
- unshift(...items: any[]): number;
640
- insertAt(i: number, ...value: T[]): void;
641
- splice(start: number, deleteCount: number, ...items: any[]): void;
642
- get(index: number): any;
643
- /**
644
- * 遍历
645
- * @param {*} method
646
- */
647
- forall(method: (arg0: any) => void): void;
648
- /**
649
- * 克隆
650
- */
651
- clone(): any;
652
- /**
653
- * 分类
654
- * example:
655
- * var arry = [1,2,3,4,5,6]
656
- * var result = classify(this._array,(a)={return a%2===0})
657
- *
658
- * @param {Function} classifyMethod 分类方法
659
- */
660
- classify(classifyMethod: (arg0: any, arg1: any, arg2: any[]) => any): T[][];
661
- /**
662
- * 去掉重复元素
663
- * @param {Function} uniqueMethod 去重复
664
- * @param {Function} sortMethod 排序
665
- */
666
- unique(uniqueMethod: (arg0: T, arg1: T) => boolean, sortMethod?: ((a: T, b: T) => number)): this;
775
+ declare class Sphere implements GeometryQuery<Sphere> {
776
+ applyMat4(mat: Mat4): this;
777
+ center: Vec3;
778
+ radius: number;
779
+ constructor(center?: Vec3, radius?: number);
780
+ setComponents(cx: number, cy: number, cz: number, radius: number): this;
781
+ copy(sphere: Sphere): this;
782
+ clone(): Sphere;
783
+ set(center: Vec3, radius: number): this;
784
+ distancePoint(point: Vec3): DistanceResult;
785
+ distanceLine(line: Line): DistanceResult;
786
+ distanceRay(ray: Ray): DistanceResult;
787
+ distanceSegment(segment: Segment): DistanceResult;
788
+ distancePlane(plane: Plane): DistanceResult;
789
+ distanceTriangle(triangle: Triangle): DistanceResult;
790
+ distanceSphere(sphere: Sphere): DistanceResult;
791
+ distanceCapsule(capsule: Capsule): DistanceResult;
792
+ containsPoint(point: Vec3): boolean;
793
+ readonly kind: GeometryKind;
794
+ distanceBox(box: Box): DistanceResult;
795
+ distanceRectangle(rectangle: Rectangle): DistanceResult;
796
+ toJSON(): GeometryData;
667
797
  }
668
798
 
669
- interface ILinkSideOption {
670
- side0: {
671
- x: number;
672
- y: number;
673
- z: number;
674
- index?: number;
675
- }[] | number[];
676
- side1: {
677
- x: number;
678
- y: number;
679
- z: number;
680
- index?: number;
681
- }[] | number[];
682
- holes0?: Array<Array<Vec3>>;
683
- holes1?: Array<Array<Vec3>>;
684
- shapeClosed?: boolean;
685
- autoUV?: boolean;
686
- uvScalars?: number[];
687
- segs?: [];
688
- }
689
- /**
690
- * 常用shape几何操作
691
- */
692
- /**
693
- * @description : 缝合两个边 不提供uv生成 uv有@linkSides 生成
694
- * @param { ILinkSideOption } options
695
- * @returns { Array<Vec3>} 三角形数组,每三个为一个三角形
696
- * @example :
697
- */
698
- declare function linkSide(options: ILinkSideOption): number[];
699
- /**
700
- * 缝合shape集合
701
- * @param {Array<Array<Point|Vec3>} shapes 路基 点集的集合, 每个shape的点数量一致
702
- * @param {Boolean} sealStart 每一个shape是否是封闭的界面 默认false
703
- * @param {Boolean} isClosed 每一个shape是否是封闭的界面 默认false
704
- * @param {Boolean} isClosed2 每一个shape是否是封闭的首尾 默认false
705
- * @returns {Array} 返回三角形集合 如果有所用范围索引,否则返回顶点
706
- */
707
- interface ILinkSideOptions {
708
- shapes: Array<Array<IVec3 | any | IVec3>>;
709
- orgShape?: Array<IVec3 | any | IVec3>;
710
- orgHoles?: any;
711
- sealStart?: boolean;
712
- sealEnd?: boolean;
713
- shapeClosed?: boolean;
714
- pathClosed?: boolean;
715
- index?: {
716
- index: number;
717
- };
718
- autoIndex?: boolean;
719
- generateUV?: boolean;
720
- axisPlane?: AxisPlane;
721
- holes?: Array<Array<IVec3 | any | IVec3>>[];
722
- }
723
- /**
724
- * @description : 链接多个shape 生成几何体
725
- * @param {ILinkSideOptions} optionsILinkSideOptions {
726
- * shapes: Array<Array<IVec3 | number | any>>;
727
- * sealStart?: boolean,//开始封面
728
- * sealEnd?: boolean;//结束封面
729
- * shapeClosed?: boolean,//shape是否闭合
730
- * pathClosed?: boolean,//路径是否闭合
731
- * index?: { index: number },
732
- * generateUV?: boolean
733
- * }
734
- *
735
- * @return {*}
736
- * @example :
737
- *
738
- */
739
- declare function linkSides(options: ILinkSideOptions): IGeometry;
740
- interface IExtrudeOptions {
741
- fixedY?: boolean;
742
- shapeClosed?: boolean;
743
- isClosed2?: boolean;
744
- textureEnable?: boolean;
745
- textureScale?: Vec2;
746
- smoothAngle?: number;
747
- sealStart?: boolean;
748
- sealEnd?: boolean;
749
- normal?: Vec3;
750
- }
751
- interface IExtrudeOptionsEx {
752
- shape: Array<Vec3 | IVec3 | Vec2 | IVec2>;
753
- path: Array<Vec3 | IVec3>;
754
- ups?: Array<Vec3 | IVec3>;
755
- up?: Vec3 | IVec3;
756
- right?: Vec3;
757
- shapeClosed?: boolean;
758
- pathClosed?: boolean;
759
- textureEnable?: boolean;
760
- smoothAngle?: number;
761
- enableSmooth?: boolean;
762
- sealStart?: boolean;
763
- sealEnd?: boolean;
764
- normal?: Vec3;
765
- autoIndex?: boolean;
766
- axisPlane?: AxisPlane;
767
- generateUV?: boolean;
768
- index?: {
769
- index: number;
770
- };
771
- holes?: Array<Vec3 | IVec3 | Vec2 | IVec2>[];
772
- }
773
- /**
774
- * @description : 挤压形状生成几何体
775
- * @param {IExtrudeOptionsEx} options
776
- * IExtrudeOptionsEx {
777
- * shape: Array<Vec3 | IVec3 | Vec2 | IVec2>;//shape默认的矩阵为正交矩阵
778
- * path: Array<Vec3 | IVec3>;//挤压路径
779
- * ups?: Array<Vec3 | IVec3>;
780
- * up?: Vec3 | IVec3;
781
- * shapeClosed?: boolean;//闭合为多边形 界面
782
- * pathClosed?: boolean;//首尾闭合为圈
783
- * textureEnable?: boolean;
784
- * smoothAngle?: number;
785
- * sealStart?: boolean;
786
- * sealEnd?: boolean;
787
- * normal?: Vec3,//面的法线
788
- * autoIndex?: boolean,
789
- * index?: { index: number }
790
- * holes?: Array<Vec3 | IVec3 | Vec2 | IVec2>[]
791
- *}
792
- * @return {IGeometry}
793
- * @example :
794
- *
795
- */
796
- declare function extrude(options: IExtrudeOptionsEx): IGeometry;
797
- /**
798
- * 挤压
799
- * @param {Polygon|Array<Point|Vec3> } shape 多边形或顶点数组
800
- * @param {Path|Array<Point|Vec3> } path 路径或者或顶点数组
801
- * @param {Object} options {
802
- * isClosed: false,闭合为多边形 界面
803
- * isClosed2: false, 闭合为圈
804
- * textureEnable: true, 计算纹理坐标
805
- * textureScale: new Vec2(1, 1),纹理坐标缩放
806
- * smoothAngle: Math.PI / 180 * 30,大于这个角度则不平滑
807
- * sealStart: true, 是否密封开始面
808
- * sealEnd: true,是否密封结束面}
809
- */
810
- declare function extrude_obsolete<T extends Vec3>(shape: ArrayList<T>, arg_path: Array<Vec3> | any, options?: IExtrudeOptions): {
811
- vertices: any[];
812
- index: number[] | undefined;
813
- uvs: any[];
814
- };
815
- declare enum JoinType {
816
- Square = 0,
817
- Round = 1,
818
- Miter = 2,
819
- Bevel = 0
820
- }
821
- declare enum EndType {
822
- Square = 0,
823
- Round = 1,
824
- Butt = 2,
825
- etClosedLine = 3,
826
- etClosedPolygon = 4,
827
- etOpenButt = 5,
828
- etOpenSquare = 6
829
- }
830
- interface IExtrudeOptionsNext {
831
- shape: Array<Vec3>;
832
- path: Array<Vec3 | IVec3>;
833
- up?: Array<Vec3 | IVec3> | Vec3 | IVec3;
834
- right?: Array<Vec3> | Vec3;
835
- shapeClosed?: boolean;
836
- pathClosed?: boolean;
837
- textureEnable?: boolean;
838
- shapeCenter?: Vec3;
839
- smoothAngle?: number;
840
- enableSmooth?: boolean;
841
- sealStart?: boolean;
842
- sealEnd?: boolean;
843
- normal?: Vec3;
844
- autoIndex?: boolean;
845
- axisPlane?: AxisPlane;
846
- generateUV?: boolean;
847
- index?: {
848
- index: number;
849
- };
850
- holes?: Array<Vec3 | IVec3 | Vec2 | IVec2>[];
851
- jtType?: JoinType;
852
- etType?: EndType;
853
- bevelSize?: any;
854
- }
855
- /**
856
- * 将路径看做挤压操作中心
857
- *
858
- * @param shape
859
- * @param followPath
860
- * @param options
861
- */
862
- declare function extrudeNext(options: IExtrudeOptionsNext): IGeometry;
799
+ /**
800
+ * 几何体buffer属性
801
+ * 记录每个几何数据属性的细节
802
+ */
803
+ declare class BufferAttribute {
804
+ name: string;
805
+ itemSize: number;
806
+ array: TypedArray;
807
+ version: number;
808
+ normalized: boolean;
809
+ count: number;
810
+ updateRange: {
811
+ offset: number;
812
+ count: number;
813
+ };
814
+ readonly isBufferAttribute: true;
815
+ /**
816
+ *
817
+ * @param array {BufferArray} Buffer数据
818
+ * @param itemSize 单元长度,vec3是3,vec4是4
819
+ * @param normalized
820
+ */
821
+ constructor(array: TypedArray, itemSize: number, normalized?: boolean);
822
+ set needsUpdate(value: boolean);
823
+ onUploadCallback?: () => void;
824
+ onUpload(callback: () => void): this;
825
+ setUsage(usage: any): this;
826
+ copy(source: BufferAttribute): this;
827
+ copyAt(index1: number, attribute: BufferAttribute, index2: number): this;
828
+ copyArray(array: ArrayLike<number>): this;
829
+ copyColorsArray(colors: {
830
+ r: number;
831
+ g: number;
832
+ b: number;
833
+ }[]): this;
834
+ copyVec2sArray(vectors: {
835
+ x: number;
836
+ y: number;
837
+ }[]): this;
838
+ copyVec3sArray(vectors: {
839
+ x: number;
840
+ y: number;
841
+ z: number;
842
+ }[]): this;
843
+ copyVec4sArray(vectors: {
844
+ x: number;
845
+ y: number;
846
+ z: number;
847
+ w: number;
848
+ }[]): this;
849
+ applyMat3(m: Mat3): this;
850
+ applyMat4(m: Mat4): this;
851
+ applyNormalMat(m: Mat3): this;
852
+ transformDirection(m: Mat4): this;
853
+ set(value: ArrayLike<number>, offset: number): this;
854
+ getX(index: number): number;
855
+ setX(index: number, x: number): this;
856
+ getY(index: number): number;
857
+ setY(index: number, y: number): this;
858
+ getZ(index: number): number;
859
+ setZ(index: number, z: number): this;
860
+ getW(index: number): number;
861
+ setW(index: number, w: number): this;
862
+ setXY(index: number, x: number, y: number): this;
863
+ setXYZ(index: number, x: number, y: number, z: number): this;
864
+ setXYZW(index: number, x: number, y: number, z: number, w: number): this;
865
+ clone(): BufferAttribute;
866
+ toJSON(): {
867
+ itemSize: number;
868
+ type: string;
869
+ array: number[];
870
+ normalized: boolean;
871
+ };
872
+ }
873
+ declare class Int8BufferAttribute extends BufferAttribute {
874
+ constructor(array: any, itemSize: number, normalized?: boolean);
875
+ }
876
+ declare class Uint8BufferAttribute extends BufferAttribute {
877
+ constructor(array: any, itemSize: number, normalized?: boolean);
878
+ }
879
+ declare class Uint8ClampedBufferAttribute extends BufferAttribute {
880
+ constructor(array: any, itemSize: number, normalized?: boolean);
881
+ }
882
+ declare class Int16BufferAttribute extends BufferAttribute {
883
+ constructor(array: any, itemSize: number, normalized?: boolean);
884
+ }
885
+ declare class Uint16BufferAttribute extends BufferAttribute {
886
+ constructor(array: any, itemSize: number, normalized?: boolean);
887
+ }
888
+ declare class Int32BufferAttribute extends BufferAttribute {
889
+ constructor(array: any, itemSize: number, normalized?: boolean);
890
+ }
891
+ declare class Uint32BufferAttribute extends BufferAttribute {
892
+ constructor(array: any, itemSize: number, normalized?: boolean);
893
+ }
894
+ declare class Float32BufferAttribute extends BufferAttribute {
895
+ constructor(array: any, itemSize: number, normalized?: boolean);
896
+ }
897
+ declare class Float64BufferAttribute extends BufferAttribute {
898
+ constructor(array: any, itemSize: number, normalized?: boolean);
899
+ }
863
900
 
864
- declare class Polygon<T> extends Polyline<T> {
865
- isPolygon: boolean;
866
- constructor(vs?: any[]);
867
- offset(distance: number, normal?: Vec3): Polygon<T>;
868
- containPoint(point: Vec3): void;
901
+ interface IGeometry {
902
+ position: number[];
903
+ normal?: number[];
904
+ index?: number[];
905
+ uv?: number[];
906
+ uv2?: number[];
907
+ tangent?: number[];
908
+ }
909
+ interface IBufferGeometry {
910
+ position: Float32Array | undefined;
911
+ index?: Uint32Array | Uint16Array;
912
+ normal?: Float32Array;
913
+ uv?: Float32Array;
914
+ uv2?: Float32Array;
915
+ tangent?: Float32Array;
916
+ }
917
+ /**
918
+ * BufferType 几何体,用于独立计算几何体
919
+ */
920
+ declare class BufferGeometry {
921
+ name: string;
922
+ boundingBox: Box | undefined;
923
+ boundingSphere: Sphere | undefined;
924
+ morphAttributes: any;
925
+ morphTargetsRelative: boolean;
926
+ index: BufferAttribute | undefined;
927
+ attributes: {
928
+ [key: string]: BufferAttribute;
929
+ };
930
+ groups: {
931
+ start: number;
932
+ count: number;
933
+ materialIndex?: number;
934
+ }[];
935
+ drawRange: {
936
+ start: number;
937
+ count: number;
938
+ };
939
+ parameters: any;
940
+ readonly isBufferGeometry: true;
941
+ constructor();
942
+ /**
943
+ * 转化成BufferArray来计算
944
+ * @param geo
945
+ */
946
+ setFromGeometry(geo: IGeometry | IBufferGeometry): this;
947
+ getIndex(): BufferAttribute | undefined;
948
+ setIndex(index: BufferAttribute | TypedArray | number[]): void;
949
+ getAttribute(name: string): BufferAttribute;
950
+ setAttribute(name: string, attribute: BufferAttribute): this;
951
+ addAttribute(name: string, attribute: BufferAttribute | TypedArray | Array<number | Vec2 | Vec3 | Vec4>, itemSize?: number): this;
952
+ deleteAttribute(name: string): this;
953
+ addGroup(start: number, count: number, materialIndex?: number): void;
954
+ clearGroups(): void;
955
+ setDrawRange(start: number, count: number): void;
956
+ applyMat4(matrix: Mat4): this;
957
+ rotateX(angle: number): this;
958
+ rotateY(angle: number): this;
959
+ rotateZ(angle: number): this;
960
+ translate(x: number, y: number, z: number): this;
961
+ scale(x: number, y: number, z: number): this;
962
+ lookAt(vector: Vec3): this;
963
+ center(): this;
964
+ setFromObject(object: any): this;
965
+ setFromPoints(points: Vec3[]): this;
966
+ updateFromObject(object: any): this;
967
+ computeBoundingBox(): void;
968
+ computeBoundingSphere(): void;
969
+ computeFaceNormals(): this;
970
+ computeVertexNormals(): void;
971
+ merge(geometry: BufferGeometry, offset: number): this | undefined;
972
+ normalizeNormals(): void;
973
+ toFlat(): BufferGeometry;
974
+ toNonIndexed(): BufferGeometry;
975
+ toJSON(): any;
976
+ userData(userData: any): void;
977
+ clone(): BufferGeometry;
978
+ copy(source: BufferGeometry): this;
869
979
  }
870
980
 
871
- declare enum ClipType {
872
- Intersection = 0,
873
- Union = 1,
874
- Difference = 2,
875
- Xor = 3
876
- }
877
- /**
878
- * 线段正反原则:右手坐标系中,所在平面为XZ平面,把指向方向看着负Z轴,x正为正方向,x负为负方向
879
- */
880
- declare class Polyline<T> extends ArrayList<T> {
881
- isCoPlanar: boolean;
882
- isPolyline: boolean;
883
- normal: Vec3;
884
- constructor(vs?: Array<T> | Polyline<T> | Polygon<T>, normal?: Vec3);
885
- static CleanPolygon(polys: any, delta: number, jointype: JoinType | undefined, endtype: EndType | undefined, limit: number): void;
886
- static OffsetPaths(polys: any, delta: number, jointype: JoinType | undefined, endtype: EndType | undefined, limit: number): void;
887
- static SimplifyPolygon(polys: any, delta: number, jointype: JoinType | undefined, endtype: EndType | undefined, limit: number): void;
888
- /**
889
- * 偏移
890
- * @param {Number} distance 偏移距离
891
- * @param {Vector3} normal 折线所在平面法线
892
- */
893
- offset(distance: number, normal?: Vec3, endtype?: EndType, jointype?: JoinType): Polyline<T>;
894
- /**
895
- * 圆角 将折线拐点圆角化
896
- * @param {Number} useDistance 圆角段距离
897
- * @param {Number} segments 分切割段数
898
- */
899
- corner(useDistance: number, normal?: Vec3): Polyline<T>;
981
+ /** Plane equation: normal.dot(point) + w = 0. */
982
+ declare class Plane implements GeometryQuery<Plane> {
983
+ normal: Vec3;
984
+ w: number;
985
+ constructor(normal?: Vec3, w?: number);
986
+ private validate;
987
+ get origin(): Vec3;
988
+ static setFromPointNormal(point: Vec3, normal: Vec3): Plane;
989
+ setFromPointNormal(point: Vec3, normal: Vec3): this;
990
+ set(normal: Vec3, w: number): this;
991
+ copy(plane: Plane): this;
992
+ clone(): Plane;
993
+ setComponents(x: number, y: number, z: number, w: number): this;
994
+ normalize(): this;
995
+ setFromThreePoint(a: Vec3, b: Vec3, c: Vec3): this;
996
+ negate(): this;
997
+ signedDistanceToPoint(point: Vec3): number;
998
+ frontback(point: Vec3): number;
999
+ distancePoint(point: Vec3): DistanceResult;
1000
+ distanceRay(ray: Ray): DistanceResult;
1001
+ distanceLine(line: Line): DistanceResult;
1002
+ distanceSegment(segment: Segment): DistanceResult;
1003
+ distanceTriangle(triangle: Triangle): DistanceResult;
1004
+ distancePlane(plane: Plane): DistanceResult;
1005
+ intersectSegmentLw(segment: Segment | Vec3[]): Vec3 | Vec3[] | null;
1006
+ intersectLine(line: Line, result?: Vec3): Vec3 | undefined;
1007
+ intersectRay(ray: Ray, result?: Vec3): Vec3 | undefined;
1008
+ splitSegment(segment: Segment | Vec3[]): {
1009
+ intersectPoint: Vec3 | undefined;
1010
+ negative: Vec3[];
1011
+ positive: Vec3[];
1012
+ common: Vec3[];
1013
+ orientation: Orientation;
1014
+ };
1015
+ splitTriangle(triangle: Triangle | Vec3[]): ISplitResult;
1016
+ /** Ordered polygons on either side; cut vertices are included in both. */
1017
+ splitConvexPolygon(polygon: Vec3[]): ISplitResult;
1018
+ orientationPoint(point: Vec3): Orientation;
1019
+ /** Split a triangle mesh surface, interpolating attributes. Does not cap cuts. */
1020
+ static splitGeometry(plane: Plane, geometry: IGeometry): {
1021
+ positive: IGeometry;
1022
+ negative: IGeometry;
1023
+ common: IGeometry;
1024
+ };
1025
+ readonly kind: GeometryKind;
1026
+ toJSON(): GeometryData;
900
1027
  }
901
1028
 
902
- declare class Line {
903
- origin: Vec3;
904
- end: Vec3;
905
- direction: Vec3;
906
- constructor(origin?: Vec3, end?: Vec3);
907
- set(origin: Vec3, end: Vec3): this;
908
- distancePoint(pt: Vec3): DistanceResult;
909
- distanceSegment(segment: Segment): DistanceResult;
910
- /**
911
- * 直线到直线的距离
912
- * 参数与最近点顺序一致
913
- * @param {Line} line
914
- */
915
- distanceLine(line: Line): DistanceResult;
916
- /**
917
- * 直线与射线的距离
918
- * @param {Ray} ray
919
- */
920
- distanceRay(ray: Ray): DistanceResult;
921
- /**
922
- *
923
- * @param triangle
924
- */
925
- distanceTriangle(triangle: Triangle): DistanceResult;
926
- distancePolyline(polyline: Polyline<Vec3> | Vec3[]): DistanceResult;
927
- /**
928
- * 线与平面相交
929
- * @param plane
930
- * @param result
931
- */
932
- intersectPlane(plane: Plane, result?: Vec3): Vec3 | undefined;
933
- }
1029
+ declare class Line implements GeometryQuery<Line> {
1030
+ origin: Vec3;
1031
+ end: Vec3;
1032
+ direction: Vec3;
1033
+ constructor(origin?: Vec3, end?: Vec3);
1034
+ set(origin: Vec3, end: Vec3): this;
1035
+ distancePoint(point: Vec3): DistanceResult;
1036
+ distanceSegment(segment: Segment): DistanceResult;
1037
+ /**
1038
+ * 直线到直线的距离
1039
+ * 参数与最近点顺序一致
1040
+ * @param {Line} line
1041
+ */
1042
+ distanceLine(line: Line): DistanceResult;
1043
+ /**
1044
+ * 直线与射线的距离
1045
+ * @param {Ray} ray
1046
+ */
1047
+ distanceRay(ray: Ray): DistanceResult;
1048
+ /**
1049
+ *
1050
+ * @param triangle
1051
+ */
1052
+ distanceTriangle(triangle: Triangle): DistanceResult;
1053
+ distancePolyline(polyline: Polyline<Vec3> | Vec3[]): DistanceResult;
1054
+ /**
1055
+ * 线与平面相交
1056
+ * @param plane
1057
+ * @param result
1058
+ */
1059
+ intersectPlane(plane: Plane, result?: Vec3): Vec3 | undefined;
1060
+ distancePlane(plane: Plane): DistanceResult;
1061
+ distanceSphere(sphere: Sphere): DistanceResult;
1062
+ distanceCapsule(capsule: Capsule): DistanceResult;
1063
+ copy(source: Line): this;
1064
+ clone(): Line;
1065
+ readonly kind: GeometryKind;
1066
+ distanceBox(box: Box): DistanceResult;
1067
+ distanceRectangle(rectangle: Rectangle): DistanceResult;
1068
+ toJSON(): GeometryData;
1069
+ }
934
1070
  declare function line(start?: Vec3, end?: Vec3): Line;
935
1071
 
936
- declare class Capsule extends Segment {
937
- radius: number;
938
- /**
939
- * 胶囊体
940
- * @param {Point|Vec3} p0 点0
941
- * @param {Point|Vec3} p1 点1
942
- * @param {Number} radius 半径
943
- */
944
- constructor(p0: Vec3, p1: Vec3, radius?: number);
1072
+ declare class Capsule extends Segment implements GeometryQuery<Capsule> {
1073
+ radius: number;
1074
+ /**
1075
+ * 胶囊体
1076
+ * @param {Point|Vec3} p0 点0
1077
+ * @param {Point|Vec3} p1 点1
1078
+ * @param {Number} radius 半径
1079
+ */
1080
+ constructor(p0: Vec3, p1: Vec3, radius?: number);
1081
+ copy(source: Capsule): this;
1082
+ clone(): Capsule;
1083
+ set(p0: Vec3, p1: Vec3, radius?: number): this;
1084
+ distancePoint(point: Vec3): DistanceResult;
1085
+ distanceSphere(sphere: Sphere): DistanceResult;
1086
+ distanceCapsule(capsule: Capsule): DistanceResult;
1087
+ distanceSegment(segment: Segment): DistanceResult;
1088
+ distanceLine(line: Line): DistanceResult;
1089
+ distanceRay(ray: Ray): DistanceResult;
1090
+ distancePlane(plane: Plane): DistanceResult;
1091
+ distanceTriangle(triangle: Triangle): DistanceResult;
1092
+ containsPoint(point: Vec3): boolean;
1093
+ readonly kind: GeometryKind;
1094
+ distanceBox(box: Box): DistanceResult;
1095
+ distanceRectangle(rectangle: Rectangle): DistanceResult;
1096
+ toJSON(): GeometryData;
945
1097
  }
946
1098
 
947
- declare class Rectangle extends Array {
948
- extent: number[];
949
- axis: Vec3[];
950
- center: Vec3;
951
- constructor(v0: Vec3, v1: Vec3, v2: Vec3, v3: Vec3);
1099
+ declare class Box implements GeometryQuery<Box> {
1100
+ min: Vec3;
1101
+ max: Vec3;
1102
+ _center: Vec3;
1103
+ constructor(min?: Vec3, max?: Vec3);
1104
+ get center(): Vec3;
1105
+ /**
1106
+ *
1107
+ * @param {Array<Vec3>} points
1108
+ */
1109
+ setFromPoints(points: any): this;
1110
+ expand(...points: any[]): this;
1111
+ makeEmpty(): this;
1112
+ clone(): Box;
1113
+ copy(box: Box): this;
1114
+ setFromCenterAndSize(center: Vec3, size: Vec3): this;
1115
+ setFromBufferAttribute(attribute: BufferAttribute): this;
1116
+ expandByPoint(point: Vec3): this;
1117
+ isEmpty(): boolean;
1118
+ getCenter(target: Vec3): Vec3;
1119
+ set(min: Vec3, max: Vec3): this;
1120
+ containsPoint(point: Vec3): boolean;
1121
+ distancePoint(point: Vec3): DistanceResult;
1122
+ distanceBox(box: Box): DistanceResult;
1123
+ readonly kind: GeometryKind;
1124
+ distanceLine(line: Line): DistanceResult;
1125
+ distanceRay(ray: Ray): DistanceResult;
1126
+ distanceSegment(segment: Segment): DistanceResult;
1127
+ distanceSphere(sphere: Sphere): DistanceResult;
1128
+ distanceCapsule(capsule: Capsule): DistanceResult;
1129
+ distancePlane(plane: Plane): DistanceResult;
1130
+ distanceTriangle(triangle: Triangle): DistanceResult;
1131
+ distanceRectangle(rectangle: Rectangle): DistanceResult;
1132
+ toJSON(): GeometryData;
952
1133
  }
953
1134
 
954
- declare class Circle {
955
- center: Vec3;
956
- radius: number;
957
- normal: Vec3;
958
- startAngle: number;
959
- lengthAngle: number;
960
- radiusSqr: number;
961
- /**
962
- * 圆圈
963
- * @param {Vec3} center 中心点
964
- * @param {Vec3} normal 法线
965
- * @param {Number} radius 半径
966
- */
967
- constructor(center?: Vec3, radius?: number, startAngle?: number, lengthAngle?: number, normal?: Vec3);
968
- area(): number;
969
- /**
970
- * 两个点
971
- * @param fixp0
972
- * @param fixp1
973
- * @param movep
974
- * @param normal
975
- */
976
- arc1(fixp0: Vec3, fixp1: Vec3, movep: Vec3, normal?: Vec3): void;
977
- /**
978
- * 全两个点确定半径,后面点确定 弧度 ,只需要检测鼠标移动时鼠标是否跨过第一条半径即可确定顺逆时针
979
- * @param fixp0
980
- * @param fixp1
981
- * @param movep
982
- */
983
- arc2(center: Vec3, fixp1: Vec3, movep: Vec3, ccw?: boolean, normal?: Vec3): void;
984
- setFrom3Points(p0: Vec3, p1: Vec3, p2: Vec3, normal?: Vec3): this;
985
- /**
986
- * 将圆环或者圆弧转化为路径点,生成XY平面上得三维点
987
- * @param center 中心点
988
- * @param radius 半径
989
- * @param startAngle 起始角 右手坐标系 以X正坐标轴为起点 单位弧度
990
- * @param lengthAngle 弧度长度 单位弧度
991
- * @param segment 分段
992
- */
993
- static toVecs(center: Vec3, radius: number, startAngle?: number, lengthAngle?: number, up?: Vec3, segment?: number): Vec3[];
994
- /**
995
- * 在p点延伸a,b两个方向,生成半径为r的圆弧,圆弧所在位置在a,b向量的内夹角
996
- * @param p 位置
997
- * @param a a方向
998
- * @param b b方向
999
- * @param r 圆弧半径
1000
- */
1001
- static PAdBdtoVecs(p: Vec3, a: Vec3, b: Vec3, r: number, segment?: number): Vec3[];
1002
- static PApBptoVecs(p: Vec3, a: Vec3, b: Vec3, r: number, segment?: number): Vec3[];
1003
- }
1135
+ declare class Circle implements GeometryQuery<Circle> {
1136
+ center: Vec3;
1137
+ radius: number;
1138
+ normal: Vec3;
1139
+ startAngle: number;
1140
+ lengthAngle: number;
1141
+ radiusSqr: number;
1142
+ /**
1143
+ * 圆圈
1144
+ * @param {Vec3} center 中心点
1145
+ * @param {Vec3} normal 法线
1146
+ * @param {Number} radius 半径
1147
+ */
1148
+ constructor(center?: Vec3, radius?: number, startAngle?: number, lengthAngle?: number, normal?: Vec3);
1149
+ area(): number;
1150
+ /**
1151
+ * 两个点
1152
+ * @param fixp0
1153
+ * @param fixp1
1154
+ * @param movep
1155
+ * @param normal
1156
+ */
1157
+ arc1(fixp0: Vec3, fixp1: Vec3, movep: Vec3, normal?: Vec3): void;
1158
+ /**
1159
+ * 全两个点确定半径,后面点确定 弧度 ,只需要检测鼠标移动时鼠标是否跨过第一条半径即可确定顺逆时针
1160
+ * @param fixp0
1161
+ * @param fixp1
1162
+ * @param movep
1163
+ */
1164
+ arc2(center: Vec3, fixp1: Vec3, movep: Vec3, ccw?: boolean, normal?: Vec3): this;
1165
+ setFrom3Points(p0: Vec3, p1: Vec3, p2: Vec3, normal?: Vec3): this;
1166
+ /**
1167
+ * 将圆环或者圆弧转化为路径点,生成XY平面上得三维点
1168
+ * @param center 中心点
1169
+ * @param radius 半径
1170
+ * @param startAngle 起始角 右手坐标系 以X正坐标轴为起点 单位弧度
1171
+ * @param lengthAngle 弧度长度 单位弧度
1172
+ * @param segment 分段
1173
+ */
1174
+ static toVecs(center: Vec3, radius: number, startAngle?: number, lengthAngle?: number, up?: Vec3, segment?: number): Vec3[];
1175
+ /**
1176
+ * 在p点延伸a,b两个方向,生成半径为r的圆弧,圆弧所在位置在a,b向量的内夹角
1177
+ * @param p 位置
1178
+ * @param a a方向
1179
+ * @param b b方向
1180
+ * @param r 圆弧半径
1181
+ */
1182
+ static PAdBdtoVecs(p: Vec3, a: Vec3, b: Vec3, r: number, segment?: number): Vec3[];
1183
+ static PApBptoVecs(p: Vec3, a: Vec3, b: Vec3, r: number, segment?: number): Vec3[];
1184
+ set(center: Vec3, radius: number, normal?: Vec3): this;
1185
+ copy(source: Circle): this;
1186
+ clone(): Circle;
1187
+ distancePoint(point: Vec3): DistanceResult;
1188
+ readonly kind: GeometryKind;
1189
+ toJSON(): GeometryData;
1190
+ }
1004
1191
  declare function circle(center?: Vec3, radius?: number): Circle;
1005
1192
 
1006
- declare class Disk {
1007
- center: Vec3;
1008
- normal: Vec3;
1009
- radius: number;
1010
- w: number;
1011
- constructor(center: Vec3, radius: number, normal?: Vec3);
1012
- area(): number;
1013
- }
1193
+ declare class Disk implements GeometryQuery<Disk> {
1194
+ center: Vec3;
1195
+ normal: Vec3;
1196
+ radius: number;
1197
+ w: number;
1198
+ constructor(center: Vec3, radius: number, normal?: Vec3);
1199
+ area(): number;
1200
+ set(center: Vec3, radius: number, normal?: Vec3): this;
1201
+ copy(source: Disk): this;
1202
+ clone(): Disk;
1203
+ distancePoint(point: Vec3): DistanceResult;
1204
+ readonly kind: GeometryKind;
1205
+ toJSON(): GeometryData;
1206
+ }
1014
1207
  declare function disk(center: Vec3, radius: number, normal: Vec3): Disk;
1015
1208
 
1016
- interface IVec2 {
1017
- x: number;
1018
- y: number;
1019
- }
1020
- interface IVec3 extends IVec2 {
1021
- z: number;
1022
- }
1023
- interface IVec4 extends IVec3 {
1024
- w: number;
1025
- }
1026
- declare class Vec3 implements IVec3 {
1027
- private _x;
1028
- private _y;
1029
- private _z;
1030
- constructor(_x?: number, _y?: number, _z?: number);
1031
- get x(): number;
1032
- set x(value: number);
1033
- get y(): number;
1034
- set y(value: number);
1035
- get z(): number;
1036
- set z(value: number);
1037
- static isVec3(v: any): boolean;
1038
- get isVec3(): boolean;
1039
- static get Up(): Vec3;
1040
- static get Down(): Vec3;
1041
- static get UnitX(): Vec3;
1042
- static get UnitY(): Vec3;
1043
- static get UnitZ(): Vec3;
1044
- set(x: number, y: number, z: number): this;
1045
- setScalar(scalar: number): this;
1046
- setComponent(index: number, value: number): this;
1047
- getComponent(index: number): number;
1048
- clone(): Vec3;
1049
- copy(v: Vec3): this;
1050
- add(v: Vec3, w?: Vec3): this;
1051
- addScalar(s: number): this;
1052
- addVecs(a: Vec3, b: Vec3): this;
1053
- addScaledVec(v: Vec3, s: number): this;
1054
- sub(v: Vec3, w?: Vec3): this;
1055
- subScalar(s: number): this;
1056
- subVecs(a: Vec3, b: Vec3): this;
1057
- multiply(v: Vec3, w?: Vec3): this;
1058
- multiplyScalar(scalar: number): this;
1059
- multiplyVecs(a: Vec3, b: Vec3): this;
1060
- applyEuler(euler: Euler): this;
1061
- applyAxisAngle(axis: any, angle: any): this;
1062
- applyNormalMat(m: Mat3): this;
1063
- applyMat3(m: Mat3): this;
1064
- applyMat4(m: Mat4): this;
1065
- applyQuat(q: Quat): this;
1066
- project(camera: {
1067
- matrixWorldInverse: any;
1068
- projectionMat: any;
1069
- }): this;
1070
- unproject(camera: {
1071
- projectionMatInverse: any;
1072
- matrixWorld: any;
1073
- }): this;
1074
- transformDirection(m: Mat4): this;
1075
- divide(v: Vec3): this;
1076
- divideScalar(scalar: number): this;
1077
- min(v: Vec3): this;
1078
- max(v: Vec3): this;
1079
- clamp(min: Vec3, max: Vec3): this;
1080
- clampScalar(minVal: number, maxVal: number): this;
1081
- clampLength(min: number, max: number): this;
1082
- floor(): this;
1083
- ceil(): this;
1084
- round(): this;
1085
- roundToZero(): this;
1086
- negate(): this;
1087
- dot(v: Vec3): number;
1088
- lengthSq(): number;
1089
- length(): number;
1090
- manhattanLength(): number;
1091
- normalize(robust?: boolean): this;
1092
- setLength(length: any): this;
1093
- lerp(v: Vec3, alpha: number): this;
1094
- lerpVecs(v1: Vec3, v2: any, alpha: any): this;
1095
- slerp(v2: any, radian: number): void;
1096
- /**
1097
- * v1 到 v2 选择angle弧度 v1,v2构成一个平面
1098
- * @param v1
1099
- * @param v2
1100
- * @param alpha
1101
- * @returns
1102
- */
1103
- slerpVecs(v1: Vec3, v2: any, radian: number): void;
1104
- cross(v: Vec3, w?: Vec3): this;
1105
- crossVecs(a: Vec3, b: Vec3): this;
1106
- projectOnVec(vec: Vec3): this;
1107
- /**
1108
- * 投影到法线的所在平面 相当于平面上距离点最近的点
1109
- * @param planeNormal
1110
- * @returns
1111
- */
1112
- projectOnPlaneNormal(planeNormal: any): this;
1113
- /**
1114
- * 投影到平面
1115
- * @param normal 正交化的法线
1116
- * @param w 距离
1117
- * @returns
1118
- */
1119
- projectOnPlaneNormalDis(normal: Vec3, w: number): this;
1120
- /**
1121
- * 投影到平面
1122
- * @param plane 平面
1123
- * @returns
1124
- */
1125
- projectOnPlane(plane: Plane): this;
1126
- /**
1127
- * 从指定方向线(斜线,也可能是法线)上投影到平面
1128
- * @param planeNormal
1129
- * @param dir
1130
- */
1131
- projectDirectionOnPlane(plane: Plane, dir: Vec3): this;
1132
- reflect(normal: any): this;
1133
- /**
1134
- * 两个向量的夹角
1135
- * @param v
1136
- * @param normal
1137
- * @returns
1138
- */
1139
- angleTo(v: Vec3, normal?: Vec3 | any): number;
1140
- /**
1141
- * 一个向量到另一个向量的角度
1142
- * @param v
1143
- * @param normal
1144
- * @returns
1145
- */
1146
- angleToEx(v: Vec3, normal: Vec3): number;
1147
- distanceTo(v: any): number;
1148
- distanceToSquared(v: Vec3): number;
1149
- manhattanDistanceTo(v: Vec3): number;
1150
- setFromSpherical(s: {
1151
- radius: number;
1152
- phi: number;
1153
- theta: number;
1154
- }): this;
1155
- setFromSphericalCoords(radius: number, phi: number, theta: number): this;
1156
- setFromCylindrical(c: {
1157
- radius: any;
1158
- theta: any;
1159
- y: any;
1160
- }): this;
1161
- setFromCylindricalCoords(radius: number, theta: number, y: number): this;
1162
- setFromMatPosition(m: {
1163
- elements: any;
1164
- }): this;
1165
- setFromMatScale(m: any): this;
1166
- setFromMatColumn(m: {
1167
- elements: any;
1168
- }, index: number): this;
1169
- equals(v: Vec3): boolean;
1170
- fromArray(array: ArrayLike<number>, offset?: number): this;
1171
- toArray(array?: TypedArrayLike, offset?: number): TypedArrayLike;
1172
- fromBufferAttribute(attribute: {
1173
- getX: (arg0: any) => number;
1174
- getY: (arg0: any) => number;
1175
- getZ: (arg0: any) => number;
1176
- }, index: any, offset?: number): this;
1177
- toFixed(fractionDigits: number | undefined): this;
1178
- distancePoint(point: Vec3): DistanceResult;
1179
- distanceVec3(point: Vec3): DistanceResult;
1180
- /**
1181
- * 点到直线的距离 point distance to Line
1182
- * @param line
1183
- */
1184
- distanceLine(line: Line): DistanceResult;
1185
- /**
1186
- * Test success
1187
- * 到射线的距离
1188
- * @param {Line} line
1189
- * @returns {Object} lineParameter 最近点的参数 lineClosest 最近点 distanceSqr 到最近点距离的平方 distance 到最近点距离
1190
- */
1191
- distanceRay(ray: Ray): DistanceResult;
1192
- /**
1193
- * Test success
1194
- * 到线段的距离
1195
- * @param {Line} line
1196
- * @returns {Object} lineParameter 最近点的参数 lineClosest 最近点 distanceSqr 到最近点距离的平方 distance 到最近点距离
1197
- */
1198
- distanceSegment(segment: Segment): DistanceResult;
1199
- /**
1200
- * 点与线段的距离
1201
- * @param plane
1202
- */
1203
- distancePlane(plane: Plane): DistanceResult;
1204
- /**
1205
- * 点与圆圈的距离
1206
- * @param {*} circle
1207
- * @param {*} disk
1208
- * @returns {} result
1209
- */
1210
- distanceCircle(circle: Circle): DistanceResult;
1211
- /**
1212
- * 点与圆盘的距离
1213
- * @param {*} Disk
1214
- * @returns {} result
1215
- */
1216
- distanceDisk(disk: Disk): DistanceResult;
1217
- /**
1218
- * 点与线段的距离
1219
- * 点与折线的距离 测试排除法,平均比线性检索(暴力法)要快两倍以上
1220
- * @param { Polyline | Vec3[]} polyline
1221
- */
1222
- distancePolyline(polyline: Polyline<Vec3> | Vec3[]): DistanceResult | null;
1223
- /**
1224
- * 点到三角形的距离
1225
- * @param {Triangle} triangle
1226
- */
1227
- distanceTriangle(triangle: Triangle): DistanceResult;
1228
- /**
1229
- * 点到矩形的距离
1230
- * @param {Rectangle} rectangle
1231
- */
1232
- distanceRectangle(rectangle: Rectangle): DistanceResult;
1233
- /**
1234
- * 点到胶囊的距离
1235
- * @param {Capsule} capsule
1236
- */
1237
- distanceCapsule(capsule: Capsule): DistanceResult;
1238
- }
1209
+ interface IVec2 {
1210
+ x: number;
1211
+ y: number;
1212
+ }
1213
+ interface IVec3 extends IVec2 {
1214
+ z: number;
1215
+ }
1216
+ interface IVec4 extends IVec3 {
1217
+ w: number;
1218
+ }
1219
+ declare class Vec3 implements IVec3 {
1220
+ private _x;
1221
+ private _y;
1222
+ private _z;
1223
+ constructor(_x?: number, _y?: number, _z?: number);
1224
+ get x(): number;
1225
+ set x(value: number);
1226
+ get y(): number;
1227
+ set y(value: number);
1228
+ get z(): number;
1229
+ set z(value: number);
1230
+ static isVec3(v: any): boolean;
1231
+ get isVec3(): boolean;
1232
+ static get Up(): Vec3;
1233
+ static get Down(): Vec3;
1234
+ static get UnitX(): Vec3;
1235
+ static get UnitY(): Vec3;
1236
+ static get UnitZ(): Vec3;
1237
+ set(x: number, y: number, z: number): this;
1238
+ setScalar(scalar: number): this;
1239
+ setComponent(index: number, value: number): this;
1240
+ getComponent(index: number): number;
1241
+ clone(): Vec3;
1242
+ copy(v: Vec3): this;
1243
+ add(v: Vec3, w?: Vec3): this;
1244
+ addScalar(s: number): this;
1245
+ addVecs(a: Vec3, b: Vec3): this;
1246
+ addScaledVec(v: Vec3, s: number): this;
1247
+ sub(v: Vec3, w?: Vec3): this;
1248
+ subScalar(s: number): this;
1249
+ subVecs(a: Vec3, b: Vec3): this;
1250
+ multiply(v: Vec3, w?: Vec3): this;
1251
+ multiplyScalar(scalar: number): this;
1252
+ multiplyVecs(a: Vec3, b: Vec3): this;
1253
+ applyEuler(euler: Euler): this;
1254
+ applyAxisAngle(axis: any, angle: any): this;
1255
+ applyNormalMat(m: Mat3): this;
1256
+ applyMat3(m: Mat3): this;
1257
+ applyMat4(m: Mat4): this;
1258
+ applyQuat(q: Quat): this;
1259
+ project(camera: {
1260
+ matrixWorldInverse: any;
1261
+ projectionMat: any;
1262
+ }): this;
1263
+ unproject(camera: {
1264
+ projectionMatInverse: any;
1265
+ matrixWorld: any;
1266
+ }): this;
1267
+ transformDirection(m: Mat4): this;
1268
+ divide(v: Vec3): this;
1269
+ divideScalar(scalar: number): this;
1270
+ min(v: Vec3): this;
1271
+ max(v: Vec3): this;
1272
+ clamp(min: Vec3, max: Vec3): this;
1273
+ clampScalar(minVal: number, maxVal: number): this;
1274
+ clampLength(min: number, max: number): this;
1275
+ floor(): this;
1276
+ ceil(): this;
1277
+ round(): this;
1278
+ roundToZero(): this;
1279
+ negate(): this;
1280
+ dot(v: Vec3): number;
1281
+ lengthSq(): number;
1282
+ length(): number;
1283
+ manhattanLength(): number;
1284
+ normalize(robust?: boolean): this;
1285
+ setLength(length: any): this;
1286
+ lerp(v: Vec3, alpha: number): this;
1287
+ lerpVecs(v1: Vec3, v2: any, alpha: any): this;
1288
+ slerp(v2: any, radian: number): void;
1289
+ /**
1290
+ * v1 到 v2 选择angle弧度 v1,v2构成一个平面
1291
+ * @param v1
1292
+ * @param v2
1293
+ * @param alpha
1294
+ * @returns
1295
+ */
1296
+ slerpVecs(v1: Vec3, v2: any, radian: number): void;
1297
+ cross(v: Vec3, w?: Vec3): this;
1298
+ crossVecs(a: Vec3, b: Vec3): this;
1299
+ projectOnVec(vec: Vec3): this;
1300
+ /**
1301
+ * 投影到法线的所在平面 相当于平面上距离点最近的点
1302
+ * @param planeNormal
1303
+ * @returns
1304
+ */
1305
+ projectOnPlaneNormal(normal: Vec3, w?: number): this;
1306
+ /**
1307
+ * 投影到平面
1308
+ * @param normal 正交化的法线
1309
+ * @param w 距离
1310
+ * @returns
1311
+ */
1312
+ projectOnPlaneNormalDis(normal: Vec3, w: number): this;
1313
+ /**
1314
+ * 投影到平面
1315
+ * @param plane 平面
1316
+ * @returns
1317
+ */
1318
+ projectOnPlane(plane: Plane): this;
1319
+ /**
1320
+ * 从指定方向线(斜线,也可能是法线)上投影到平面
1321
+ * @param planeNormal
1322
+ * @param dir
1323
+ */
1324
+ projectDirectionOnPlane(plane: Plane, dir: Vec3): this;
1325
+ reflect(normal: any): this;
1326
+ /**
1327
+ * 两个向量的夹角
1328
+ * @param v
1329
+ * @param normal
1330
+ * @returns
1331
+ */
1332
+ angleTo(v: Vec3, normal?: Vec3 | any): number;
1333
+ /**
1334
+ * 一个向量到另一个向量的角度
1335
+ * @param v
1336
+ * @param normal
1337
+ * @returns
1338
+ */
1339
+ angleToEx(v: Vec3, normal: Vec3): number;
1340
+ distanceTo(v: any): number;
1341
+ distanceToSquared(v: Vec3): number;
1342
+ manhattanDistanceTo(v: Vec3): number;
1343
+ setFromSpherical(s: {
1344
+ radius: number;
1345
+ phi: number;
1346
+ theta: number;
1347
+ }): this;
1348
+ setFromSphericalCoords(radius: number, phi: number, theta: number): this;
1349
+ setFromCylindrical(c: {
1350
+ radius: any;
1351
+ theta: any;
1352
+ y: any;
1353
+ }): this;
1354
+ setFromCylindricalCoords(radius: number, theta: number, y: number): this;
1355
+ setFromMatPosition(m: {
1356
+ elements: any;
1357
+ }): this;
1358
+ setFromMatScale(m: any): this;
1359
+ setFromMatColumn(m: {
1360
+ elements: any;
1361
+ }, index: number): this;
1362
+ equals(v: Vec3): boolean;
1363
+ fromArray(array: ArrayLike<number>, offset?: number): this;
1364
+ toArray(): number[];
1365
+ toArray<T extends TypedArrayLike>(array: T, offset?: number): T;
1366
+ fromBufferAttribute(attribute: {
1367
+ getX: (arg0: any) => number;
1368
+ getY: (arg0: any) => number;
1369
+ getZ: (arg0: any) => number;
1370
+ }, index: any, offset?: number): this;
1371
+ toFixed(fractionDigits: number | undefined): this;
1372
+ distancePoint(point: Vec3): DistanceResult;
1373
+ distanceVec3(point: Vec3): DistanceResult;
1374
+ /**
1375
+ * 点到直线的距离 point distance to Line
1376
+ * @param line
1377
+ */
1378
+ distanceLine(line: Line): DistanceResult;
1379
+ /**
1380
+ * Test success
1381
+ * 到射线的距离
1382
+ * @param {Line} line
1383
+ * @returns {Object} lineParameter 最近点的参数 lineClosest 最近点 distanceSqr 到最近点距离的平方 distance 到最近点距离
1384
+ */
1385
+ distanceRay(ray: Ray): DistanceResult;
1386
+ /**
1387
+ * Test success
1388
+ * 到线段的距离
1389
+ * @param {Line} line
1390
+ * @returns {Object} lineParameter 最近点的参数 lineClosest 最近点 distanceSqr 到最近点距离的平方 distance 到最近点距离
1391
+ */
1392
+ distanceSegment(segment: Segment): DistanceResult;
1393
+ /**
1394
+ * 点与线段的距离
1395
+ * @param plane
1396
+ */
1397
+ distancePlane(plane: Plane): DistanceResult;
1398
+ /**
1399
+ * 点与圆圈的距离
1400
+ * @param {*} circle
1401
+ * @param {*} disk
1402
+ * @returns {} result
1403
+ */
1404
+ distanceCircle(circle: Circle): DistanceResult;
1405
+ /**
1406
+ * 点与圆盘的距离
1407
+ * @param {*} Disk
1408
+ * @returns {} result
1409
+ */
1410
+ distanceDisk(disk: Disk): DistanceResult;
1411
+ /**
1412
+ * 点与线段的距离
1413
+ * 点与折线的距离 测试排除法,平均比线性检索(暴力法)要快两倍以上
1414
+ * @param { Polyline | Vec3[]} polyline
1415
+ */
1416
+ distancePolyline(polyline: Polyline<Vec3> | Vec3[]): DistanceResult;
1417
+ /**
1418
+ * 点到三角形的距离
1419
+ * @param {Triangle} triangle
1420
+ */
1421
+ distanceTriangle(triangle: Triangle): DistanceResult;
1422
+ /**
1423
+ * 点到矩形的距离
1424
+ * @param {Rectangle} rectangle
1425
+ */
1426
+ distanceRectangle(rectangle: Rectangle): DistanceResult;
1427
+ /**
1428
+ * 点到胶囊的距离
1429
+ * @param {Capsule} capsule
1430
+ */
1431
+ distanceCapsule(capsule: Capsule): DistanceResult;
1432
+ distanceSphere(sphere: Sphere): DistanceResult;
1433
+ distanceBox(box: Box): DistanceResult;
1434
+ readonly kind: "Point";
1435
+ toJSON(): GeometryData;
1436
+ }
1239
1437
  declare function v3(x?: number, y?: number, z?: number): Vec3;
1240
1438
 
1241
- declare class Mat4 {
1242
- elements: number[];
1243
- isMat4: boolean;
1244
- constructor();
1245
- set(n11: number, n12: number, n13: number, n14: number, n21: number, n22: number, n23: number, n24: number, n31: number, n32: number, n33: number, n34: number, n41: number, n42: number, n43: number, n44: number): this;
1246
- static get Identity(): Mat4;
1247
- identity(): this;
1248
- clone(): Mat4;
1249
- copy(m: Mat4): this;
1250
- copyPosition(m: {
1251
- elements: any;
1252
- }): this;
1253
- extractBasis(xAxis: Vec3, yAxis: Vec3, zAxis: Vec3): this;
1254
- makeBasis(xAxis: Vec3, yAxis: Vec3, zAxis: Vec3): this;
1255
- extractRotation(m: Mat4): this;
1256
- makeRotationFromEuler(euler: Euler): this;
1257
- makeRotationFromQuat(q: any): this;
1258
- lookAt(eye: Vec3, target: Vec3, up: Vec3): this;
1259
- multiply(m: Mat4, n?: Mat4): this;
1260
- premultiply(m: Mat4): this;
1261
- multiplyMats(a: Mat4, b: Mat4): this;
1262
- multiplyScalar(s: number): this;
1263
- applyToBufferAttribute(attribute: {
1264
- count: any;
1265
- getX: (arg0: number) => number;
1266
- getY: (arg0: number) => number;
1267
- getZ: (arg0: number) => number;
1268
- setXYZ: (arg0: number, arg1: number, arg2: number, arg3: number) => void;
1269
- }): {
1270
- count: any;
1271
- getX: (arg0: number) => number;
1272
- getY: (arg0: number) => number;
1273
- getZ: (arg0: number) => number;
1274
- setXYZ: (arg0: number, arg1: number, arg2: number, arg3: number) => void;
1275
- };
1276
- determinant(): number;
1277
- transpose(): this;
1278
- setPosition(x: number | Vec3 | any, y?: number, z?: number): this;
1279
- /**
1280
- * 矩阵求逆
1281
- * @returns 自己
1282
- */
1283
- invert(): Mat4;
1284
- getInverse(m: Mat4, throwOnDegenerate?: boolean): this;
1285
- scale(v: {
1286
- x: any;
1287
- y: any;
1288
- z: any;
1289
- }): this;
1290
- getMaxScaleOnAxis(): number;
1291
- makeTranslation(x: number, y: number, z: number): this;
1292
- makeRotationX(theta: number): this;
1293
- makeRotationY(theta: number): this;
1294
- makeRotationZ(theta: number): this;
1295
- makeRotationAxis(axis: {
1296
- x: any;
1297
- y: any;
1298
- z: any;
1299
- }, angle: number): this;
1300
- makeScale(x: number, y: number, z: number): this;
1301
- /**
1302
- * 6个参数 都是由两个值来影响 [v1][v2] v1表示v2轴在v1轴产生效果
1303
- * @param xy
1304
- * @param xz
1305
- * @param yx
1306
- * @param yz
1307
- * @param zx
1308
- * @param zy
1309
- * @returns
1310
- */
1311
- makeShear(xy: number, xz: number, yx: number, yz: number, zx: number, zy: number): this;
1312
- compose(position: Vec3, quat: Quat, scale: Euler | Vec3): this;
1313
- decompose(position: Vec3, quat: Quat, scale: Vec3): this;
1314
- makePerspective(left: number, right: number, top: number, bottom: number, near: number, far: number): this;
1315
- makeOrthographic(left: number, right: number, top: number, bottom: number, near: number, far: number): this;
1316
- equals(matrix: {
1317
- elements: any;
1318
- }): boolean;
1319
- fromArray(array: number[], offset?: number): this;
1320
- toArray(array?: number[], offset?: number): number[];
1321
- }
1439
+ declare class Mat4 {
1440
+ elements: number[];
1441
+ isMat4: boolean;
1442
+ constructor();
1443
+ set(n11: number, n12: number, n13: number, n14: number, n21: number, n22: number, n23: number, n24: number, n31: number, n32: number, n33: number, n34: number, n41: number, n42: number, n43: number, n44: number): this;
1444
+ static get Identity(): Mat4;
1445
+ identity(): this;
1446
+ clone(): Mat4;
1447
+ copy(m: Mat4): this;
1448
+ copyPosition(m: {
1449
+ elements: any;
1450
+ }): this;
1451
+ extractBasis(xAxis: Vec3, yAxis: Vec3, zAxis: Vec3): this;
1452
+ makeBasis(xAxis: Vec3, yAxis: Vec3, zAxis: Vec3): this;
1453
+ extractRotation(m: Mat4): this;
1454
+ makeRotationFromEuler(euler: Euler): this;
1455
+ makeRotationFromQuat(q: any): this;
1456
+ lookAt(eye: Vec3, target: Vec3, up: Vec3): this;
1457
+ multiply(m: Mat4, n?: Mat4): this;
1458
+ premultiply(m: Mat4): this;
1459
+ multiplyMats(a: Mat4, b: Mat4): this;
1460
+ multiplyScalar(s: number): this;
1461
+ applyToBufferAttribute(attribute: {
1462
+ count: any;
1463
+ getX: (arg0: number) => number;
1464
+ getY: (arg0: number) => number;
1465
+ getZ: (arg0: number) => number;
1466
+ setXYZ: (arg0: number, arg1: number, arg2: number, arg3: number) => void;
1467
+ }): {
1468
+ count: any;
1469
+ getX: (arg0: number) => number;
1470
+ getY: (arg0: number) => number;
1471
+ getZ: (arg0: number) => number;
1472
+ setXYZ: (arg0: number, arg1: number, arg2: number, arg3: number) => void;
1473
+ };
1474
+ determinant(): number;
1475
+ transpose(): this;
1476
+ setPosition(x: number | Vec3 | any, y?: number, z?: number): this;
1477
+ /**
1478
+ * 矩阵求逆
1479
+ * @returns 自己
1480
+ */
1481
+ invert(): Mat4;
1482
+ getInverse(m: Mat4, throwOnDegenerate?: boolean): this;
1483
+ scale(v: {
1484
+ x: any;
1485
+ y: any;
1486
+ z: any;
1487
+ }): this;
1488
+ getMaxScaleOnAxis(): number;
1489
+ makeTranslation(x: number, y: number, z: number): this;
1490
+ makeRotationX(theta: number): this;
1491
+ makeRotationY(theta: number): this;
1492
+ makeRotationZ(theta: number): this;
1493
+ makeRotationAxis(axis: {
1494
+ x: any;
1495
+ y: any;
1496
+ z: any;
1497
+ }, angle: number): this;
1498
+ makeScale(x: number, y: number, z: number): this;
1499
+ /**
1500
+ * 6个参数 都是由两个值来影响 [v1][v2] v1表示v2轴在v1轴产生效果
1501
+ * @param xy
1502
+ * @param xz
1503
+ * @param yx
1504
+ * @param yz
1505
+ * @param zx
1506
+ * @param zy
1507
+ * @returns
1508
+ */
1509
+ makeShear(xy: number, xz: number, yx: number, yz: number, zx: number, zy: number): this;
1510
+ compose(position: Vec3, quat: Quat, scale: Euler | Vec3): this;
1511
+ decompose(position: Vec3, quat: Quat, scale: Vec3): this;
1512
+ makePerspective(left: number, right: number, top: number, bottom: number, near: number, far: number): this;
1513
+ makeOrthographic(left: number, right: number, top: number, bottom: number, near: number, far: number): this;
1514
+ equals(matrix: {
1515
+ elements: any;
1516
+ }): boolean;
1517
+ fromArray(array: number[], offset?: number): this;
1518
+ toArray(array?: number[], offset?: number): number[];
1519
+ }
1322
1520
  declare function m4(): Mat4;
1323
1521
 
1324
- declare class Mat3 {
1325
- elements: number[];
1326
- isMat3: boolean;
1327
- constructor();
1328
- set(n11: number, n12: number, n13: number, n21: number, n22: number, n23: number, n31: number, n32: number, n33: number): this;
1329
- identity(): this;
1330
- clone(): Mat3;
1331
- copy(m: Mat3): this;
1332
- setFromMat4(m: Mat4): this;
1333
- applyToBufferAttribute(attribute: any): any;
1334
- multiply(m: Mat3): this;
1335
- premultiply(m: Mat3): this;
1336
- multiplyMatrices(a: Mat3, b: Mat3): this;
1337
- multiplyScalar(s: number): this;
1338
- determinant(): number;
1339
- getInverse(matrix: Mat3 | Mat4 | any, throwOnDegenerate?: boolean): this;
1340
- transpose(): this;
1341
- getNormalMat(mat4: Mat4): this;
1342
- transposeIntoArray(r: number[]): this;
1343
- setUvTransform(tx: any, ty: any, sx: number, sy: number, rotation: number, cx: number, cy: number): void;
1344
- scale(sx: number, sy: number): this;
1345
- rotate(theta: number): this;
1346
- translate(tx: number, ty: number): this;
1347
- equals(matrix: Mat3): boolean;
1348
- fromArray(array: number[], offset?: number): this;
1349
- toArray(array?: number[], offset?: number): number[];
1350
- }
1351
- declare function m3(): Mat3;
1352
-
1353
- declare class Vec2 {
1354
- private _x;
1355
- private _y;
1356
- isVec2: boolean;
1357
- constructor(_x?: number, _y?: number);
1358
- get x(): number;
1359
- set x(value: number);
1360
- get y(): number;
1361
- set y(value: number);
1362
- static isVec2(v: any): boolean;
1363
- get width(): number;
1364
- set width(value: number);
1365
- get height(): number;
1366
- set height(value: number);
1367
- static get UnitX(): Vec2;
1368
- static get UnitY(): Vec2;
1369
- set(x: number, y: number): this;
1370
- setScalar(scalar: number): this;
1371
- setX(x: number): this;
1372
- setY(y: number): this;
1373
- setComponent(index: number, value: number): this;
1374
- getComponent(index: number): number;
1375
- clone(): Vec2;
1376
- copy(v: Vec2): Vec2;
1377
- add(v: Vec2, w?: Vec2): this;
1378
- addScalar(s: number): this;
1379
- addVecs(a: Vec2, b: Vec2): this;
1380
- addScaledVec(v: Vec2, s: number): this;
1381
- sub(v: Vec2, w: Vec2): this;
1382
- subScalar(s: number): this;
1383
- subVecs(a: Vec2, b: Vec2): this;
1384
- multiply(v: Vec2): this;
1385
- multiplyScalar(scalar: number): this;
1386
- divide(v: Vec2): this;
1387
- divideScalar(scalar: number): this;
1388
- applyMat3(m: Mat3): this;
1389
- min(v: Vec2): this;
1390
- max(v: Vec2): this;
1391
- clamp(min: Vec2, max: Vec2): this;
1392
- clampScalar(minVal: number, maxVal: number): this;
1393
- clampLength(min: number, max: number): this;
1394
- floor(): this;
1395
- ceil(): this;
1396
- round(): this;
1397
- roundToZero(): this;
1398
- negate(): this;
1399
- dot(v: Vec2): number;
1400
- cross(v: Vec2): number;
1401
- lengthSq(): number;
1402
- length(): number;
1403
- manhattanLength(): number;
1404
- normalize(): this;
1405
- angle(): number;
1406
- distanceTo(v: Vec2): number;
1407
- distanceToSquared(v: Vec2): number;
1408
- manhattanDistanceTo(v: Vec2): number;
1409
- setLength(length: number): this;
1410
- lerp(v: Vec2, alpha: number): this;
1411
- lerpVecs(v1: Vec2, v2: Vec2, alpha: number): this;
1412
- equals(v: Vec2): boolean;
1413
- fromArray(array: TypedArrayLike, offset?: number): this;
1414
- toArray(array?: TypedArrayLike, offset?: number): TypedArrayLike;
1415
- fromBufferAttribute(attribute: any, index: number, offset: any): this;
1416
- rotateAround(center: Vec2, angle: number): this;
1417
- }
1418
- declare function v2(): Vec2;
1522
+ declare class Euler {
1523
+ _x: number;
1524
+ _y: number;
1525
+ _z: number;
1526
+ _order: string;
1527
+ isEuler: boolean;
1528
+ constructor(_x?: number, _y?: number, _z?: number, _order?: string);
1529
+ get x(): number;
1530
+ set x(value: number);
1531
+ get y(): number;
1532
+ set y(value: number);
1533
+ get z(): number;
1534
+ set z(value: number);
1535
+ get order(): string;
1536
+ set order(value: string);
1537
+ set(x: number, y: number, z: number, order: string): this;
1538
+ clone(): Euler;
1539
+ copy(Euler: {
1540
+ _x: number;
1541
+ _y: number;
1542
+ _z: number;
1543
+ _order: string;
1544
+ }): this;
1545
+ setFromRotationMat(m: Mat4, order: string, update: boolean | undefined): this | undefined;
1546
+ setFromQuat(q: Quat, order?: any, update?: boolean): this | undefined;
1547
+ setFromVec3(v: {
1548
+ x: any;
1549
+ y: any;
1550
+ z: any;
1551
+ }, order: any): this;
1552
+ reorder(newOrder: any): this | undefined;
1553
+ equals(Euler: {
1554
+ _x: number;
1555
+ _y: number;
1556
+ _z: number;
1557
+ _order: string;
1558
+ }): boolean;
1559
+ fromArray(array: any[]): this;
1560
+ toArray(array?: any[], offset?: number): any[];
1561
+ toVec3(optionalResult: {
1562
+ set: (arg0: number, arg1: number, arg2: number) => any;
1563
+ }): any;
1564
+ }
1565
+ declare function euler(x?: number, y?: number, z?: number): Euler;
1419
1566
 
1420
- declare const delta4 = 0.0001;
1421
- declare const delta5 = 0.00001;
1422
- declare const delta6 = 0.000001;
1423
- declare const delta7 = 1e-7;
1424
- declare const delta8 = 1e-8;
1425
- declare const delta9 = 1e-9;
1426
- /**
1427
- * pi
1428
- *
1429
- * @type {Number}
1430
- * @constant
1431
- */
1432
- declare const PI: number;
1433
- /**
1434
- * 1/pi
1435
- *
1436
- * @type {Number}
1437
- * @constant
1438
- */
1439
- declare const ONE_OVER_PI: number;
1440
- /**
1441
- * pi/2
1442
- *
1443
- * @type {Number}
1444
- * @constant
1445
- */
1446
- declare const PI_OVER_TWO: number;
1447
- /**
1448
- * pi/3
1449
- *
1450
- * @type {Number}
1451
- * @constant
1452
- */
1453
- declare const PI_OVER_THREE: number;
1454
- /**
1455
- * pi/4
1456
- *
1457
- * @type {Number}
1458
- * @constant
1459
- */
1460
- declare const PI_OVER_FOUR: number;
1461
- /**
1462
- * pi/6
1463
- *
1464
- * @type {Number}
1465
- * @constant
1466
- */
1467
- declare const PI_OVER_SIX: number;
1468
- /**
1469
- * 3pi/2
1470
- *
1471
- * @type {Number}
1472
- * @constant
1473
- */
1474
- declare const THREE_PI_OVER_TWO: number;
1475
- /**
1476
- * 2pi
1477
- *
1478
- * @type {Number}
1479
- * @constant
1480
- */
1481
- declare const PI_TWO: number;
1482
- /**
1483
- * 1/2pi
1484
- *
1485
- * @type {Number}
1486
- * @constant
1487
- */
1488
- declare const ONE_OVER_TWO_PI: number;
1489
- /**
1490
- * The number of radians in a degree.
1491
- *
1492
- * @type {Number}
1493
- * @constant
1494
- */
1495
- declare const RADIANS_PER_DEGREE: number;
1496
- /**
1497
- * The number of degrees in a radian.
1498
- *
1499
- * @type {Number}
1500
- * @constant
1501
- */
1502
- declare const DEGREES_PER_RADIAN: number;
1503
- /**
1504
- * The number of radians in an arc second.
1505
- *
1506
- * @type {Number}
1507
- * @constant
1508
- */
1509
- declare const RADIANS_PER_ARCSECOND: number;
1510
- declare function sign(value: number): 1 | -1;
1511
- declare function approximateEqual(v1: number, v2: number, precision?: number): boolean;
1512
- declare function clamp(value: number, min: number, max: number): number;
1513
- declare function lerp(x: number, y: number, t: number): number;
1514
- declare function smoothstep(x: number, min: number, max: number): number;
1515
- declare function smootherstep(x: number, min: number, max: number): number;
1516
- declare function randInt(low: number, high: number): number;
1517
- /**
1518
- * 生成一个low~high之间的浮点数
1519
- * @param {*} low
1520
- * @param {*} high
1521
- */
1522
- declare function randFloat(low: number, high: number): number;
1523
- declare function isPowerOfTwo(value: number): boolean;
1524
- declare function ceilPowerOfTwo(value: number): number;
1525
- declare function floorPowerOfTwo(value: number): number;
1526
- declare function toRadians(degrees: number): number;
1527
- declare function ToDegrees(radians: number): number;
1528
- /**
1529
- * 数字或者向量固定位数
1530
- * @param {Object} obj 数字或者向量
1531
- * @param {*} fractionDigits
1532
- */
1533
- declare function toFixed(obj: {
1534
- toFixed: (arg0: any) => string;
1535
- x: number | undefined;
1536
- y: number | undefined;
1537
- z: number | undefined;
1538
- }, fractionDigits: number | undefined): number | {
1539
- toFixed: (arg0: any) => string;
1540
- x: number | undefined;
1541
- y: number | undefined;
1542
- z: number | undefined;
1543
- };
1544
- /**
1545
- * 数组中所有数字或者向量固定位数
1546
- * @param {Array} array
1547
- * @param {Number} precision
1548
- */
1567
+ declare const delta4 = 0.0001;
1568
+ declare const delta5 = 0.00001;
1569
+ declare const delta6 = 0.000001;
1570
+ declare const delta7 = 1e-7;
1571
+ declare const delta8 = 1e-8;
1572
+ declare const delta9 = 1e-9;
1573
+ /**
1574
+ * pi
1575
+ *
1576
+ * @type {Number}
1577
+ * @constant
1578
+ */
1579
+ declare const PI: number;
1580
+ /**
1581
+ * 1/pi
1582
+ *
1583
+ * @type {Number}
1584
+ * @constant
1585
+ */
1586
+ declare const ONE_OVER_PI: number;
1587
+ /**
1588
+ * pi/2
1589
+ *
1590
+ * @type {Number}
1591
+ * @constant
1592
+ */
1593
+ declare const PI_OVER_TWO: number;
1594
+ /**
1595
+ * pi/3
1596
+ *
1597
+ * @type {Number}
1598
+ * @constant
1599
+ */
1600
+ declare const PI_OVER_THREE: number;
1601
+ /**
1602
+ * pi/4
1603
+ *
1604
+ * @type {Number}
1605
+ * @constant
1606
+ */
1607
+ declare const PI_OVER_FOUR: number;
1608
+ /**
1609
+ * pi/6
1610
+ *
1611
+ * @type {Number}
1612
+ * @constant
1613
+ */
1614
+ declare const PI_OVER_SIX: number;
1615
+ /**
1616
+ * 3pi/2
1617
+ *
1618
+ * @type {Number}
1619
+ * @constant
1620
+ */
1621
+ declare const THREE_PI_OVER_TWO: number;
1622
+ /**
1623
+ * 2pi
1624
+ *
1625
+ * @type {Number}
1626
+ * @constant
1627
+ */
1628
+ declare const PI_TWO: number;
1629
+ /**
1630
+ * 1/2pi
1631
+ *
1632
+ * @type {Number}
1633
+ * @constant
1634
+ */
1635
+ declare const ONE_OVER_TWO_PI: number;
1636
+ /**
1637
+ * The number of radians in a degree.
1638
+ *
1639
+ * @type {Number}
1640
+ * @constant
1641
+ */
1642
+ declare const RADIANS_PER_DEGREE: number;
1643
+ /**
1644
+ * The number of degrees in a radian.
1645
+ *
1646
+ * @type {Number}
1647
+ * @constant
1648
+ */
1649
+ declare const DEGREES_PER_RADIAN: number;
1650
+ /**
1651
+ * The number of radians in an arc second.
1652
+ *
1653
+ * @type {Number}
1654
+ * @constant
1655
+ */
1656
+ declare const RADIANS_PER_ARCSECOND: number;
1657
+ declare function sign(value: number): 1 | -1;
1658
+ declare function approximateEqual(v1: number, v2: number, precision?: number): boolean;
1659
+ declare function clamp(value: number, min: number, max: number): number;
1660
+ declare function lerp(x: number, y: number, t: number): number;
1661
+ declare function smoothstep(x: number, min: number, max: number): number;
1662
+ declare function smootherstep(x: number, min: number, max: number): number;
1663
+ declare function randInt(low: number, high: number): number;
1664
+ /**
1665
+ * 生成一个low~high之间的浮点数
1666
+ * @param {*} low
1667
+ * @param {*} high
1668
+ */
1669
+ declare function randFloat(low: number, high: number): number;
1670
+ declare function isPowerOfTwo(value: number): boolean;
1671
+ declare function ceilPowerOfTwo(value: number): number;
1672
+ declare function floorPowerOfTwo(value: number): number;
1673
+ declare function toRadians(degrees: number): number;
1674
+ declare function ToDegrees(radians: number): number;
1675
+ /**
1676
+ * 数字或者向量固定位数
1677
+ * @param {Object} obj 数字或者向量
1678
+ * @param {*} fractionDigits
1679
+ */
1680
+ declare function toFixed(obj: {
1681
+ toFixed: (arg0: any) => string;
1682
+ x: number | undefined;
1683
+ y: number | undefined;
1684
+ z: number | undefined;
1685
+ }, fractionDigits: number | undefined): number | {
1686
+ toFixed: (arg0: any) => string;
1687
+ x: number | undefined;
1688
+ y: number | undefined;
1689
+ z: number | undefined;
1690
+ };
1691
+ /**
1692
+ * 数组中所有数字或者向量固定位数
1693
+ * @param {Array} array
1694
+ * @param {Number} precision
1695
+ */
1549
1696
  declare function toFixedAry(array: Array<any>, precision?: number): void;
1550
1697
 
1551
- declare class Color {
1552
- _r: number;
1553
- _g: number;
1554
- _b: number;
1555
- _a: number;
1556
- constructor(r?: number, g?: number, b?: number, a?: number);
1557
- get isColor(): boolean;
1558
- get r(): number;
1559
- set r(value: number);
1560
- get g(): number;
1561
- set g(value: number);
1562
- get b(): number;
1563
- set b(value: number);
1564
- get a(): number;
1565
- set a(value: number);
1566
- set(value: any): this;
1567
- setHex(hex: number): this;
1568
- setHexCssString(style: string): this | undefined;
1569
- setRGB(r: number, g: number, b: number, a?: number): this;
1570
- clone(): any;
1571
- copy(color: this): this;
1572
- equals(c: this): boolean;
1573
- toArray(array?: number[], offset?: number): number[];
1574
- fromArray(array?: number[], offset?: number): number[];
1575
- private byteToFloat;
1576
- private floatToByte;
1577
- getHexCssString(): string;
1578
- toJSON(): string;
1579
- static get White(): Readonly<Color>;
1580
- static get Red(): Color;
1581
- static get Green(): Color;
1582
- static get Blue(): Color;
1698
+ /**
1699
+ * 遍历多级数组中所有对象
1700
+ * @param {Array} array
1701
+ * @param {Function} method
1702
+ */
1703
+ declare function forall(array: Array<any>, method: (arg0: any, index?: number, that?: Array<any>) => void): void;
1704
+ declare function flat(array: any[]): any[];
1705
+ /**
1706
+ * 分类
1707
+ * example:
1708
+ * var arry = [1,2,3,4,5,6]
1709
+ * var result = classify(array,(a)={return a%2===0})
1710
+ *
1711
+ * @param {Array} array
1712
+ * @param {Function} classifyMethod 分类方法
1713
+ */
1714
+ declare function classify(array: Array<any>, classifyMethod: (arg0: any, arg1: any, arg2: any[]) => any): any;
1715
+ /**
1716
+ * 去掉重复元素
1717
+ * @param {Array} array
1718
+ * @param {Function} uniqueMethod 去重复
1719
+ * @param {Function} sortMethod 排序 存在就先排序再去重复
1720
+ */
1721
+ declare function unique(array: any[], uniqueMethod: (arg0: any, arg1: any) => boolean, sortMethod?: (a: any, b: any) => number): any[];
1722
+
1723
+ declare class Color {
1724
+ _r: number;
1725
+ _g: number;
1726
+ _b: number;
1727
+ _a: number;
1728
+ constructor(r?: number, g?: number, b?: number, a?: number);
1729
+ get isColor(): boolean;
1730
+ get r(): number;
1731
+ set r(value: number);
1732
+ get g(): number;
1733
+ set g(value: number);
1734
+ get b(): number;
1735
+ set b(value: number);
1736
+ get a(): number;
1737
+ set a(value: number);
1738
+ set(value: any): this;
1739
+ setHex(hex: number): this;
1740
+ setHexCssString(style: string): this | undefined;
1741
+ setRGB(r: number, g: number, b: number, a?: number): this;
1742
+ clone(): any;
1743
+ copy(color: this): this;
1744
+ equals(c: this): boolean;
1745
+ toArray(array?: number[], offset?: number): number[];
1746
+ fromArray(array?: number[], offset?: number): number[];
1747
+ private byteToFloat;
1748
+ private floatToByte;
1749
+ getHexCssString(): string;
1750
+ toJSON(): string;
1751
+ static get White(): Readonly<Color>;
1752
+ static get Red(): Color;
1753
+ static get Green(): Color;
1754
+ static get Blue(): Color;
1583
1755
  }
1584
1756
 
1585
- /**
1586
- * 当向量以数组的方式出现,一个计算单元库
1587
- * @Description : 向量数组
1588
- * @Author : 赵耀圣
1589
- * @QQ : 549184003
1590
- * @Date : 2021-08-02 15:09:33
1591
- * @LastEditTime : 2021-08-02 15:50:16
1592
- * @FilePath : \cga.js\src\math\VecArray.ts
1593
- */
1594
-
1595
- /**
1596
- * 矢量几何操作,数字数组/矢量数组,常用工具集合
1597
- */
1598
- declare class vecs {
1599
- /**
1600
- * 去除相邻的重复向量
1601
- * @param vs 矢量集合
1602
- * @param delta 误差
1603
- * @returns
1604
- */
1605
- static uniqueNeighborVecs(vs: Array<Vec3>, delta?: number): Vec3[];
1606
- /**
1607
- * 找到最大值
1608
- * @param array
1609
- * @returns
1610
- */
1611
- static max(array: ArrayLike<number>): number;
1612
- /**
1613
- * 找到最小值
1614
- * @param array
1615
- * @returns
1616
- */
1617
- static min(array: ArrayLike<number>): number;
1618
- /**
1619
- * 去除相邻没有重复点
1620
- */
1621
- static uniqueNeighbor(vs: number[], component?: number, delta?: number): number[];
1622
- /**
1623
- * 去除任意重复点
1624
- * @param vs 向量数组
1625
- * @param component 向量组件数量
1626
- * @returns 无重复向量数组
1627
- */
1628
- static unique(vs: number[], component?: number): number[];
1629
- /**
1630
- * 翻转向量数组
1631
- * @param vecs 向量数组
1632
- * @param component 组件数量
1633
- * @returns
1634
- */
1635
- static reverse(vecs: number[], component?: number): number[];
1636
- /**
1637
- * 点积
1638
- * @param vecs
1639
- * @returns
1640
- */
1641
- static dot(...vecs: number[]): number;
1642
- /**
1643
- * 长度平方
1644
- * @param vecs
1645
- * @returns
1646
- */
1647
- static distanceSq(...vecs: number[]): number;
1648
- /**
1649
- * 长度
1650
- * @param vecs
1651
- * @returns
1652
- */
1653
- static distance(...vecs: number[]): number;
1654
- /**
1655
- * 相加
1656
- * @param vecs
1657
- * @returns
1658
- */
1659
- static add(...vecs: number[]): number[] | (number & any[]);
1660
- /**
1661
- * 相减
1662
- * @param vecs
1663
- * @returns
1664
- */
1665
- static sub(...vecs: number[]): number[];
1666
- /**
1667
- * 相乘
1668
- * @param vecs
1669
- * @returns
1670
- */
1671
- static mul(...vecs: number[]): number[] | (number & any[]);
1672
- /**
1673
- * 获取矢量数组的i个矢量
1674
- * @param vecs
1675
- * @param i
1676
- * @param component
1677
- * @returns
1678
- */
1679
- static getVecAt(vecs: number[], i: number, component?: number): number[];
1680
- /**
1681
- * 在第 i 个位置插入一个向量
1682
- * @param vecs
1683
- * @param i
1684
- * @param vec
1685
- */
1686
- static insertAt(vecs: number[], i: number, ...vec: number[]): void;
1687
- /**
1688
- * 是否逆时针
1689
- * counterclockwise
1690
- */
1691
- static isCCW<T>(shape: Array<T> | ArrayList<T>, component?: number): boolean;
1692
- /**
1693
- * 将向量深度拆解为数字
1694
- * @param {Array} Array<Vec4 | Vec3 | Vec2 | any> | any
1695
- * @param {String} comSort 'x','y','z','w' 按顺序选取后自由组合
1696
- * @returns {Array<Number>} 数字数组
1697
- */
1698
- static verctorToNumbers(vectors: Array<Vec4 | Vec3 | Vec2 | any> | any, comSort?: string): number[];
1699
- static vec(component?: number): Vec3 | Vec4 | Vec2;
1700
- /**
1701
- * 数字数组 转 适量数组
1702
- * @param vss 数字数组
1703
- * @param component 矢量维度,默认为3
1704
- * @returns
1705
- */
1706
- static numbersToVecs(vss: TypedArrayLike, component?: number): Vec2[] | Vec3[] | Vec4[];
1707
- static applyQuat(vss: TypedArrayLike, quat: Quat, component?: number): void;
1708
- static applyMat4(vss: TypedArrayLike, mat: Mat4, component?: number): void;
1709
- static translate(vss: TypedArrayLike, distance: number[], component?: number): void;
1710
- static rotate(vss: TypedArrayLike, axis: Vec3, angle: number): void;
1711
- static scale(vss: TypedArrayLike, _scale: number[], component?: number): void;
1757
+ /**
1758
+ * 当向量以数组的方式出现,一个计算单元库
1759
+ * @Description : 向量数组
1760
+ * @Author : 赵耀圣
1761
+ * @QQ : 549184003
1762
+ * @Date : 2021-08-02 15:09:33
1763
+ * @LastEditTime : 2021-08-02 15:50:16
1764
+ * @FilePath : \cga.js\src\math\VecArray.ts
1765
+ */
1766
+
1767
+ /**
1768
+ * 矢量几何操作,数字数组/矢量数组,常用工具集合
1769
+ */
1770
+ declare class vecs {
1771
+ /**
1772
+ * 去除相邻的重复向量
1773
+ * @param vs 矢量集合
1774
+ * @param delta 误差
1775
+ * @returns
1776
+ */
1777
+ static uniqueNeighborVecs(vs: Array<Vec3>, delta?: number): Vec3[];
1778
+ /**
1779
+ * 找到最大值
1780
+ * @param array
1781
+ * @returns
1782
+ */
1783
+ static max(array: ArrayLike<number>): number;
1784
+ /**
1785
+ * 找到最小值
1786
+ * @param array
1787
+ * @returns
1788
+ */
1789
+ static min(array: ArrayLike<number>): number;
1790
+ /**
1791
+ * 去除相邻没有重复点
1792
+ */
1793
+ static uniqueNeighbor(vs: number[], component?: number, delta?: number): number[];
1794
+ /**
1795
+ * 去除任意重复点
1796
+ * @param vs 向量数组
1797
+ * @param component 向量组件数量
1798
+ * @returns 无重复向量数组
1799
+ */
1800
+ static unique(vs: number[], component?: number): number[];
1801
+ /**
1802
+ * 翻转向量数组
1803
+ * @param vecs 向量数组
1804
+ * @param component 组件数量
1805
+ * @returns
1806
+ */
1807
+ static reverse(vecs: number[], component?: number): number[];
1808
+ /**
1809
+ * 点积
1810
+ * @param vecs
1811
+ * @returns
1812
+ */
1813
+ static dot(...vecs: number[]): number;
1814
+ /**
1815
+ * 长度平方
1816
+ * @param vecs
1817
+ * @returns
1818
+ */
1819
+ static distanceSq(...vecs: number[]): number;
1820
+ /**
1821
+ * 长度
1822
+ * @param vecs
1823
+ * @returns
1824
+ */
1825
+ static distance(...vecs: number[]): number;
1826
+ /**
1827
+ * 相加
1828
+ * @param vecs
1829
+ * @returns
1830
+ */
1831
+ static add(...vecs: number[]): number[] | (number & any[]);
1832
+ /**
1833
+ * 相减
1834
+ * @param vecs
1835
+ * @returns
1836
+ */
1837
+ static sub(...vecs: number[]): number[];
1838
+ /**
1839
+ * 相乘
1840
+ * @param vecs
1841
+ * @returns
1842
+ */
1843
+ static mul(...vecs: number[]): number[] | (number & any[]);
1844
+ /**
1845
+ * 获取矢量数组的i个矢量
1846
+ * @param vecs
1847
+ * @param i
1848
+ * @param component
1849
+ * @returns
1850
+ */
1851
+ static getVecAt(vecs: number[], i: number, component?: number): number[];
1852
+ /**
1853
+ * 在第 i 个位置插入一个向量
1854
+ * @param vecs
1855
+ * @param i
1856
+ * @param vec
1857
+ */
1858
+ static insertAt(vecs: number[], i: number, ...vec: number[]): void;
1859
+ /**
1860
+ * 是否逆时针
1861
+ * counterclockwise
1862
+ */
1863
+ static isCCW<T>(shape: Array<T> | ArrayList<T>, component?: number): boolean;
1864
+ /**
1865
+ * 将向量深度拆解为数字
1866
+ * @param {Array} Array<Vec4 | Vec3 | Vec2 | any> | any
1867
+ * @param {String} comSort 'x','y','z','w' 按顺序选取后自由组合
1868
+ * @returns {Array<Number>} 数字数组
1869
+ */
1870
+ static verctorToNumbers(vectors: Array<Vec4 | Vec3 | Vec2 | any> | any, comSort?: string): number[];
1871
+ static vec(component?: number): Vec3 | Vec2 | Vec4;
1872
+ /**
1873
+ * 数字数组 转 适量数组
1874
+ * @param vss 数字数组
1875
+ * @param component 矢量维度,默认为3
1876
+ * @returns
1877
+ */
1878
+ static numbersToVecs(vss: TypedArrayLike, component?: number): Vec2[] | Vec3[] | Vec4[];
1879
+ static applyQuat(vss: TypedArrayLike, quat: Quat, component?: number): void;
1880
+ static applyMat4(vss: TypedArrayLike, mat: Mat4, component?: number): void;
1881
+ static translate(vss: TypedArrayLike, distance: number[], component?: number): void;
1882
+ static rotate(vss: TypedArrayLike, axis: Vec3, angle: number): void;
1883
+ static scale(vss: TypedArrayLike, _scale: number[], component?: number): void;
1712
1884
  }
1713
1885
 
1714
- /**
1715
- * 数组深度复制
1716
- * @param {Array} array
1717
- */
1718
- declare function clone(array: any | any[]): any;
1719
- /**
1720
- * 点排序函数 xyz 有序排序回调
1721
- * @param {Vector*} a
1722
- * @param {Vector*} b
1723
- */
1724
- declare function vectorCompare(a: any | Vec3, b: any | Vec3): number;
1725
- /**
1726
- * 计算包围盒
1727
- * @param {*} points 点集
1728
- * @returns {Array[min,max]} 返回最小最大值
1729
- */
1730
- declare function boundingBox(points: Vec3[]): Vec3[];
1731
- /**
1732
- *
1733
- * @param {*} points
1734
- * @param {*} quat
1735
- * @param {Boolean} ref 是否是引用
1736
- */
1737
- declare function applyQuat(points: any | Vec3[], quat: Quat, ref?: boolean): Vec3 | any;
1738
- /**
1739
- * 平移
1740
- * @param {*} points
1741
- * @param {*} distance
1742
- * @param {*} ref
1743
- */
1744
- declare function translate(points: any | Vec3[], distance: Vec3, ref?: boolean): Vec3[] | any;
1745
- /**
1746
- * 旋转
1747
- * @param {*} points
1748
- * @param {*} axis
1749
- * @param {*} angle
1750
- * @param {*} ref
1751
- */
1752
- declare function rotate(points: any | Vec3[], axis: Vec3, angle: number, ref?: boolean): any;
1753
- /**
1754
- * 两个向量之间存在的旋转量来旋转点集
1755
- * @param {*} points
1756
- * @param {*} axis
1757
- * @param {*} angle
1758
- * @param {*} ref
1759
- */
1760
- declare function rotateByUnitVectors(points: any | Vec3[], vFrom: Vec3, vTo: Vec3, ref?: boolean): any;
1761
- /**
1762
- * 缩放
1763
- * @param {*} points
1764
- * @param {*} axis
1765
- * @param {*} angle
1766
- * @param {*} ref
1767
- */
1768
- declare function scale(points: any | Vec3[], _scale: Vec3, ref?: boolean): Vec3[] | any;
1769
- /**
1770
- * 响应矩阵
1771
- * @param {*} points
1772
- * @param {*} axis
1773
- * @param {*} angle
1774
- * @param {*} ref
1775
- */
1776
- declare function applyMatrix4(points: any | Vec3[], matrix: Mat4, ref?: boolean): Vec3[] | any;
1777
- /**
1778
- * 简化点集数组,折线,路径
1779
- * @param {*} points 点集数组,折线,路径 ,继承Array
1780
- * @param {*} maxDistance 简化最大距离
1781
- * @param {*} maxAngle 简化最大角度
1782
- */
1783
- declare function simplifyPointList(points: any | Vec3[], maxDistance?: number, maxAngle?: number): any;
1784
- /**
1785
- * 以某个平面生成对称镜像
1786
- * @param {*} points 点集
1787
- * @param {*} plane 对称镜像平面
1788
- */
1789
- declare function reverseOnPlane(points: any | Vec3[], plane: Plane): void;
1790
- /**
1791
- * 投影到平面
1792
- * @param {*} points 点集
1793
- * @param {*} plane 投影平面
1794
- * @param {*} projectDirect 默认是法线的方向
1795
- */
1796
- declare function projectOnPlane(points: any | Vec3[], plane: Plane, projectDirect: Vec3): any;
1797
- /**
1798
- * 计算共面点集所在的平面
1799
- * @param {Array<Vec3|Point>} points
1800
- */
1801
- declare function recognitionPlane(points: Vec3[] | any): Plane;
1802
- /**
1803
- * 判断所有点是否在同一个平面
1804
- * @param {Array<Vec3|Point>} points
1805
- * @param {*} precision
1806
- * @returns {Boolean|Plane} 如果在同一个平面返回所在平面,否则返回false
1807
- */
1808
- declare function isInOnePlane(points: Vec3[] | any, precision?: number): false | Plane;
1809
- /**
1810
- * 判断多边是否共线:
1811
- * 考虑情况点之间的距离应该大于最小容忍值
1812
- * @param {...Vec3[]} ps
1813
- */
1814
- declare function pointsCollinear(...ps: Vec3[]): boolean;
1815
- /**
1816
- * 三点计算圆
1817
- * @param p0
1818
- * @param p1
1819
- * @param p2
1820
- */
1821
- declare function calcCircleFromThreePoint(p0: Vec3, p1: Vec3, p2: Vec3): Circle;
1886
+ /**
1887
+ * 数组深度复制
1888
+ * @param {Array} array
1889
+ */
1890
+ declare function clone(array: any | any[]): any;
1891
+ /**
1892
+ * 点排序函数 xyz 有序排序回调
1893
+ * @param {Vector*} a
1894
+ * @param {Vector*} b
1895
+ */
1896
+ declare function vectorCompare(a: any | Vec3, b: any | Vec3): number;
1897
+ /**
1898
+ * 计算包围盒
1899
+ * @param {*} points 点集
1900
+ * @returns {Array[min,max]} 返回最小最大值
1901
+ */
1902
+ declare function boundingBox(points: Vec3[]): Vec3[];
1903
+ /**
1904
+ *
1905
+ * @param {*} points
1906
+ * @param {*} quat
1907
+ * @param {Boolean} ref 是否是引用
1908
+ */
1909
+ declare function applyQuat(points: any | Vec3[], quat: Quat, ref?: boolean): Vec3 | any;
1910
+ /**
1911
+ * 平移
1912
+ * @param {*} points
1913
+ * @param {*} distance
1914
+ * @param {*} ref
1915
+ */
1916
+ declare function translate(points: any | Vec3[], distance: Vec3, ref?: boolean): Vec3[] | any;
1917
+ /**
1918
+ * 旋转
1919
+ * @param {*} points
1920
+ * @param {*} axis
1921
+ * @param {*} angle
1922
+ * @param {*} ref
1923
+ */
1924
+ declare function rotate(points: any | Vec3[], axis: Vec3, angle: number, ref?: boolean): any;
1925
+ /**
1926
+ * 两个向量之间存在的旋转量来旋转点集
1927
+ * @param {*} points
1928
+ * @param {*} axis
1929
+ * @param {*} angle
1930
+ * @param {*} ref
1931
+ */
1932
+ declare function rotateByUnitVectors(points: any | Vec3[], vFrom: Vec3, vTo: Vec3, ref?: boolean): any;
1933
+ /**
1934
+ * 缩放
1935
+ * @param {*} points
1936
+ * @param {*} axis
1937
+ * @param {*} angle
1938
+ * @param {*} ref
1939
+ */
1940
+ declare function scale(points: any | Vec3[], _scale: Vec3, ref?: boolean): Vec3[] | any;
1941
+ /**
1942
+ * 响应矩阵
1943
+ * @param {*} points
1944
+ * @param {*} axis
1945
+ * @param {*} angle
1946
+ * @param {*} ref
1947
+ */
1948
+ declare function applyMatrix4(points: any | Vec3[], matrix: Mat4, ref?: boolean): Vec3[] | any;
1949
+ /**
1950
+ * 简化点集数组,折线,路径
1951
+ * @param {*} points 点集数组,折线,路径 ,继承Array
1952
+ * @param {*} maxDistance 简化最大距离
1953
+ * @param {*} maxAngle 简化最大角度
1954
+ */
1955
+ declare function simplifyPointList(points: any | Vec3[], maxDistance?: number, maxAngle?: number): any;
1956
+ /**
1957
+ * 以某个平面生成对称镜像
1958
+ * @param {*} points 点集
1959
+ * @param {*} plane 对称镜像平面
1960
+ */
1961
+ declare function reverseOnPlane(points: Vec3[], plane: Plane, ref?: boolean): Vec3[];
1962
+ /**
1963
+ * 投影到平面
1964
+ * @param {*} points 点集
1965
+ * @param {*} plane 投影平面
1966
+ * @param {*} projectDirect 默认是法线的方向
1967
+ */
1968
+ declare function projectOnPlane(points: Vec3[], plane: Plane, direction?: Vec3, ref?: boolean): Vec3[];
1969
+ /**
1970
+ * 计算共面点集所在的平面
1971
+ * @param {Array<Vec3|Point>} points
1972
+ */
1973
+ declare function recognitionPlane(points: Vec3[]): Plane;
1974
+ /**
1975
+ * 判断所有点是否在同一个平面
1976
+ * @param {Array<Vec3|Point>} points
1977
+ * @param {*} precision
1978
+ * @returns {Boolean|Plane} 如果在同一个平面返回所在平面,否则返回false
1979
+ */
1980
+ declare function isInOnePlane(points: Vec3[], precision?: number): Plane | false;
1981
+ /**
1982
+ * 判断多边是否共线:
1983
+ * 考虑情况点之间的距离应该大于最小容忍值
1984
+ * @param {...Vec3[]} ps
1985
+ */
1986
+ declare function pointsCollinear(...points: Vec3[]): boolean;
1987
+ /**
1988
+ * 三点计算圆
1989
+ * @param p0
1990
+ * @param p1
1991
+ * @param p2
1992
+ */
1993
+ declare function calcCircleFromThreePoint(p0: Vec3, p1: Vec3, p2: Vec3): Circle;
1822
1994
  declare function angle(v0: Vec3, v1: Vec3, normal?: Vec3): number;
1823
1995
 
1824
- declare class Delaunator {
1825
- coords: Float64Array;
1826
- _triangles: Uint32Array;
1827
- _halfedges: Int32Array;
1828
- _hashSize: number;
1829
- _hullPrev: Uint32Array;
1830
- _hullNext: Uint32Array;
1831
- _hullTri: Uint32Array;
1832
- _hullHash: Int32Array;
1833
- _ids: Uint32Array;
1834
- _dists: Float64Array;
1835
- hull: Uint32Array;
1836
- triangles: Uint32Array;
1837
- halfedges: any;
1838
- _cx: any;
1839
- _cy: any;
1840
- _hullStart: number;
1841
- trianglesLen: number;
1842
- static from(points: number[]): Delaunator;
1843
- static fromVecs(points: Vec2[] | Vec3[]): Delaunator;
1844
- constructor(coords: Float64Array);
1845
- update(): void;
1846
- _hashKey(x: number, y: number): number;
1847
- _legalize(a: number): number;
1848
- _link(a: number, b: number): void;
1849
- _addTriangle(i0: number, i1: number, i2: number, a: number, b: number, c: number): number;
1996
+ declare class Delaunator {
1997
+ coords: Float64Array;
1998
+ _triangles: Uint32Array;
1999
+ _halfedges: Int32Array;
2000
+ _hashSize: number;
2001
+ _hullPrev: Uint32Array;
2002
+ _hullNext: Uint32Array;
2003
+ _hullTri: Uint32Array;
2004
+ _hullHash: Int32Array;
2005
+ _ids: Uint32Array;
2006
+ _dists: Float64Array;
2007
+ hull: Uint32Array;
2008
+ triangles: Uint32Array;
2009
+ halfedges: any;
2010
+ _cx: any;
2011
+ _cy: any;
2012
+ _hullStart: number;
2013
+ trianglesLen: number;
2014
+ static from(points: number[]): Delaunator;
2015
+ static fromVecs(points: Vec2[] | Vec3[]): Delaunator;
2016
+ constructor(coords: Float64Array);
2017
+ update(): void;
2018
+ _hashKey(x: number, y: number): number;
2019
+ _legalize(a: number): number;
2020
+ _link(a: number, b: number): void;
2021
+ _addTriangle(i0: number, i1: number, i2: number, a: number, b: number, c: number): number;
2022
+ }
2023
+
2024
+ declare class Voronoi {
2025
+ delaunay: any;
2026
+ _circumcenters: Float64Array;
2027
+ vectors: Float64Array;
2028
+ xmax: number;
2029
+ xmin: number;
2030
+ ymax: number;
2031
+ ymin: number;
2032
+ circumcenters: any;
2033
+ constructor(delaunay: Delaunay, [xmin, ymin, xmax, ymax]?: [number, number, number, number]);
2034
+ update(): this;
2035
+ _init(): void;
2036
+ cellPolygons(): Generator<any, void, unknown>;
2037
+ cellPolygon(i: number): number[][] | null;
2038
+ _renderSegment(x0: any, y0: any, x1: any, y1: any, context: {
2039
+ moveTo: (arg0: any, arg1: any) => void;
2040
+ lineTo: (arg0: any, arg1: any) => void;
2041
+ }): void;
2042
+ contains(i: any, x: number | any, y: number | any): boolean;
2043
+ neighbors(i: any): Generator<any, void, unknown>;
2044
+ _cell(i: string | number): any[] | null;
2045
+ _clip(i: number): any;
2046
+ _clipFinite(i: any, points: string | any[]): any;
2047
+ _clipSegment(x0: number, y0: number, x1: number, y1: number, c0: number, c1: number): number[] | null;
2048
+ _clipInfinite(i: any, points: any, vx0: number, vy0: number, vxn: number, vyn: number): unknown[];
2049
+ _edge(i: any, e0: number, e1: number, P: any[], j: number): number;
2050
+ _project(x0: any, y0: any, vx: number, vy: number): any[] | null;
2051
+ _edgecode(x: unknown, y: unknown): number;
2052
+ _regioncode(x: number, y: number): number;
2053
+ }
2054
+
2055
+ declare class Delaunay {
2056
+ _delaunator: Delaunator;
2057
+ inedges: Int32Array;
2058
+ _hullIndex: Int32Array;
2059
+ points: Float64Array;
2060
+ collinear?: Int32Array;
2061
+ halfedges: any;
2062
+ hull: Uint32Array;
2063
+ triangles: Uint32Array;
2064
+ static from(points: number[]): Delaunay;
2065
+ constructor(points: Float64Array);
2066
+ update(): this;
2067
+ _init(): void;
2068
+ voronoi(bounds: [number, number, number, number] | undefined): Voronoi;
2069
+ neighbors(i: number): Generator<number, void, unknown>;
2070
+ find(x: number, y: number, i?: number): number;
2071
+ _step(i: number, x: number, y: number): number;
1850
2072
  }
1851
2073
 
1852
- declare class Voronoi {
1853
- delaunay: any;
1854
- _circumcenters: Float64Array;
1855
- vectors: Float64Array;
1856
- xmax: number;
1857
- xmin: number;
1858
- ymax: number;
1859
- ymin: number;
1860
- circumcenters: any;
1861
- constructor(delaunay: Delaunay, [xmin, ymin, xmax, ymax]?: [number, number, number, number]);
1862
- update(): this;
1863
- _init(): void;
1864
- cellPolygons(): Generator<any, void, unknown>;
1865
- cellPolygon(i: number): any[] | null;
1866
- _renderSegment(x0: any, y0: any, x1: any, y1: any, context: {
1867
- moveTo: (arg0: any, arg1: any) => void;
1868
- lineTo: (arg0: any, arg1: any) => void;
1869
- }): void;
1870
- contains(i: any, x: number | any, y: number | any): boolean;
1871
- neighbors(i: any): Generator<any, void, unknown>;
1872
- _cell(i: string | number): any[] | null;
1873
- _clip(i: number): any;
1874
- _clipFinite(i: any, points: string | any[]): any;
1875
- _clipSegment(x0: number, y0: number, x1: number, y1: number, c0: number, c1: number): number[] | null;
1876
- _clipInfinite(i: any, points: any, vx0: number, vy0: number, vxn: number, vyn: number): unknown[];
1877
- _edge(i: any, e0: number, e1: number, P: any[], j: number): number;
1878
- _project(x0: any, y0: any, vx: number, vy: number): any[] | null;
1879
- _edgecode(x: unknown, y: unknown): number;
1880
- _regioncode(x: number, y: number): number;
2074
+ /** Monotone-chain convex hull of coplanar points, without a repeated end point. */
2075
+ declare function convexHull(points: Vec3[], normal?: Vec3): Vec3[];
2076
+ /** Compatibility wrapper for the class historically shown in the README. */
2077
+ declare class ConvexHull {
2078
+ hull: Vec3[];
2079
+ constructor(points: Vec3[], options?: {
2080
+ planeNormal?: Vec3;
2081
+ });
1881
2082
  }
2083
+ /** Exact 3D closest pair. Sweep pruning; worst-case O(n²), O(n) storage. */
2084
+ declare function closestPair(points: Vec3[]): DistanceResult;
2085
+
2086
+ /** Uniform entry point; also resolves symmetric queries defined on one operand. */
2087
+ declare function distance(a: GeometryQuery<any>, b: GeometryQuery<any>): DistanceResult;
2088
+ declare function intersects(a: GeometryQuery<any>, b: GeometryQuery<any>, tolerance?: number): boolean;
2089
+
2090
+ /**
2091
+ * 计算体积
2092
+ * @param faces 一个几何体的所有三角面
2093
+ */
2094
+ declare function calculateVolume(faces: Vec3[][]): number;
1882
2095
 
1883
- declare class Delaunay {
1884
- _delaunator: Delaunator;
1885
- inedges: Int32Array;
1886
- _hullIndex: Int32Array;
1887
- points: Float64Array;
1888
- collinear?: Int32Array;
1889
- halfedges: any;
1890
- hull: Uint32Array;
1891
- triangles: Uint32Array;
1892
- static from(points: number[]): Delaunay;
1893
- constructor(points: Float64Array);
1894
- update(): this;
1895
- _init(): void;
1896
- voronoi(bounds: [number, number, number, number] | undefined): Voronoi;
1897
- neighbors(i: number): Generator<number, void, unknown>;
1898
- find(x: number, y: number, i?: number): number;
1899
- _step(i: number, x: number, y: number): number;
2096
+ declare class Distance {
2097
+ static Point2Point_Number(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number): number;
2098
+ static Point2Line_Number(x: number, y: number, z: number, ox: number, oy: number, oz: number, dx: number, dy: number, dz: number): number;
2099
+ /**
2100
+ *
2101
+ * @param point
2102
+ * @param origin
2103
+ * @param dir 默认已经正交化
2104
+ */
2105
+ static Point2Line_Vec3(point: Vec3, origin: Vec3, dir: Vec3, result?: Vec3): Vec3;
1900
2106
  }
1901
2107
 
1902
- /**
1903
- * 网格工具
1904
- */
1905
- declare class MeshTool {
1906
- static indexable(obj: any[] | any, refIndexInfo?: {
1907
- index: number;
1908
- }, force?: boolean): void;
1909
- static triangListToBuffer(vertices: Vec3[], triangleList: Vec3[]): BufferGeometry;
1910
- /**
1911
- * 顶点纹理坐标所以转化为buffer数据
1912
- * @param {Array<Verctor3|Number>} vertices
1913
- * @param {Array<Number>} indices
1914
- * @param {Array<Verctor2|Number>} uvs
1915
- */
1916
- static toGeoBuffer(vertices: BufferAttribute | Array<number | Vec2 | Vec3 | Vec4> | TypedArray, indices: number[] | Uint32Array | Uint16Array, uvs?: BufferAttribute | TypedArray | Array<Vec2 | number>): BufferGeometry;
1917
- /**
1918
- * 三角剖分后转成几何体
1919
- * 只考虑XY平面
1920
- * @param {*} boundary
1921
- * @param {*} hole
1922
- * @param {*} options
1923
- */
1924
- static trianglutionToGeometryBuffer(boundary: any, holes?: any[], options?: any): BufferGeometry;
2108
+ /**
2109
+ * 网格工具
2110
+ */
2111
+ declare class MeshTool {
2112
+ static indexable(obj: any[] | any, refIndexInfo?: {
2113
+ index: number;
2114
+ }, force?: boolean): void;
2115
+ static triangListToBuffer(vertices: Vec3[], triangleList: Vec3[]): BufferGeometry;
2116
+ /**
2117
+ * 顶点纹理坐标所以转化为buffer数据
2118
+ * @param {Array<Verctor3|Number>} vertices
2119
+ * @param {Array<Number>} indices
2120
+ * @param {Array<Verctor2|Number>} uvs
2121
+ */
2122
+ static toGeoBuffer(vertices: BufferAttribute | Array<number | Vec2 | Vec3 | Vec4> | TypedArray, indices: number[] | Uint32Array | Uint16Array, uvs?: BufferAttribute | TypedArray | Array<Vec2 | number>): BufferGeometry;
2123
+ /**
2124
+ * 三角剖分后转成几何体
2125
+ * 只考虑XY平面
2126
+ * @param {*} boundary
2127
+ * @param {*} hole
2128
+ * @param {*} options
2129
+ */
2130
+ static trianglutionToGeometryBuffer(boundary: any, holes?: any[], options?: any): BufferGeometry;
1925
2131
  }
1926
2132
 
1927
- declare class Point extends Vec3 {
1928
- constructor(_x?: number, _y?: number, _z?: number);
2133
+ /**
2134
+ * 视锥体
2135
+ */
2136
+ declare class Frustum {
2137
+ planes: Plane[];
2138
+ constructor();
2139
+ get front(): Plane;
2140
+ get back(): Plane;
2141
+ get top(): Plane;
2142
+ get bottom(): Plane;
2143
+ get left(): Plane;
2144
+ get right(): Plane;
2145
+ /**
2146
+ * 从投影矩阵计算视锥体
2147
+ * @param m
2148
+ * @returns
2149
+ */
2150
+ setFromProjectionMatrix(m: Mat4): this;
2151
+ static fromProjectionMatrix(m: Mat4): Frustum;
2152
+ setFromPerspective(position: Vec3, target: Vec3, up: Vec3, fov: number, aspect: number, near: number, far: number): void;
2153
+ intersectsObject(geometry: BufferGeometry, mat: Mat4): boolean;
2154
+ intersectsSphere(sphere: Sphere): boolean;
2155
+ intersectsSphereComponents(cx: number, cy: number, cz: number, radius: number): boolean;
2156
+ containsPoint(point: Vec3): boolean;
2157
+ intersectSegment(segment: Segment | Vec3[]): Vec3 | Vec3[] | null;
2158
+ simpleIntersectVS(vs: Vec3[]): Vec3[];
2159
+ copy(frustum: Frustum): this;
2160
+ clone(): any;
1929
2161
  }
1930
2162
 
1931
- interface IDistanceResut {
1932
- isNode: boolean;
1933
- point: Vec3;
1934
- direction: Vec3;
1935
- }
1936
- declare class Path<T extends Vec3> extends ArrayList<T> {
1937
- _closed: boolean;
1938
- _calcNoraml: boolean;
1939
- /**
1940
- *
1941
- * @param vs 假定是没有重复的点集
1942
- * @param closed
1943
- * @param calcNormal
1944
- */
1945
- constructor(vs: Array<T> | ArrayList<T>, closed?: boolean, calcNormal?: boolean);
1946
- init(calcNormal: boolean): void;
1947
- set closed(val: boolean);
1948
- get closed(): boolean;
1949
- get tlen(): number;
1950
- applyMat4(mat4: Mat4): void;
1951
- scale(x: number, y: number, z: number): void;
1952
- /**
1953
- * 截取一段从from到to的path
1954
- * @param {Number} from
1955
- * @param {Number} to
1956
- */
1957
- splitByFromToDistance(from?: number, to?: number): Path<never> | null;
1958
- /**
1959
- * 从起点出发到距离等于distance位置 的坐标 二分查找
1960
- * @param {Number} distance
1961
- */
1962
- getPointByDistance(arg_distance: number, left?: number, right?: number): IDistanceResut | null;
1963
- /**
1964
- * 从起点出发到距离等于distance位置 的坐标 二分查找
1965
- * @param {Number} distance
1966
- */
1967
- getPointByDistancePure(arg_distance: number, left?: number, right?: number): Vec3 | null;
1968
- /**
1969
- * 平均切割为 splitCount 段
1970
- * @param {Number} splitCount
1971
- * @returns {Path} 新的path
1972
- */
1973
- splitAverage(splitCount: number): Path<T>;
1974
- /**
1975
- * 通过测试
1976
- * 平均切割为 splitCount 段
1977
- * @param {Number} splitCount
1978
- * @param {Boolean} integer 是否取整
1979
- * @returns {Path} 新的path
1980
- */
1981
- splitAverageLength(splitLength: number, integer?: boolean): Path<T>;
1982
- /**
1983
- *
1984
- * @param {...any} ps
1985
- */
1986
- add(...ps: Vec3[] | Point[]): void;
1987
- /**
1988
- * @description : 计算一段线段的总长度
1989
- * @param {ArrayLike} ps
1990
- * @return {number} 总长度
1991
- */
1992
- static totalMileages(ps: ArrayLike<Vec3>): number;
1993
- /**
1994
- * @description : 获取没一点的里程 里程是指从第一个点出发的长度
1995
- * @param {ArrayLike} ps 里程上的点集
1996
- * @param {boolean} normalize 是否归一化
1997
- * @return {number[]} 每一个点的里程数组
1998
- * @example :
1999
- */
2000
- static getPerMileages(ps: ArrayLike<Vec3>, normalize?: boolean, totalMileage?: number): number[];
2163
+ declare class Point extends Vec3 implements GeometryQuery<Point> {
2164
+ constructor(_x?: number, _y?: number, _z?: number);
2165
+ clone(): Point;
2001
2166
  }
2002
2167
 
2003
- /**
2004
- * 视锥体
2005
- */
2006
- declare class Frustum {
2007
- planes: Plane[];
2008
- constructor();
2009
- get front(): Plane;
2010
- get back(): Plane;
2011
- get top(): Plane;
2012
- get bottom(): Plane;
2013
- get left(): Plane;
2014
- get right(): Plane;
2015
- /**
2016
- * 从投影矩阵计算视锥体
2017
- * @param m
2018
- * @returns
2019
- */
2020
- setFromProjectionMatrix(m: Mat4): this;
2021
- static fromProjectionMatrix(m: Mat4): Frustum;
2022
- setFromPerspective(position: Vec3, target: Vec3, up: Vec3, fov: number, aspect: number, near: number, far: number): void;
2023
- intersectsObject(geometry: BufferGeometry, mat: Mat4): boolean;
2024
- intersectsSphere(sphere: Sphere): boolean;
2025
- intersectsSphereComponents(cx: number, cy: number, cz: number, radius: number): boolean;
2026
- containsPoint(point: Vec3): boolean;
2027
- intersectSegment(segment: Segment | Vec3[]): Vec3 | Vec3[] | Segment | null;
2028
- simpleIntersectVS(vs: Vec3[]): Vec3[];
2029
- copy(frustum: Frustum): void;
2030
- clone(): any;
2168
+ interface IDistanceResut {
2169
+ isNode: boolean;
2170
+ point: Vec3;
2171
+ direction: Vec3;
2172
+ }
2173
+ declare class Path<T extends Vec3> extends ArrayList<T> {
2174
+ _closed: boolean;
2175
+ _calcNoraml: boolean;
2176
+ /**
2177
+ *
2178
+ * @param vs 假定是没有重复的点集
2179
+ * @param closed
2180
+ * @param calcNormal
2181
+ */
2182
+ constructor(vs: Array<T> | ArrayList<T>, closed?: boolean, calcNormal?: boolean);
2183
+ init(calcNormal: boolean): void;
2184
+ set closed(val: boolean);
2185
+ get closed(): boolean;
2186
+ get tlen(): number;
2187
+ applyMat4(mat4: Mat4): void;
2188
+ scale(x: number, y: number, z: number): void;
2189
+ /**
2190
+ * 截取一段从from到to的path
2191
+ * @param {Number} from
2192
+ * @param {Number} to
2193
+ */
2194
+ splitByFromToDistance(from?: number, to?: number): Path<never> | null;
2195
+ /**
2196
+ * 从起点出发到距离等于distance位置 的坐标 二分查找
2197
+ * @param {Number} distance
2198
+ */
2199
+ getPointByDistance(arg_distance: number, left?: number, right?: number): IDistanceResut | null;
2200
+ /**
2201
+ * 从起点出发到距离等于distance位置 的坐标 二分查找
2202
+ * @param {Number} distance
2203
+ */
2204
+ getPointByDistancePure(arg_distance: number, left?: number, right?: number): Vec3 | null;
2205
+ /**
2206
+ * 平均切割为 splitCount 段
2207
+ * @param {Number} splitCount
2208
+ * @returns {Path} 新的path
2209
+ */
2210
+ splitAverage(splitCount: number): Path<T>;
2211
+ /**
2212
+ * 通过测试
2213
+ * 平均切割为 splitCount 段
2214
+ * @param {Number} splitCount
2215
+ * @param {Boolean} integer 是否取整
2216
+ * @returns {Path} 新的path
2217
+ */
2218
+ splitAverageLength(splitLength: number, integer?: boolean): Path<T>;
2219
+ /**
2220
+ *
2221
+ * @param {...any} ps
2222
+ */
2223
+ add(...ps: Vec3[] | Point[]): void;
2224
+ /**
2225
+ * @description : 计算一段线段的总长度
2226
+ * @param {ArrayLike} ps
2227
+ * @return {number} 总长度
2228
+ */
2229
+ static totalMileages(ps: ArrayLike<Vec3>): number;
2230
+ /**
2231
+ * @description : 获取没一点的里程 里程是指从第一个点出发的长度
2232
+ * @param {ArrayLike} ps 里程上的点集
2233
+ * @param {boolean} normalize 是否归一化
2234
+ * @return {number[]} 每一个点的里程数组
2235
+ * @example :
2236
+ */
2237
+ static getPerMileages(ps: ArrayLike<Vec3>, normalize?: boolean, totalMileage?: number): number[];
2031
2238
  }
2032
2239
 
2033
- declare function toGeometryBuffer(geo: IGeometry): BufferGeometry;
2034
- /**
2035
- * shape 挤压后转几何体
2036
- * @param {*} shape
2037
- * @param {*} arg_path
2038
- * @param {*} options
2039
- */
2040
- declare function extrudeToGeometryBuffer(shape: ArrayList<Vec3>, arg_path: Array<Vec3>, options: IExtrudeOptions): BufferGeometry;
2041
- /**
2042
- * 两个轮廓缝合
2043
- * @param {*} shape
2044
- * @param {*} arg_path
2045
- * @param {*} options
2046
- * @param {*} material
2047
- */
2048
- declare function linkToGeometry(shape: Array<Vec3>, shape1: Array<Vec3>, axisPlane?: AxisPlane, shapeClose?: boolean): BufferGeometry;
2049
- /**
2050
- * 多个轮廓缝合
2051
- * @param shapes
2052
- * @param isClose
2053
- * @param material
2054
- */
2240
+ declare function toGeometryBuffer(geo: IGeometry): BufferGeometry;
2241
+ /**
2242
+ * shape 挤压后转几何体
2243
+ * @param {*} shape
2244
+ * @param {*} arg_path
2245
+ * @param {*} options
2246
+ */
2247
+ declare function extrudeToGeometryBuffer(shape: ArrayList<Vec3>, arg_path: Array<Vec3>, options: IExtrudeOptions): BufferGeometry;
2248
+ /**
2249
+ * 两个轮廓缝合
2250
+ * @param {*} shape
2251
+ * @param {*} arg_path
2252
+ * @param {*} options
2253
+ * @param {*} material
2254
+ */
2255
+ declare function linkToGeometry(shape: Array<Vec3>, shape1: Array<Vec3>, axisPlane?: AxisPlane, shapeClose?: boolean): BufferGeometry;
2256
+ /**
2257
+ * 多个轮廓缝合
2258
+ * @param shapes
2259
+ * @param isClose
2260
+ * @param material
2261
+ */
2055
2262
  declare function linksToGeometry(shapes: Array<Vec3>[], pathClosed?: boolean, shapeClosed?: boolean): BufferGeometry;
2056
2263
 
2057
- export { AxisPlane, Box, BufferAttribute, BufferGeometry, Capsule, Circle, ClipType, Color, DEGREES_PER_RADIAN, Delaunator, Disk, DistanceResult, EndType, Euler, Float32BufferAttribute, Float64BufferAttribute, Frustum, IBufferGeometry, IDistanceResut, IExtrudeOptions, IExtrudeOptionsEx, IExtrudeOptionsNext, IGeometry, ILinkSideOption, ILinkSideOptions, ITriangulationOption, IVec2, IVec3, IVec4, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntersectResult, JoinType, Line, Mat3, Mat4, MeshTool, ONE_OVER_PI, ONE_OVER_TWO_PI, PI, PI_OVER_FOUR, PI_OVER_SIX, PI_OVER_THREE, PI_OVER_TWO, PI_TWO, Path, Plane, Point, Polygon, Polyline, Quat, RADIANS_PER_ARCSECOND, RADIANS_PER_DEGREE, Ray, Segment, Sphere, THREE_PI_OVER_TWO, ToDegrees, Triangle, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Vec2, Vec3, Vec4, Voronoi, angle, applyMatrix4, applyQuat, approximateEqual, boundingBox, calcCircleFromThreePoint, ceilPowerOfTwo, circle, clamp, classify, clone, delta4, delta5, delta6, delta7, delta8, delta9, disk, euler, extrude, extrudeNext, extrudeToGeometryBuffer, extrude_obsolete, flat, floorPowerOfTwo, forall, isInOnePlane, isPowerOfTwo, lerp, line, linkSide, linkSides, linkToGeometry, linksToGeometry, m3, m4, pointsCollinear, projectOnPlane, quat, randFloat, randInt, recognitionPlane, reverseOnPlane, rotate, rotateByUnitVectors, scale, segment, sign, simplifyPointList, smootherstep, smoothstep, toFixed, toFixedAry, toGeometryBuffer, toRadians, translate, triangulation, unique, v2, v3, v4, vecs, vectorCompare };
2264
+ declare class Tree<T = any> {
2265
+ /**
2266
+ * N个子节点
2267
+ */
2268
+ N: number;
2269
+ /**
2270
+ * 最大深度
2271
+ */
2272
+ maxDepth: number;
2273
+ /**
2274
+ * 子节点
2275
+ */
2276
+ children: Array<Tree<T> | undefined>;
2277
+ /**
2278
+ * 容器,用来放满足该层级条件的数据
2279
+ */
2280
+ protected readonly items: T[];
2281
+ get objects(): readonly T[];
2282
+ constructor(N?: number);
2283
+ add(obj: T): this;
2284
+ remove(obj: T): boolean;
2285
+ find(condition: T | ((obj: T) => boolean)): T[];
2286
+ }
2287
+
2288
+ /**
2289
+ *
2290
+ */
2291
+ declare class BSP extends Tree {
2292
+ constructor();
2293
+ get pos(): Tree<any> | undefined;
2294
+ get neg(): Tree<any> | undefined;
2295
+ add(obj: any): this;
2296
+ remove(obj: any): boolean;
2297
+ find(condition: any): any[];
2298
+ }
2299
+
2300
+ /** Balanced binary search tree, rebuilt after edits. Equal keys retain duplicates. */
2301
+ declare class BTree<T = number> extends Tree<T> {
2302
+ private readonly compare;
2303
+ private root?;
2304
+ private dirty;
2305
+ constructor(compare?: (a: T, b: T) => number);
2306
+ add(value: T): this;
2307
+ remove(value: T): boolean;
2308
+ find(condition: T | ((value: T) => boolean)): T[];
2309
+ }
2310
+
2311
+ /** Lazily rebuilt balanced 3D k-d tree. Coordinates are copied on insertion. */
2312
+ declare class KdTree extends Tree<Vec3> {
2313
+ private root?;
2314
+ private dirty;
2315
+ constructor(points?: readonly Vec3[]);
2316
+ get size(): number;
2317
+ get objects(): readonly Vec3[];
2318
+ add(point: Vec3): this;
2319
+ remove(point: Vec3): boolean;
2320
+ find(condition: Vec3 | ((point: Vec3) => boolean)): Vec3[];
2321
+ private rebuild;
2322
+ nearest(point: Vec3, count?: number): Vec3[];
2323
+ range(min: Vec3, max: Vec3): Vec3[];
2324
+ }
2325
+
2326
+ declare class PolyTree extends Tree {
2327
+ constructor();
2328
+ add(obj: any): this;
2329
+ remove(obj: any): boolean;
2330
+ find(condition: any): any[];
2331
+ }
2332
+
2333
+ /** Balanced-by-subdivision XY quadtree, with lazy rebuilds after edits. */
2334
+ declare class QuadTree extends Tree<Vec3> {
2335
+ private readonly capacity;
2336
+ private root?;
2337
+ private dirty;
2338
+ constructor(points?: readonly Vec3[], capacity?: number);
2339
+ get size(): number;
2340
+ get objects(): readonly Vec3[];
2341
+ add(point: Vec3): this;
2342
+ remove(point: Vec3): boolean;
2343
+ find(condition: Vec3 | ((point: Vec3) => boolean)): Vec3[];
2344
+ private rebuild;
2345
+ range(min: Vec3, max: Vec3): Vec3[];
2346
+ nearest(point: Vec3, count?: number): Vec3[];
2347
+ }
2348
+
2349
+ declare function clipPolygons(subject: Vec3[][], clip: Vec3[][], operation?: 'intersection' | 'union' | 'difference' | 'xor', normal?: Vec3, scale?: number): Vec3[][];
2350
+ declare function offsetPaths(rings: Vec3[][], delta: number, normal?: Vec3, join?: number, end?: number, miterLimit?: number, scale?: number): Vec3[][];
2351
+ declare function cleanPolygon(points: Vec3[], tolerance?: number, normal?: Vec3): Vec3[];
2352
+ declare function simplifyPolygon(points: Vec3[], normal?: Vec3): Vec3[][];
2353
+
2354
+ /** Restore owned geometry from plain data. Never trusts a serialized prototype. */
2355
+ declare function geometryFromJSON(data: GeometryData): GeometryQuery<any>;
2356
+
2357
+ export { BSP, BTree, Box, BufferAttribute, BufferGeometry, Capsule, Circle, ClipType, Color, ConvexHull, DEGREES_PER_RADIAN, Delaunator, Delaunay, Disk, Distance, EndType, Euler, Float32BufferAttribute, Float64BufferAttribute, Frustum, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntersectType, JoinType, KdTree, Line, Mat3, Mat4, MeshTool, ONE_OVER_PI, ONE_OVER_TWO_PI, Orientation, PI, PI_OVER_FOUR, PI_OVER_SIX, PI_OVER_THREE, PI_OVER_TWO, PI_TWO, Path, Plane, Point, PolyTree, Polygon, Polyline, QuadTree, Quat, QuadTree as QuatTree, RADIANS_PER_ARCSECOND, RADIANS_PER_DEGREE, Ray, Rectangle, Segment, Sphere, THREE_PI_OVER_TWO, ToDegrees, Tree, Triangle, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Vec2, Vec3, Vec4, Voronoi, angle, applyMatrix4, applyQuat, approximateEqual, boundingBox, calcCircleFromThreePoint, calculateVolume, ceilPowerOfTwo, circle, clamp, classify, cleanPolygon, clipPolygons, clone, closestPair, convexHull, delta4, delta5, delta6, delta7, delta8, delta9, disk, distance, euler, extrude, extrudeNext, extrudeToGeometryBuffer, extrude_obsolete, flat, floorPowerOfTwo, forall, geometryFromJSON, intersects, isInOnePlane, isPowerOfTwo, lerp, line, linkSide, linkSides, linkToGeometry, linksToGeometry, m3, m4, offsetPaths, pointsCollinear, projectOnPlane, quat, randFloat, randInt, recognitionPlane, reverseOnPlane, rotate, rotateByUnitVectors, scale, segment, sign, simplifyPointList, simplifyPolygon, smootherstep, smoothstep, toFixed, toFixedAry, toGeometryBuffer, toRadians, translate, triangulation, unique, v2, v3, v4, vecs, vectorCompare };
2358
+ export type { AxisPlane, DistanceParameter, DistanceResult, GeometryData, GeometryKind, GeometryQuery, IBufferGeometry, IDistanceResut, IExtrudeOptions, IExtrudeOptionsEx, IExtrudeOptionsNext, IGeometry, ILinkSideOption, ILinkSideOptions, ITriangulationOption, IVec2, IVec3, IVec4, IntersectResult };