@ccpc/math 0.1.0 → 0.1.3

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 (459) hide show
  1. package/index.cjs +226 -0
  2. package/package.json +19 -37
  3. package/types/algorithm/bool_operate/bool2d/bool2d.d.ts +22 -0
  4. package/types/algorithm/bool_operate/bool2d/difference.d.ts +9 -0
  5. package/types/algorithm/bool_operate/bool2d/intersect.d.ts +9 -0
  6. package/types/algorithm/bool_operate/bool2d/split.d.ts +3 -0
  7. package/types/algorithm/bool_operate/bool2d/union.d.ts +9 -0
  8. package/types/algorithm/bool_operate/bool2d/utils.d.ts +40 -0
  9. package/types/algorithm/bool_operate/bool_operate_clipper.d.ts +18 -0
  10. package/types/algorithm/bool_operate/polycurve_polygon_bool.d.ts +13 -0
  11. package/types/algorithm/bool_operate_2d.d.ts +67 -0
  12. package/types/algorithm/calc_d.d.ts +85 -0
  13. package/types/algorithm/calc_offset.d.ts +70 -0
  14. package/types/algorithm/calc_overlap.d.ts +56 -0
  15. package/types/algorithm/calc_project.d.ts +29 -0
  16. package/types/algorithm/calc_x.d.ts +215 -0
  17. package/types/algorithm/calculate_util/geometry_subdevide_infos.d.ts +73 -0
  18. package/types/algorithm/calculate_util/iterative_method.d.ts +30 -0
  19. package/types/algorithm/discrete/discrete_curve.d.ts +31 -0
  20. package/types/algorithm/discrete/discrete_refiner.d.ts +35 -0
  21. package/types/algorithm/discrete/discrete_surface.d.ts +74 -0
  22. package/types/algorithm/discrete/discrete_topology.d.ts +32 -0
  23. package/types/algorithm/discrete/discrete_util.d.ts +96 -0
  24. package/types/algorithm/discrete/grid_discrete_data.d.ts +58 -0
  25. package/types/algorithm/discrete/libtess.d.ts +12 -0
  26. package/types/algorithm/discrete/uniform_grid_discrete.d.ts +3 -0
  27. package/types/algorithm/distance/base_calc_distance/curves_distance_util.d.ts +20 -0
  28. package/types/algorithm/distance/base_calc_distance/define_of_calculate_distance.d.ts +12 -0
  29. package/types/algorithm/distance/curve2ds_distance/arc2s_distance.d.ts +17 -0
  30. package/types/algorithm/distance/curve2ds_distance/line2d_to_arc2d_distance.d.ts +17 -0
  31. package/types/algorithm/distance/curve2ds_distance/line2s_distance.d.ts +15 -0
  32. package/types/algorithm/distance/curve2s_distance.d.ts +15 -0
  33. package/types/algorithm/distance/curve3ds_distance/line3d_to_line3d_distance_paramed.d.ts +12 -0
  34. package/types/algorithm/distance/curve3s_distance.d.ts +31 -0
  35. package/types/algorithm/distance/pt_to_curve2_signed_distance.d.ts +17 -0
  36. package/types/algorithm/distance/pt_to_curve3_distance.d.ts +25 -0
  37. package/types/algorithm/distance/pt_to_curve_distance_info.d.ts +12 -0
  38. package/types/algorithm/distance/pt_to_surface_distance.d.ts +17 -0
  39. package/types/algorithm/distance/pts_to_curves_distance.d.ts +13 -0
  40. package/types/algorithm/distance/pts_to_pts_distance.d.ts +7 -0
  41. package/types/algorithm/geometry_merge.d.ts +22 -0
  42. package/types/algorithm/index.d.ts +32 -0
  43. package/types/algorithm/intersect/box_cut_line.d.ts +6 -0
  44. package/types/algorithm/intersect/curve_self_x.d.ts +13 -0
  45. package/types/algorithm/intersect/curve_surface_x.d.ts +34 -0
  46. package/types/algorithm/intersect/curve_surface_x_util.d.ts +32 -0
  47. package/types/algorithm/intersect/curves_x/circulars_x.d.ts +35 -0
  48. package/types/algorithm/intersect/curves_x/linear_circular_x.d.ts +40 -0
  49. package/types/algorithm/intersect/curves_x/lines_x.d.ts +17 -0
  50. package/types/algorithm/intersect/curves_x/lines_x_util.d.ts +4 -0
  51. package/types/algorithm/intersect/curves_x.d.ts +26 -0
  52. package/types/algorithm/intersect/curves_x_util.d.ts +35 -0
  53. package/types/algorithm/intersect/intersect_info_util.d.ts +9 -0
  54. package/types/algorithm/intersect/surface_self_x.d.ts +8 -0
  55. package/types/algorithm/intersect/surfaces_x.d.ts +53 -0
  56. package/types/algorithm/intersect/surfaces_x_complex.d.ts +29 -0
  57. package/types/algorithm/intersect/surfaces_x_special.d.ts +16 -0
  58. package/types/algorithm/intersect/surfaces_x_util.d.ts +41 -0
  59. package/types/algorithm/intersect/x_info.d.ts +65 -0
  60. package/types/algorithm/loop_property/loop-area.d.ts +49 -0
  61. package/types/algorithm/loop_property/loop-centroid.d.ts +40 -0
  62. package/types/algorithm/merge_geometry/halfplane.d.ts +24 -0
  63. package/types/algorithm/merge_geometry/merge_curve.d.ts +14 -0
  64. package/types/algorithm/merge_geometry/merge_point.d.ts +18 -0
  65. package/types/algorithm/mesh/clip_mesh.d.ts +27 -0
  66. package/types/algorithm/mesh/extrude_clip.d.ts +236 -0
  67. package/types/algorithm/mesh/mesh_assist.d.ts +21 -0
  68. package/types/algorithm/mesh/mesh_contour.d.ts +26 -0
  69. package/types/algorithm/mesh/mesh_util.d.ts +115 -0
  70. package/types/algorithm/offset/loop2d_offset.d.ts +22 -0
  71. package/types/algorithm/offset/polygon_offset.d.ts +27 -0
  72. package/types/algorithm/overlap/curve_surface_coincide.d.ts +6 -0
  73. package/types/algorithm/overlap/curves_colinear.d.ts +38 -0
  74. package/types/algorithm/overlap/curves_merge.d.ts +74 -0
  75. package/types/algorithm/overlap/curves_overlap.d.ts +34 -0
  76. package/types/algorithm/overlap/i_overlap.d.ts +9 -0
  77. package/types/algorithm/overlap/surfaces_coplaner.d.ts +5 -0
  78. package/types/algorithm/pattern/blocks2Geometry.d.ts +50 -0
  79. package/types/algorithm/pattern/math.d.ts +42 -0
  80. package/types/algorithm/pattern/pattern.d.ts +43 -0
  81. package/types/algorithm/pattern/pattern_util.d.ts +53 -0
  82. package/types/algorithm/pattern/pave.d.ts +33 -0
  83. package/types/algorithm/pj/curves_oj.d.ts +19 -0
  84. package/types/algorithm/pj/curves_pj.d.ts +19 -0
  85. package/types/algorithm/pj/loops_pj.d.ts +13 -0
  86. package/types/algorithm/pj/pj_type.d.ts +46 -0
  87. package/types/algorithm/pj/pt_loop_pj.d.ts +24 -0
  88. package/types/algorithm/pj/pt_polygon_pj.d.ts +18 -0
  89. package/types/algorithm/pj/pt_polygon_position_judger.d.ts +11 -0
  90. package/types/algorithm/position_judge.d.ts +72 -0
  91. package/types/algorithm/project/curve3d_to_plane_project.d.ts +11 -0
  92. package/types/algorithm/project/curve_curve_project.d.ts +9 -0
  93. package/types/algorithm/search_graph/iloops_polygonex.d.ts +28 -0
  94. package/types/algorithm/search_graph/loop_tree_node.d.ts +30 -0
  95. package/types/algorithm/search_graph/loops_to_loop_tree_search_graph.d.ts +25 -0
  96. package/types/algorithm/search_graph/polygon_polygonex.d.ts +13 -0
  97. package/types/algorithm/search_graph/search_loop2d.d.ts +20 -0
  98. package/types/algorithm/search_graph/search_polyline.d.ts +11 -0
  99. package/types/algorithm/search_graph.d.ts +45 -0
  100. package/types/algorithm/topology_edit.d.ts +10 -0
  101. package/types/base/box.d.ts +100 -0
  102. package/types/base/box2.d.ts +17 -0
  103. package/types/base/box3.d.ts +20 -0
  104. package/types/base/coord.d.ts +10 -0
  105. package/types/base/coord2.d.ts +92 -0
  106. package/types/base/coord3.d.ts +139 -0
  107. package/types/base/discrete_param.d.ts +28 -0
  108. package/types/base/euler.d.ts +102 -0
  109. package/types/base/geo_element.d.ts +54 -0
  110. package/types/base/interval.d.ts +122 -0
  111. package/types/base/ivector.d.ts +126 -0
  112. package/types/base/matrix.d.ts +108 -0
  113. package/types/base/matrix3.d.ts +118 -0
  114. package/types/base/matrix4.d.ts +166 -0
  115. package/types/base/matrix_util.d.ts +5 -0
  116. package/types/base/period_inverval.d.ts +127 -0
  117. package/types/base/quaternion.d.ts +39 -0
  118. package/types/base/tangent_cone.d.ts +11 -0
  119. package/types/base/tilt_box.d.ts +11 -0
  120. package/types/base/tol.d.ts +120 -0
  121. package/types/base/vec.d.ts +46 -0
  122. package/types/base/vec2.d.ts +146 -0
  123. package/types/base/vec3.d.ts +158 -0
  124. package/types/brep-src/algorithm/alg_const.d.ts +23 -0
  125. package/types/brep-src/algorithm/alg_types.d.ts +47 -0
  126. package/types/brep-src/algorithm/algorithm_util/base_define.d.ts +7 -0
  127. package/types/brep-src/algorithm/algorithm_util/body_base_util.d.ts +4 -0
  128. package/types/brep-src/algorithm/algorithm_util/curve_solid_analysis.d.ts +28 -0
  129. package/types/brep-src/algorithm/algorithm_util/face_face_analysis.d.ts +39 -0
  130. package/types/brep-src/algorithm/algorithm_util/search_wire.d.ts +8 -0
  131. package/types/brep-src/algorithm/body_builder/basic_body_builder.d.ts +15 -0
  132. package/types/brep-src/algorithm/body_builder/extrude_body.d.ts +23 -0
  133. package/types/brep-src/algorithm/body_builder/sweep_body.d.ts +37 -0
  134. package/types/brep-src/algorithm/body_builder.d.ts +36 -0
  135. package/types/brep-src/algorithm/body_util.d.ts +21 -0
  136. package/types/brep-src/algorithm/bool_sk/brep_converter.d.ts +11 -0
  137. package/types/brep-src/algorithm/brep_calc_project.d.ts +50 -0
  138. package/types/brep-src/algorithm/brep_calc_x.d.ts +34 -0
  139. package/types/brep-src/algorithm/brep_pj.d.ts +47 -0
  140. package/types/brep-src/algorithm/index.d.ts +5 -0
  141. package/types/brep-src/algorithm/intersect/curve_face_overlap.d.ts +10 -0
  142. package/types/brep-src/algorithm/intersect/face_face_intersect.d.ts +22 -0
  143. package/types/brep-src/algorithm/intersect/face_faces_intersect.d.ts +15 -0
  144. package/types/brep-src/algorithm/intersect/line_face_intersect.d.ts +16 -0
  145. package/types/brep-src/algorithm/podition_judge/body_pj.d.ts +25 -0
  146. package/types/brep-src/algorithm/podition_judge/extrude_pj.d.ts +28 -0
  147. package/types/brep-src/algorithm/podition_judge/pt_body_pj.d.ts +32 -0
  148. package/types/brep-src/algorithm/project/body_project.d.ts +8 -0
  149. package/types/brep-src/algorithm/project/face_project.d.ts +20 -0
  150. package/types/brep-src/algorithm/project/face_surface_project.d.ts +8 -0
  151. package/types/brep-src/algorithm/project/space_project.d.ts +26 -0
  152. package/types/brep-src/algorithm/project/space_project_simple.d.ts +10 -0
  153. package/types/brep-src/algorithm/project/view_project.d.ts +25 -0
  154. package/types/brep-src/algorithm/shell_builder/create_shell_from_curves.d.ts +38 -0
  155. package/types/brep-src/algorithm/shell_builder.d.ts +25 -0
  156. package/types/brep-src/algorithm/shell_edit/add_edges/add_edges.d.ts +14 -0
  157. package/types/brep-src/algorithm/shell_edit/add_edges/add_edges_core.d.ts +11 -0
  158. package/types/brep-src/algorithm/shell_edit/copy_faces.d.ts +20 -0
  159. package/types/brep-src/algorithm/shell_edit/delete_faces_edges/delete_edge.d.ts +9 -0
  160. package/types/brep-src/algorithm/shell_edit/delete_faces_edges/delete_faces_edges.d.ts +17 -0
  161. package/types/brep-src/algorithm/shell_edit/faces_boolean/faces_boolean.d.ts +19 -0
  162. package/types/brep-src/algorithm/shell_edit/faces_boolean/faces_shells_boolean.d.ts +13 -0
  163. package/types/brep-src/algorithm/shell_edit/faces_boolean/octree.d.ts +11 -0
  164. package/types/brep-src/algorithm/shell_edit/isolate_faces.d.ts +21 -0
  165. package/types/brep-src/algorithm/shell_edit/merge_connect_faces.d.ts +14 -0
  166. package/types/brep-src/algorithm/shell_edit/merge_edges.d.ts +8 -0
  167. package/types/brep-src/algorithm/shell_edit/move_operators/move_edges.d.ts +31 -0
  168. package/types/brep-src/algorithm/shell_edit/move_operators/move_faces.d.ts +14 -0
  169. package/types/brep-src/algorithm/shell_edit/operator/dispose_topo.d.ts +2 -0
  170. package/types/brep-src/algorithm/shell_edit/operator/merge_connect_edge.d.ts +3 -0
  171. package/types/brep-src/algorithm/shell_edit/operator/merge_connect_face.d.ts +2 -0
  172. package/types/brep-src/algorithm/shell_edit/operator/merge_overlap_edge.d.ts +3 -0
  173. package/types/brep-src/algorithm/shell_edit/operator/merge_shell.d.ts +11 -0
  174. package/types/brep-src/algorithm/shell_edit/operator/merge_vertex.d.ts +2 -0
  175. package/types/brep-src/algorithm/shell_edit/operator/split_edge.d.ts +4 -0
  176. package/types/brep-src/algorithm/shell_edit/operator/split_shell.d.ts +6 -0
  177. package/types/brep-src/algorithm/shell_edit/pull_push_face/pull_push_face.d.ts +18 -0
  178. package/types/brep-src/algorithm/shell_edit/pull_push_face/pull_push_face_core.d.ts +6 -0
  179. package/types/brep-src/algorithm/shell_edit/pull_push_face/pull_push_face_preview.d.ts +16 -0
  180. package/types/brep-src/algorithm/shell_edit/pull_push_face/pull_push_face_preview_core.d.ts +24 -0
  181. package/types/brep-src/algorithm/shell_edit/roundinng/2d_rounding.d.ts +22 -0
  182. package/types/brep-src/algorithm/shell_edit/shell_modeling_base.d.ts +10 -0
  183. package/types/brep-src/algorithm/shell_edit/shell_modeling_result.d.ts +21 -0
  184. package/types/brep-src/algorithm/shell_edit/smooth/detect_loop_util.d.ts +27 -0
  185. package/types/brep-src/algorithm/shell_edit/smooth/shell_modeling_util.d.ts +24 -0
  186. package/types/brep-src/algorithm/shell_edit/smooth/smooth_util.d.ts +22 -0
  187. package/types/brep-src/algorithm/shell_edit/split_edge.d.ts +10 -0
  188. package/types/brep-src/algorithm/shell_edit.d.ts +119 -0
  189. package/types/brep-src/algorithm/shell_valid/base_brep_topo_error.d.ts +176 -0
  190. package/types/brep-src/algorithm/shell_valid/diagnose_shell.d.ts +14 -0
  191. package/types/brep-src/brep/brep_body.d.ts +19 -0
  192. package/types/brep-src/brep/coedge3d.d.ts +83 -0
  193. package/types/brep-src/brep/edge.d.ts +96 -0
  194. package/types/brep-src/brep/face.d.ts +150 -0
  195. package/types/brep-src/brep/shell.d.ts +166 -0
  196. package/types/brep-src/brep/topo_object.d.ts +40 -0
  197. package/types/brep-src/brep/vertex.d.ts +48 -0
  198. package/types/brep-src/brep/wire.d.ts +66 -0
  199. package/types/brep-src/continuous/continuous_edge.d.ts +17 -0
  200. package/types/brep-src/continuous/continuous_face.d.ts +10 -0
  201. package/types/brep-src/continuous/continuous_util.d.ts +60 -0
  202. package/types/brep-src/continuous/continuous_uv.d.ts +24 -0
  203. package/types/brep-src/continuous/index.d.ts +4 -0
  204. package/types/brep-src/index.d.ts +14 -0
  205. package/types/brep-src/type_define/i_types.d.ts +46 -0
  206. package/types/brep-src/util/util.d.ts +23 -0
  207. package/types/conversion/units_conversion.d.ts +14 -0
  208. package/types/geometry/arc2d.d.ts +249 -0
  209. package/types/geometry/arc3d.d.ts +204 -0
  210. package/types/geometry/circle3d.d.ts +92 -0
  211. package/types/geometry/circular_surface.d.ts +52 -0
  212. package/types/geometry/coord_based_surface.d.ts +25 -0
  213. package/types/geometry/curve.d.ts +228 -0
  214. package/types/geometry/curve2.d.ts +62 -0
  215. package/types/geometry/curve3d.d.ts +66 -0
  216. package/types/geometry/cylinder.d.ts +73 -0
  217. package/types/geometry/discrete_arrow.d.ts +3 -0
  218. package/types/geometry/extend_curve2.d.ts +75 -0
  219. package/types/geometry/geometry2d.d.ts +35 -0
  220. package/types/geometry/geometry3d.d.ts +36 -0
  221. package/types/geometry/intersect_curve3.d.ts +90 -0
  222. package/types/geometry/ln2.d.ts +168 -0
  223. package/types/geometry/ln3.d.ts +152 -0
  224. package/types/geometry/nurbs_curve2.d.ts +106 -0
  225. package/types/geometry/nurbs_curve3.d.ts +191 -0
  226. package/types/geometry/offset_curve2.d.ts +63 -0
  227. package/types/geometry/offset_curve3.d.ts +97 -0
  228. package/types/geometry/offset_parameter_mapper.d.ts +72 -0
  229. package/types/geometry/plane.d.ts +109 -0
  230. package/types/geometry/polyline.d.ts +12 -0
  231. package/types/geometry/smooth_poly2.d.ts +78 -0
  232. package/types/geometry/smooth_poly3.d.ts +85 -0
  233. package/types/geometry/surface.d.ts +173 -0
  234. package/types/index.d.ts +78 -0
  235. package/types/io/obj_parser.d.ts +4 -0
  236. package/types/io/svgparser.d.ts +22 -0
  237. package/types/loader/loader.d.ts +23 -0
  238. package/types/loader/register_geo.d.ts +7 -0
  239. package/types/math/gauss_integration.d.ts +13 -0
  240. package/types/math/inv_bilinear.d.ts +33 -0
  241. package/types/solve_equations/cubic_equation.d.ts +7 -0
  242. package/types/solve_equations/linear_system.d.ts +6 -0
  243. package/types/solve_equations/nonlinear_system.d.ts +11 -0
  244. package/types/solve_equations/plurality.d.ts +9 -0
  245. package/types/solve_equations/polynomial_equation.d.ts +6 -0
  246. package/types/solve_equations/quadratic_equation.d.ts +6 -0
  247. package/types/solve_equations/quartic_equation.d.ts +6 -0
  248. package/types/solve_equations/solve_equation_util.d.ts +50 -0
  249. package/types/test_util/loop_generator.d.ts +21 -0
  250. package/types/topology/evolution_map.d.ts +90 -0
  251. package/types/topology/loop.d.ts +50 -0
  252. package/types/topology/polycurve.d.ts +109 -0
  253. package/types/topology/polygon.d.ts +118 -0
  254. package/types/topology/trimmed_surface.d.ts +136 -0
  255. package/types/type_define/const.d.ts +18 -0
  256. package/types/type_define/i_element.d.ts +9 -0
  257. package/types/type_define/i_element_type.d.ts +34 -0
  258. package/types/type_define/i_geometry.d.ts +191 -0
  259. package/types/type_define/i_types.d.ts +280 -0
  260. package/types/util/array_util.d.ts +8 -0
  261. package/types/util/assert.d.ts +21 -0
  262. package/types/util/clipper2_util.d.ts +5 -0
  263. package/types/util/clipper_format_converter.d.ts +21 -0
  264. package/types/util/clipper_util.d.ts +10 -0
  265. package/types/util/curve_util.d.ts +72 -0
  266. package/types/util/geom_util.d.ts +23 -0
  267. package/types/util/log.d.ts +19 -0
  268. package/types/util/math_error.d.ts +37 -0
  269. package/types/util/surface_util.d.ts +13 -0
  270. package/types/util/util.d.ts +18 -0
  271. package/types/util/uv_util.d.ts +68 -0
  272. package/types/verb/export_verb.d.ts +2 -0
  273. package/types/wasm/a2d.d.ts +19 -0
  274. package/types/wasm/bx2.d.ts +16 -0
  275. package/types/wasm/c2d.d.ts +29 -0
  276. package/types/wasm/elli.d.ts +19 -0
  277. package/types/wasm/grapher2d.d.ts +39 -0
  278. package/types/wasm/grapherutil.d.ts +9 -0
  279. package/types/wasm/l2d.d.ts +14 -0
  280. package/types/wasm/loader.d.ts +8 -0
  281. package/types/wasm/pt.d.ts +19 -0
  282. package/types/wasm/wasm-geom.d.ts +296 -0
  283. package/types/wasm/wasminstance.d.ts +19 -0
  284. package/types/wasm/wrapper.d.ts +82 -0
  285. package/README.md +0 -21
  286. package/dist/constants/geom_type.d.ts +0 -13
  287. package/dist/constants/geom_type.d.ts.map +0 -1
  288. package/dist/constants/geom_type.js +0 -17
  289. package/dist/constants/math_const.d.ts +0 -9
  290. package/dist/constants/math_const.d.ts.map +0 -1
  291. package/dist/constants/math_const.js +0 -12
  292. package/dist/core/box2.d.ts +0 -71
  293. package/dist/core/box2.d.ts.map +0 -1
  294. package/dist/core/box2.js +0 -243
  295. package/dist/core/coord2d.d.ts +0 -62
  296. package/dist/core/coord2d.d.ts.map +0 -1
  297. package/dist/core/coord2d.js +0 -155
  298. package/dist/core/geom_base.d.ts +0 -19
  299. package/dist/core/geom_base.d.ts.map +0 -1
  300. package/dist/core/geom_base.js +0 -18
  301. package/dist/core/mat3.d.ts +0 -101
  302. package/dist/core/mat3.d.ts.map +0 -1
  303. package/dist/core/mat3.js +0 -290
  304. package/dist/core/vec2.d.ts +0 -138
  305. package/dist/core/vec2.d.ts.map +0 -1
  306. package/dist/core/vec2.js +0 -297
  307. package/dist/curves/arc2.d.ts +0 -49
  308. package/dist/curves/arc2.d.ts.map +0 -1
  309. package/dist/curves/arc2.js +0 -265
  310. package/dist/curves/bspline2.d.ts +0 -150
  311. package/dist/curves/bspline2.d.ts.map +0 -1
  312. package/dist/curves/bspline2.js +0 -793
  313. package/dist/curves/circle2.d.ts +0 -42
  314. package/dist/curves/circle2.d.ts.map +0 -1
  315. package/dist/curves/circle2.js +0 -135
  316. package/dist/curves/circle_curve2.d.ts +0 -38
  317. package/dist/curves/circle_curve2.d.ts.map +0 -1
  318. package/dist/curves/circle_curve2.js +0 -112
  319. package/dist/curves/curve2.d.ts +0 -214
  320. package/dist/curves/curve2.d.ts.map +0 -1
  321. package/dist/curves/curve2.js +0 -238
  322. package/dist/curves/ellipse2.d.ts +0 -42
  323. package/dist/curves/ellipse2.d.ts.map +0 -1
  324. package/dist/curves/ellipse2.js +0 -125
  325. package/dist/curves/ellipse_arc2.d.ts +0 -49
  326. package/dist/curves/ellipse_arc2.d.ts.map +0 -1
  327. package/dist/curves/ellipse_arc2.js +0 -184
  328. package/dist/curves/ellipse_curve2.d.ts +0 -56
  329. package/dist/curves/ellipse_curve2.d.ts.map +0 -1
  330. package/dist/curves/ellipse_curve2.js +0 -262
  331. package/dist/curves/interval.d.ts +0 -112
  332. package/dist/curves/interval.d.ts.map +0 -1
  333. package/dist/curves/interval.js +0 -200
  334. package/dist/curves/line2.d.ts +0 -64
  335. package/dist/curves/line2.d.ts.map +0 -1
  336. package/dist/curves/line2.js +0 -193
  337. package/dist/curves/period_interval.d.ts +0 -129
  338. package/dist/curves/period_interval.d.ts.map +0 -1
  339. package/dist/curves/period_interval.js +0 -240
  340. package/dist/discretize/discretize_defaults.d.ts +0 -12
  341. package/dist/discretize/discretize_defaults.d.ts.map +0 -1
  342. package/dist/discretize/discretize_defaults.js +0 -12
  343. package/dist/discretize/discretize_engine.d.ts +0 -33
  344. package/dist/discretize/discretize_engine.d.ts.map +0 -1
  345. package/dist/discretize/discretize_engine.js +0 -347
  346. package/dist/discretize/discretize_errors.d.ts +0 -15
  347. package/dist/discretize/discretize_errors.d.ts.map +0 -1
  348. package/dist/discretize/discretize_errors.js +0 -30
  349. package/dist/discretize/discretize_options.d.ts +0 -18
  350. package/dist/discretize/discretize_options.d.ts.map +0 -1
  351. package/dist/discretize/discretize_options.js +0 -19
  352. package/dist/discretize/discretize_types.d.ts +0 -36
  353. package/dist/discretize/discretize_types.d.ts.map +0 -1
  354. package/dist/discretize/discretize_types.js +0 -1
  355. package/dist/discretize/internal/curve_guards.d.ts +0 -35
  356. package/dist/discretize/internal/curve_guards.d.ts.map +0 -1
  357. package/dist/discretize/internal/curve_guards.js +0 -62
  358. package/dist/discretize/internal/postprocess.d.ts +0 -5
  359. package/dist/discretize/internal/postprocess.d.ts.map +0 -1
  360. package/dist/discretize/internal/postprocess.js +0 -109
  361. package/dist/discretize/internal/sampling_utils.d.ts +0 -8
  362. package/dist/discretize/internal/sampling_utils.d.ts.map +0 -1
  363. package/dist/discretize/internal/sampling_utils.js +0 -36
  364. package/dist/discretize/register_builtin_strategies.d.ts +0 -3
  365. package/dist/discretize/register_builtin_strategies.d.ts.map +0 -1
  366. package/dist/discretize/register_builtin_strategies.js +0 -10
  367. package/dist/discretize/strategies/bspline_strategy.d.ts +0 -4
  368. package/dist/discretize/strategies/bspline_strategy.d.ts.map +0 -1
  369. package/dist/discretize/strategies/bspline_strategy.js +0 -115
  370. package/dist/discretize/strategies/circle_strategy.d.ts +0 -7
  371. package/dist/discretize/strategies/circle_strategy.d.ts.map +0 -1
  372. package/dist/discretize/strategies/circle_strategy.js +0 -55
  373. package/dist/discretize/strategies/ellipse_strategy.d.ts +0 -7
  374. package/dist/discretize/strategies/ellipse_strategy.d.ts.map +0 -1
  375. package/dist/discretize/strategies/ellipse_strategy.js +0 -86
  376. package/dist/discretize/strategies/line_strategy.d.ts +0 -4
  377. package/dist/discretize/strategies/line_strategy.d.ts.map +0 -1
  378. package/dist/discretize/strategies/line_strategy.js +0 -40
  379. package/dist/discretize/strategy_registry.d.ts +0 -9
  380. package/dist/discretize/strategy_registry.d.ts.map +0 -1
  381. package/dist/discretize/strategy_registry.js +0 -34
  382. package/dist/index.d.ts +0 -30
  383. package/dist/index.d.ts.map +0 -1
  384. package/dist/index.js +0 -24
  385. package/dist/intersections/analytic_x_algorithm.d.ts +0 -10
  386. package/dist/intersections/analytic_x_algorithm.d.ts.map +0 -1
  387. package/dist/intersections/analytic_x_algorithm.js +0 -83
  388. package/dist/intersections/curve_x_engine.d.ts +0 -9
  389. package/dist/intersections/curve_x_engine.d.ts.map +0 -1
  390. package/dist/intersections/curve_x_engine.js +0 -27
  391. package/dist/intersections/index.d.ts +0 -5
  392. package/dist/intersections/index.d.ts.map +0 -1
  393. package/dist/intersections/index.js +0 -11
  394. package/dist/intersections/internal/certification.d.ts +0 -34
  395. package/dist/intersections/internal/certification.d.ts.map +0 -1
  396. package/dist/intersections/internal/certification.js +0 -238
  397. package/dist/intersections/internal/interval_clipping.d.ts +0 -29
  398. package/dist/intersections/internal/interval_clipping.d.ts.map +0 -1
  399. package/dist/intersections/internal/interval_clipping.js +0 -123
  400. package/dist/intersections/internal/kind.d.ts +0 -4
  401. package/dist/intersections/internal/kind.d.ts.map +0 -1
  402. package/dist/intersections/internal/kind.js +0 -16
  403. package/dist/intersections/internal/pair.d.ts +0 -9
  404. package/dist/intersections/internal/pair.d.ts.map +0 -1
  405. package/dist/intersections/internal/pair.js +0 -14
  406. package/dist/intersections/internal/result.d.ts +0 -20
  407. package/dist/intersections/internal/result.d.ts.map +0 -1
  408. package/dist/intersections/internal/result.js +0 -125
  409. package/dist/intersections/internal/sampling.d.ts +0 -15
  410. package/dist/intersections/internal/sampling.d.ts.map +0 -1
  411. package/dist/intersections/internal/sampling.js +0 -131
  412. package/dist/intersections/internal/segment.d.ts +0 -32
  413. package/dist/intersections/internal/segment.d.ts.map +0 -1
  414. package/dist/intersections/internal/segment.js +0 -137
  415. package/dist/intersections/internal/tolerance.d.ts +0 -10
  416. package/dist/intersections/internal/tolerance.d.ts.map +0 -1
  417. package/dist/intersections/internal/tolerance.js +0 -20
  418. package/dist/intersections/intersector.d.ts +0 -6
  419. package/dist/intersections/intersector.d.ts.map +0 -1
  420. package/dist/intersections/intersector.js +0 -1
  421. package/dist/intersections/numeric_x_algorithm.d.ts +0 -10
  422. package/dist/intersections/numeric_x_algorithm.d.ts.map +0 -1
  423. package/dist/intersections/numeric_x_algorithm.js +0 -73
  424. package/dist/intersections/solvers/bspline_self_solver.d.ts +0 -7
  425. package/dist/intersections/solvers/bspline_self_solver.d.ts.map +0 -1
  426. package/dist/intersections/solvers/bspline_self_solver.js +0 -308
  427. package/dist/intersections/solvers/line_line_pair_solver.d.ts +0 -7
  428. package/dist/intersections/solvers/line_line_pair_solver.d.ts.map +0 -1
  429. package/dist/intersections/solvers/line_line_pair_solver.js +0 -35
  430. package/dist/intersections/solvers/pair_solvers.d.ts +0 -94
  431. package/dist/intersections/solvers/pair_solvers.d.ts.map +0 -1
  432. package/dist/intersections/solvers/pair_solvers.js +0 -1078
  433. package/dist/intersections/solvers/polyline_pair_intersector.d.ts +0 -51
  434. package/dist/intersections/solvers/polyline_pair_intersector.d.ts.map +0 -1
  435. package/dist/intersections/solvers/polyline_pair_intersector.js +0 -731
  436. package/dist/intersections/types.d.ts +0 -11
  437. package/dist/intersections/types.d.ts.map +0 -1
  438. package/dist/intersections/types.js +0 -1
  439. package/dist/serialize/dump_types.d.ts +0 -101
  440. package/dist/serialize/dump_types.d.ts.map +0 -1
  441. package/dist/serialize/dump_types.js +0 -5
  442. package/dist/serialize/geom_mgr.d.ts +0 -24
  443. package/dist/serialize/geom_mgr.d.ts.map +0 -1
  444. package/dist/serialize/geom_mgr.js +0 -30
  445. package/dist/types/type_define.d.ts +0 -29
  446. package/dist/types/type_define.d.ts.map +0 -1
  447. package/dist/types/type_define.js +0 -10
  448. package/dist/types/type_guard.d.ts +0 -46
  449. package/dist/types/type_guard.d.ts.map +0 -1
  450. package/dist/types/type_guard.js +0 -5
  451. package/dist/utils/math_error.d.ts +0 -16
  452. package/dist/utils/math_error.d.ts.map +0 -1
  453. package/dist/utils/math_error.js +0 -35
  454. package/dist/utils/math_utils.d.ts +0 -9
  455. package/dist/utils/math_utils.d.ts.map +0 -1
  456. package/dist/utils/math_utils.js +0 -25
  457. package/dist/utils/precision.d.ts +0 -29
  458. package/dist/utils/precision.d.ts.map +0 -1
  459. package/dist/utils/precision.js +0 -44
package/README.md DELETED
@@ -1,21 +0,0 @@
1
- # @ccpc/math
2
-
3
- 2D geometry and curve math library for Linea.
4
-
5
- ## Install
6
-
7
- ```bash
8
- pnpm add @ccpc/math
9
- ```
10
-
11
- ## Usage
12
-
13
- ```ts
14
- import { Vec2, Line2, Circle2, BSpline2 } from '@ccpc/math'
15
- ```
16
-
17
- ## Build
18
-
19
- ```bash
20
- pnpm --filter "@ccpc/math" build
21
- ```
@@ -1,13 +0,0 @@
1
- export declare enum EN_GEO_TYPE {
2
- Vec2 = "Vec2",
3
- Mat3 = "Mat3",
4
- Box2 = "Box2",
5
- Coord2D = "Coord2D",
6
- Line2 = "Line2",
7
- Circle2 = "Circle2",
8
- Arc2 = "Arc2",
9
- Ellipse2 = "Ellipse2",
10
- EllipseArc2 = "EllipseArc2",
11
- BSpline2 = "BSpline2"
12
- }
13
- //# sourceMappingURL=geom_type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"geom_type.d.ts","sourceRoot":"","sources":["../../src/constants/geom_type.ts"],"names":[],"mappings":"AAKA,oBAAY,WAAW;IACnB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,YAAY;IAEnB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,QAAQ,aAAa;CACxB"}
@@ -1,17 +0,0 @@
1
- /*
2
- * Linea Math - Types
3
- * 用于序列化的几何类型枚举
4
- */
5
- export var EN_GEO_TYPE;
6
- (function (EN_GEO_TYPE) {
7
- EN_GEO_TYPE["Vec2"] = "Vec2";
8
- EN_GEO_TYPE["Mat3"] = "Mat3";
9
- EN_GEO_TYPE["Box2"] = "Box2";
10
- EN_GEO_TYPE["Coord2D"] = "Coord2D";
11
- EN_GEO_TYPE["Line2"] = "Line2";
12
- EN_GEO_TYPE["Circle2"] = "Circle2";
13
- EN_GEO_TYPE["Arc2"] = "Arc2";
14
- EN_GEO_TYPE["Ellipse2"] = "Ellipse2";
15
- EN_GEO_TYPE["EllipseArc2"] = "EllipseArc2";
16
- EN_GEO_TYPE["BSpline2"] = "BSpline2";
17
- })(EN_GEO_TYPE || (EN_GEO_TYPE = {}));
@@ -1,9 +0,0 @@
1
- export declare class MathConst {
2
- /** 负无穷,表示无界最小值 */
3
- static readonly MIN: number;
4
- /** 正无穷,表示无界最大值 */
5
- static readonly MAX: number;
6
- /** 2 * PI */
7
- static readonly PI2: number;
8
- }
9
- //# sourceMappingURL=math_const.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"math_const.d.ts","sourceRoot":"","sources":["../../src/constants/math_const.ts"],"names":[],"mappings":"AAKA,qBAAa,SAAS;IAClB,kBAAkB;IAClB,gBAAuB,GAAG,SAA2B;IAErD,kBAAkB;IAClB,gBAAuB,GAAG,SAA2B;IAErD,aAAa;IACb,gBAAuB,GAAG,SAAc;CAC3C"}
@@ -1,12 +0,0 @@
1
- /*
2
- * Linea Math - Constants
3
- * MathConst: 数学常量集中定义
4
- */
5
- export class MathConst {
6
- }
7
- /** 负无穷,表示无界最小值 */
8
- MathConst.MIN = Number.NEGATIVE_INFINITY;
9
- /** 正无穷,表示无界最大值 */
10
- MathConst.MAX = Number.POSITIVE_INFINITY;
11
- /** 2 * PI */
12
- MathConst.PI2 = Math.PI * 2;
@@ -1,71 +0,0 @@
1
- import { GeomBase } from './geom_base';
2
- import { EN_GEO_TYPE } from '../constants/geom_type';
3
- import type { IDBBox2 } from '../serialize/dump_types';
4
- import { Vec2 } from './vec2';
5
- import { Mat3 } from './mat3';
6
- export declare class Box2 extends GeomBase {
7
- /** 序列化类型标识 */
8
- static readonly type = EN_GEO_TYPE.Box2;
9
- /** 最小/最大边界 */
10
- readonly minX: number;
11
- readonly minY: number;
12
- readonly maxX: number;
13
- readonly maxY: number;
14
- /** 创建 Box2(默认为空盒) */
15
- constructor();
16
- constructor(b: Box2);
17
- constructor(min: Vec2, max: Vec2);
18
- constructor(points: readonly Vec2[]);
19
- constructor(minX: number, minY: number, maxX: number, maxY: number);
20
- /** 空盒 */
21
- static empty(): Box2;
22
- /** 由最小/最大点创建 */
23
- static fromMinMax(min: Vec2, max: Vec2): Box2;
24
- /** 由点集创建 */
25
- static fromPoints(points: readonly Vec2[]): Box2;
26
- /** 克隆 */
27
- clone(): Box2;
28
- /** 是否为空盒 */
29
- isEmpty(): boolean;
30
- /** 是否为有限数 */
31
- isFinite(): boolean;
32
- /** 宽度 */
33
- width(): number;
34
- /** 高度 */
35
- height(): number;
36
- /** 尺寸 */
37
- size(): Vec2;
38
- /** 中心点 */
39
- center(): Vec2;
40
- /** 是否包含点 */
41
- containsPoint(v: Vec2): boolean;
42
- /** 是否包含盒 */
43
- containsBox(b: Box2): boolean;
44
- /** 是否相交 */
45
- intersects(b: Box2): boolean;
46
- /** 扩展以包含点 */
47
- expandByPoint(v: Vec2): Box2;
48
- /** 按标量扩展 */
49
- expandByScalar(s: number): Box2;
50
- /** 合并盒 */
51
- union(b: Box2): Box2;
52
- /** 平移 */
53
- translate(dx: number, dy: number): Box2;
54
- /** 变换(返回新对象) */
55
- transform(m: Mat3): Box2;
56
- /** 变换(返回新对象) */
57
- transformed(m: Mat3): Box2;
58
- /** 点到盒子的最短距离 */
59
- distanceToPoint(p: Vec2): number;
60
- /** 将点限制在盒子范围内 */
61
- clampPoint(p: Vec2): Vec2;
62
- /** 交集盒 */
63
- intersect(b: Box2): Box2;
64
- /** 近似相等 */
65
- equals(b: Box2, eps?: number): boolean;
66
- /** 序列化为结构对象 */
67
- dump(): IDBBox2;
68
- /** 从结构对象反序列化 */
69
- static load(data: IDBBox2): Box2;
70
- }
71
- //# sourceMappingURL=box2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"box2.d.ts","sourceRoot":"","sources":["../../src/core/box2.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAG7B,qBACa,IAAK,SAAQ,QAAQ;IAC9B,cAAc;IACd,gBAAuB,IAAI,oBAAmB;IAE9C,cAAc;IACd,SAAgB,IAAI,EAAE,MAAM,CAAA;IAC5B,SAAgB,IAAI,EAAE,MAAM,CAAA;IAC5B,SAAgB,IAAI,EAAE,MAAM,CAAA;IAC5B,SAAgB,IAAI,EAAE,MAAM,CAAA;IAE5B,qBAAqB;;gBAET,CAAC,EAAE,IAAI;gBACP,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI;gBACpB,MAAM,EAAE,SAAS,IAAI,EAAE;gBACvB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IA2ClE,SAAS;WACK,KAAK;IAInB,gBAAgB;WACF,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI;IAI7C,YAAY;WACE,UAAU,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE;IAehD,SAAS;IACF,KAAK;IAIZ,YAAY;IACL,OAAO;IAId,aAAa;IACN,QAAQ;IASf,SAAS;IACF,KAAK;IAIZ,SAAS;IACF,MAAM;IAIb,SAAS;IACF,IAAI;IAIX,UAAU;IACH,MAAM;IAQb,YAAY;IACL,aAAa,CAAC,CAAC,EAAE,IAAI;IAU5B,YAAY;IACL,WAAW,CAAC,CAAC,EAAE,IAAI;IAU1B,WAAW;IACJ,UAAU,CAAC,CAAC,EAAE,IAAI;IAUzB,aAAa;IACN,aAAa,CAAC,CAAC,EAAE,IAAI;IAY5B,YAAY;IACL,cAAc,CAAC,CAAC,EAAE,MAAM;IAU/B,UAAU;IACH,KAAK,CAAC,CAAC,EAAE,IAAI;IAWpB,SAAS;IACF,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAUvC,gBAAgB;IACT,SAAS,CAAC,CAAC,EAAE,IAAI;IAaxB,gBAAgB;IACT,WAAW,CAAC,CAAC,EAAE,IAAI;IAI1B,gBAAgB;IACT,eAAe,CAAC,CAAC,EAAE,IAAI;IAW9B,iBAAiB;IACV,UAAU,CAAC,CAAC,EAAE,IAAI;IAOzB,UAAU;IACH,SAAS,CAAC,CAAC,EAAE,IAAI;IASxB,WAAW;IACJ,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,SAAgB;IAW1C,eAAe;IACR,IAAI,IAAI,OAAO;IAUtB,gBAAgB;WACF,IAAI,CAAC,IAAI,EAAE,OAAO;CAGnC"}
package/dist/core/box2.js DELETED
@@ -1,243 +0,0 @@
1
- /*
2
- * Linea Math - Core
3
- * Box2:二维轴对齐包围盒(AABB),不可变设计
4
- */
5
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
6
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10
- };
11
- var Box2_1;
12
- import { GeomBase } from './geom_base';
13
- import { EN_GEO_TYPE } from '../constants/geom_type';
14
- import { RegisterGeom } from '../serialize/geom_mgr';
15
- import { Vec2 } from './vec2';
16
- import { Precision } from '../utils/precision';
17
- let Box2 = Box2_1 = class Box2 extends GeomBase {
18
- constructor(a0, a1, a2, a3) {
19
- super();
20
- if (a0 instanceof Box2_1) {
21
- this.minX = a0.minX;
22
- this.minY = a0.minY;
23
- this.maxX = a0.maxX;
24
- this.maxY = a0.maxY;
25
- return;
26
- }
27
- if (a0 instanceof Vec2 && a1 instanceof Vec2) {
28
- this.minX = a0.x;
29
- this.minY = a0.y;
30
- this.maxX = a1.x;
31
- this.maxY = a1.y;
32
- return;
33
- }
34
- if (Array.isArray(a0)) {
35
- const b = Box2_1.fromPoints(a0);
36
- this.minX = b.minX;
37
- this.minY = b.minY;
38
- this.maxX = b.maxX;
39
- this.maxY = b.maxY;
40
- return;
41
- }
42
- const minX = typeof a0 === 'number' ? a0 : Infinity;
43
- const minY = typeof a1 === 'number' ? a1 : Infinity;
44
- const maxX = typeof a2 === 'number' ? a2 : -Infinity;
45
- const maxY = typeof a3 === 'number' ? a3 : -Infinity;
46
- this.minX = minX;
47
- this.minY = minY;
48
- this.maxX = maxX;
49
- this.maxY = maxY;
50
- }
51
- /** 空盒 */
52
- static empty() {
53
- return new Box2_1();
54
- }
55
- /** 由最小/最大点创建 */
56
- static fromMinMax(min, max) {
57
- return new Box2_1(min.x, min.y, max.x, max.y);
58
- }
59
- /** 由点集创建 */
60
- static fromPoints(points) {
61
- if (points.length === 0)
62
- return Box2_1.empty();
63
- let minX = Infinity;
64
- let minY = Infinity;
65
- let maxX = -Infinity;
66
- let maxY = -Infinity;
67
- for (const p of points) {
68
- if (p.x < minX)
69
- minX = p.x;
70
- if (p.y < minY)
71
- minY = p.y;
72
- if (p.x > maxX)
73
- maxX = p.x;
74
- if (p.y > maxY)
75
- maxY = p.y;
76
- }
77
- return new Box2_1(minX, minY, maxX, maxY);
78
- }
79
- /** 克隆 */
80
- clone() {
81
- return new Box2_1(this.minX, this.minY, this.maxX, this.maxY);
82
- }
83
- /** 是否为空盒 */
84
- isEmpty() {
85
- return this.minX > this.maxX || this.minY > this.maxY;
86
- }
87
- /** 是否为有限数 */
88
- isFinite() {
89
- return (Number.isFinite(this.minX) &&
90
- Number.isFinite(this.minY) &&
91
- Number.isFinite(this.maxX) &&
92
- Number.isFinite(this.maxY));
93
- }
94
- /** 宽度 */
95
- width() {
96
- return this.isEmpty() ? 0 : this.maxX - this.minX;
97
- }
98
- /** 高度 */
99
- height() {
100
- return this.isEmpty() ? 0 : this.maxY - this.minY;
101
- }
102
- /** 尺寸 */
103
- size() {
104
- return new Vec2(this.width(), this.height());
105
- }
106
- /** 中心点 */
107
- center() {
108
- if (this.isEmpty())
109
- return Vec2.zero();
110
- return new Vec2((this.minX + this.maxX) / 2, (this.minY + this.maxY) / 2);
111
- }
112
- /** 是否包含点 */
113
- containsPoint(v) {
114
- if (this.isEmpty())
115
- return false;
116
- return (v.x >= this.minX &&
117
- v.x <= this.maxX &&
118
- v.y >= this.minY &&
119
- v.y <= this.maxY);
120
- }
121
- /** 是否包含盒 */
122
- containsBox(b) {
123
- if (this.isEmpty() || b.isEmpty())
124
- return false;
125
- return (b.minX >= this.minX &&
126
- b.maxX <= this.maxX &&
127
- b.minY >= this.minY &&
128
- b.maxY <= this.maxY);
129
- }
130
- /** 是否相交 */
131
- intersects(b) {
132
- if (this.isEmpty() || b.isEmpty())
133
- return false;
134
- return (b.maxX >= this.minX &&
135
- b.minX <= this.maxX &&
136
- b.maxY >= this.minY &&
137
- b.minY <= this.maxY);
138
- }
139
- /** 扩展以包含点 */
140
- expandByPoint(v) {
141
- if (this.isEmpty()) {
142
- return new Box2_1(v.x, v.y, v.x, v.y);
143
- }
144
- return new Box2_1(Math.min(this.minX, v.x), Math.min(this.minY, v.y), Math.max(this.maxX, v.x), Math.max(this.maxY, v.y));
145
- }
146
- /** 按标量扩展 */
147
- expandByScalar(s) {
148
- if (this.isEmpty())
149
- return this.clone();
150
- return new Box2_1(this.minX - s, this.minY - s, this.maxX + s, this.maxY + s);
151
- }
152
- /** 合并盒 */
153
- union(b) {
154
- if (this.isEmpty())
155
- return b.clone();
156
- if (b.isEmpty())
157
- return this.clone();
158
- return new Box2_1(Math.min(this.minX, b.minX), Math.min(this.minY, b.minY), Math.max(this.maxX, b.maxX), Math.max(this.maxY, b.maxY));
159
- }
160
- /** 平移 */
161
- translate(dx, dy) {
162
- if (this.isEmpty())
163
- return this.clone();
164
- return new Box2_1(this.minX + dx, this.minY + dy, this.maxX + dx, this.maxY + dy);
165
- }
166
- /** 变换(返回新对象) */
167
- transform(m) {
168
- if (this.isEmpty())
169
- return this.clone();
170
- const p1 = m.transformedPoint(new Vec2(this.minX, this.minY));
171
- const p2 = m.transformedPoint(new Vec2(this.minX, this.maxY));
172
- const p3 = m.transformedPoint(new Vec2(this.maxX, this.minY));
173
- const p4 = m.transformedPoint(new Vec2(this.maxX, this.maxY));
174
- const minX = Math.min(p1.x, p2.x, p3.x, p4.x);
175
- const minY = Math.min(p1.y, p2.y, p3.y, p4.y);
176
- const maxX = Math.max(p1.x, p2.x, p3.x, p4.x);
177
- const maxY = Math.max(p1.y, p2.y, p3.y, p4.y);
178
- return new Box2_1(minX, minY, maxX, maxY);
179
- }
180
- /** 变换(返回新对象) */
181
- transformed(m) {
182
- return this.transform(m);
183
- }
184
- /** 点到盒子的最短距离 */
185
- distanceToPoint(p) {
186
- if (this.isEmpty())
187
- return Infinity;
188
- const dx = p.x < this.minX ? this.minX - p.x :
189
- p.x > this.maxX ? p.x - this.maxX : 0;
190
- const dy = p.y < this.minY ? this.minY - p.y :
191
- p.y > this.maxY ? p.y - this.maxY : 0;
192
- return Math.hypot(dx, dy);
193
- }
194
- /** 将点限制在盒子范围内 */
195
- clampPoint(p) {
196
- if (this.isEmpty())
197
- return p.clone();
198
- const x = Math.min(this.maxX, Math.max(this.minX, p.x));
199
- const y = Math.min(this.maxY, Math.max(this.minY, p.y));
200
- return new Vec2(x, y);
201
- }
202
- /** 交集盒 */
203
- intersect(b) {
204
- if (this.isEmpty() || b.isEmpty())
205
- return Box2_1.empty();
206
- const minX = Math.max(this.minX, b.minX);
207
- const minY = Math.max(this.minY, b.minY);
208
- const maxX = Math.min(this.maxX, b.maxX);
209
- const maxY = Math.min(this.maxY, b.maxY);
210
- return minX > maxX || minY > maxY ? Box2_1.empty() : new Box2_1(minX, minY, maxX, maxY);
211
- }
212
- /** 近似相等 */
213
- equals(b, eps = Precision.EPS) {
214
- if (this.isEmpty() && b.isEmpty())
215
- return true;
216
- if (this.isEmpty() || b.isEmpty())
217
- return false;
218
- return (Precision.equal(this.minX, b.minX, eps) &&
219
- Precision.equal(this.minY, b.minY, eps) &&
220
- Precision.equal(this.maxX, b.maxX, eps) &&
221
- Precision.equal(this.maxY, b.maxY, eps));
222
- }
223
- /** 序列化为结构对象 */
224
- dump() {
225
- return {
226
- type: Box2_1.type,
227
- minX: this.minX,
228
- minY: this.minY,
229
- maxX: this.maxX,
230
- maxY: this.maxY,
231
- };
232
- }
233
- /** 从结构对象反序列化 */
234
- static load(data) {
235
- return new Box2_1(data.minX, data.minY, data.maxX, data.maxY);
236
- }
237
- };
238
- /** 序列化类型标识 */
239
- Box2.type = EN_GEO_TYPE.Box2;
240
- Box2 = Box2_1 = __decorate([
241
- RegisterGeom
242
- ], Box2);
243
- export { Box2 };
@@ -1,62 +0,0 @@
1
- import { GeomBase } from './geom_base';
2
- import { EN_GEO_TYPE } from '../constants/geom_type';
3
- import type { IDBCoord2D } from '../serialize/dump_types';
4
- import { Vec2 } from './vec2';
5
- import { Mat3 } from './mat3';
6
- export declare class Coord2D extends GeomBase {
7
- /** 序列化类型标识 */
8
- static readonly type = EN_GEO_TYPE.Coord2D;
9
- /** 原点 */
10
- private _origin;
11
- /** X 轴基向量(世界坐标) */
12
- private _xAxis;
13
- /** Y 轴基向量(世界坐标) */
14
- private _yAxis;
15
- /** 创建坐标系 */
16
- constructor();
17
- constructor(c: Coord2D);
18
- constructor(m: Mat3);
19
- constructor(origin: Vec2, xAxis?: Vec2, yAxis?: Vec2);
20
- /** 克隆 */
21
- clone(): Coord2D;
22
- /** 获取原点 */
23
- getOrigin(): Vec2;
24
- /** 获取 X 轴方向 */
25
- getDx(): Vec2;
26
- /** 获取 Y 轴方向 */
27
- getDy(): Vec2;
28
- /** 是否为可用基(不退化) */
29
- isValid(eps?: number): boolean;
30
- /** 坐标系近似相等 */
31
- equals(c: Coord2D, eps?: number): boolean;
32
- /** 局部坐标 -> 世界坐标 */
33
- toWorld(p: Vec2): Vec2;
34
- /** 世界坐标 -> 局部坐标 */
35
- toLocal(p: Vec2, eps?: number): Vec2;
36
- /** 转为变换矩阵(列向量 + 右乘约定) */
37
- toMat3(): Mat3;
38
- /** 变换坐标系(就地修改) */
39
- transform(m: Mat3): this;
40
- /** 变换坐标系(返回新对象) */
41
- transformed(m: Mat3): Coord2D;
42
- /**
43
- * 逆坐标系(世界 <-> 局部)
44
- * - 用于把世界坐标转换为该坐标系的局部坐标
45
- */
46
- inverse(eps?: number): Coord2D;
47
- /** 设置原点(就地修改) */
48
- setOrigin(origin: Vec2): this;
49
- /** 设置 X 轴(就地修改) */
50
- setXAxis(xAxis: Vec2): this;
51
- /** 设置 Y 轴(就地修改) */
52
- setYAxis(yAxis: Vec2): this;
53
- /** 获取缩放(轴长度) */
54
- getScale(): Vec2;
55
- /** 设置缩放(保持轴方向不变) */
56
- setScale(sx: number, sy: number, eps?: number): this;
57
- /** 序列化为结构对象 */
58
- dump(): IDBCoord2D;
59
- /** 从结构对象反序列化 */
60
- static load(data: IDBCoord2D): Coord2D;
61
- }
62
- //# sourceMappingURL=coord2d.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coord2d.d.ts","sourceRoot":"","sources":["../../src/core/coord2d.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAI7B,qBACa,OAAQ,SAAQ,QAAQ;IACjC,cAAc;IACd,gBAAuB,IAAI,uBAAsB;IAEjD,SAAS;IACT,OAAO,CAAC,OAAO,CAAM;IAErB,mBAAmB;IACnB,OAAO,CAAC,MAAM,CAAM;IAEpB,mBAAmB;IACnB,OAAO,CAAC,MAAM,CAAM;IAEpB,YAAY;;gBAEA,CAAC,EAAE,OAAO;gBACV,CAAC,EAAE,IAAI;gBACP,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,IAAI;IA6BpD,SAAS;IACF,KAAK;IAIZ,WAAW;IACJ,SAAS;IAIhB,eAAe;IACR,KAAK;IAIZ,eAAe;IACR,KAAK;IAIZ,kBAAkB;IACX,OAAO,CAAC,GAAG,SAAoB;IAKtC,cAAc;IACP,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,SAAgB;IAQ7C,mBAAmB;IACZ,OAAO,CAAC,CAAC,EAAE,IAAI;IAMtB,mBAAmB;IACZ,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,SAAoB;IAa/C,yBAAyB;IAClB,MAAM;IAQb,kBAAkB;IACX,SAAS,CAAC,CAAC,EAAE,IAAI;IAOxB,mBAAmB;IACZ,WAAW,CAAC,CAAC,EAAE,IAAI;IAI1B;;;OAGG;IACI,OAAO,CAAC,GAAG,SAAoB;IAKtC,iBAAiB;IACV,SAAS,CAAC,MAAM,EAAE,IAAI;IAK7B,mBAAmB;IACZ,QAAQ,CAAC,KAAK,EAAE,IAAI;IAK3B,mBAAmB;IACZ,QAAQ,CAAC,KAAK,EAAE,IAAI;IAK3B,gBAAgB;IACT,QAAQ;IAIf,oBAAoB;IACb,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,SAAoB;IAM/D,eAAe;IACR,IAAI,IAAI,UAAU;IASzB,gBAAgB;WACF,IAAI,CAAC,IAAI,EAAE,UAAU;CAOtC"}
@@ -1,155 +0,0 @@
1
- /*
2
- * Linea Math - Core
3
- * Coord2D: 2D 坐标系(原点 + 基向量),不可变
4
- */
5
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
6
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
- return c > 3 && r && Object.defineProperty(target, key, r), r;
10
- };
11
- var Coord2D_1;
12
- import { GeomBase } from './geom_base';
13
- import { EN_GEO_TYPE } from '../constants/geom_type';
14
- import { RegisterGeom } from '../serialize/geom_mgr';
15
- import { Vec2 } from './vec2';
16
- import { Mat3 } from './mat3';
17
- import { Precision } from '../utils/precision';
18
- import { MathError } from '../utils/math_error';
19
- let Coord2D = Coord2D_1 = class Coord2D extends GeomBase {
20
- constructor(a0, a1, a2) {
21
- super();
22
- if (a0 instanceof Coord2D_1) {
23
- this._origin = a0._origin;
24
- this._xAxis = a0._xAxis;
25
- this._yAxis = a0._yAxis;
26
- return;
27
- }
28
- if (a0 instanceof Mat3) {
29
- const e = a0.toArray();
30
- this._origin = new Vec2(e[2], e[5]);
31
- this._xAxis = new Vec2(e[0], e[3]);
32
- this._yAxis = new Vec2(e[1], e[4]);
33
- return;
34
- }
35
- const origin = a0 ?? Vec2.zero();
36
- const xAxis = a1 ?? Vec2.unitX();
37
- const yAxis = a2 ?? xAxis.perped();
38
- this._origin = origin;
39
- this._xAxis = xAxis;
40
- this._yAxis = yAxis;
41
- }
42
- /** 克隆 */
43
- clone() {
44
- return new Coord2D_1(this._origin, this._xAxis, this._yAxis);
45
- }
46
- /** 获取原点 */
47
- getOrigin() {
48
- return this._origin;
49
- }
50
- /** 获取 X 轴方向 */
51
- getDx() {
52
- return this._xAxis;
53
- }
54
- /** 获取 Y 轴方向 */
55
- getDy() {
56
- return this._yAxis;
57
- }
58
- /** 是否为可用基(不退化) */
59
- isValid(eps = Precision.LEN_EPS) {
60
- const det = this._xAxis.cross(this._yAxis);
61
- return Math.abs(det) > eps;
62
- }
63
- /** 坐标系近似相等 */
64
- equals(c, eps = Precision.EPS) {
65
- return (this._origin.equals(c._origin, eps) &&
66
- this._xAxis.equals(c._xAxis, eps) &&
67
- this._yAxis.equals(c._yAxis, eps));
68
- }
69
- /** 局部坐标 -> 世界坐标 */
70
- toWorld(p) {
71
- return this._origin
72
- .added(this._xAxis.scaled(p.x))
73
- .added(this._yAxis.scaled(p.y));
74
- }
75
- /** 世界坐标 -> 局部坐标 */
76
- toLocal(p, eps = Precision.LEN_EPS) {
77
- const dx = p.x - this._origin.x;
78
- const dy = p.y - this._origin.y;
79
- const det = this._xAxis.cross(this._yAxis);
80
- if (Math.abs(det) <= eps) {
81
- MathError.throw('Coord2D.toLocal: basis is degenerate');
82
- }
83
- const invDet = 1 / det;
84
- const x = (dx * this._yAxis.y - dy * this._yAxis.x) * invDet;
85
- const y = (dy * this._xAxis.x - dx * this._xAxis.y) * invDet;
86
- return new Vec2(x, y);
87
- }
88
- /** 转为变换矩阵(列向量 + 右乘约定) */
89
- toMat3() {
90
- return new Mat3(this._xAxis.x, this._yAxis.x, this._origin.x, this._xAxis.y, this._yAxis.y, this._origin.y, 0, 0, 1);
91
- }
92
- /** 变换坐标系(就地修改) */
93
- transform(m) {
94
- this._origin = this._origin.clone().applyMat3(m);
95
- this._xAxis = m.transformedVector(this._xAxis);
96
- this._yAxis = m.transformedVector(this._yAxis);
97
- return this;
98
- }
99
- /** 变换坐标系(返回新对象) */
100
- transformed(m) {
101
- return this.clone().transform(m);
102
- }
103
- /**
104
- * 逆坐标系(世界 <-> 局部)
105
- * - 用于把世界坐标转换为该坐标系的局部坐标
106
- */
107
- inverse(eps = Precision.LEN_EPS) {
108
- const inv = this.toMat3().inverted(eps);
109
- return new Coord2D_1(inv);
110
- }
111
- /** 设置原点(就地修改) */
112
- setOrigin(origin) {
113
- this._origin = origin;
114
- return this;
115
- }
116
- /** 设置 X 轴(就地修改) */
117
- setXAxis(xAxis) {
118
- this._xAxis = xAxis;
119
- return this;
120
- }
121
- /** 设置 Y 轴(就地修改) */
122
- setYAxis(yAxis) {
123
- this._yAxis = yAxis;
124
- return this;
125
- }
126
- /** 获取缩放(轴长度) */
127
- getScale() {
128
- return new Vec2(this._xAxis.len(), this._yAxis.len());
129
- }
130
- /** 设置缩放(保持轴方向不变) */
131
- setScale(sx, sy, eps = Precision.LEN_EPS) {
132
- this._xAxis = this._xAxis.clone().setLength(sx, eps);
133
- this._yAxis = this._yAxis.clone().setLength(sy, eps);
134
- return this;
135
- }
136
- /** 序列化为结构对象 */
137
- dump() {
138
- return {
139
- type: Coord2D_1.type,
140
- origin: { x: this._origin.x, y: this._origin.y },
141
- xAxis: { x: this._xAxis.x, y: this._xAxis.y },
142
- yAxis: { x: this._yAxis.x, y: this._yAxis.y },
143
- };
144
- }
145
- /** 从结构对象反序列化 */
146
- static load(data) {
147
- return new Coord2D_1(new Vec2(data.origin.x, data.origin.y), new Vec2(data.xAxis.x, data.xAxis.y), new Vec2(data.yAxis.x, data.yAxis.y));
148
- }
149
- };
150
- /** 序列化类型标识 */
151
- Coord2D.type = EN_GEO_TYPE.Coord2D;
152
- Coord2D = Coord2D_1 = __decorate([
153
- RegisterGeom
154
- ], Coord2D);
155
- export { Coord2D };
@@ -1,19 +0,0 @@
1
- import type { IDB } from '../serialize/dump_types';
2
- import type { IDumpable } from '../serialize/geom_mgr';
3
- import type { Ctor } from '../types/type_guard';
4
- export interface IGeom extends IDumpable {
5
- getType(): string;
6
- clone(): IGeom;
7
- }
8
- export declare abstract class GeomBase implements IGeom {
9
- abstract dump(): IDB;
10
- abstract clone(): IGeom;
11
- /** 获取实例类型标识 */
12
- getType(): string;
13
- /**
14
- * 运行时类型守卫:判断当前实例是否为目标构造器类型。
15
- * 使用后可触发 TypeScript 类型收窄。
16
- */
17
- isType<T extends GeomBase>(ctor: Ctor<T>): this is T;
18
- }
19
- //# sourceMappingURL=geom_base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"geom_base.d.ts","sourceRoot":"","sources":["../../src/core/geom_base.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,uBAAuB,CAAA;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAE/C,MAAM,WAAW,KAAM,SAAQ,SAAS;IACpC,OAAO,IAAI,MAAM,CAAA;IACjB,KAAK,IAAI,KAAK,CAAA;CACjB;AAED,8BAAsB,QAAS,YAAW,KAAK;aAC3B,IAAI,IAAI,GAAG;aACX,KAAK,IAAI,KAAK;IAE9B,eAAe;IACR,OAAO;IAKd;;;OAGG;IACI,MAAM,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC;CAG9D"}
@@ -1,18 +0,0 @@
1
- /*
2
- * Linea Math - Core
3
- * 几何基类:统一序列化协议
4
- */
5
- export class GeomBase {
6
- /** 获取实例类型标识 */
7
- getType() {
8
- const ctor = this.constructor;
9
- return ctor.type;
10
- }
11
- /**
12
- * 运行时类型守卫:判断当前实例是否为目标构造器类型。
13
- * 使用后可触发 TypeScript 类型收窄。
14
- */
15
- isType(ctor) {
16
- return this instanceof ctor;
17
- }
18
- }