@ccpc/math 0.1.0 → 0.1.7

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/dist/core/vec2.js DELETED
@@ -1,297 +0,0 @@
1
- /*
2
- * Linea Math - Core
3
- * Vec2:二维向量,采用不可变设计,支持链式调用。
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 Vec2_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 { Precision } from '../utils/precision';
16
- let Vec2 = Vec2_1 = class Vec2 extends GeomBase {
17
- constructor(xOrObj = 0, y = 0) {
18
- super();
19
- if (typeof xOrObj === 'number') {
20
- this.x = xOrObj;
21
- this.y = y;
22
- }
23
- else {
24
- this.x = xOrObj.x;
25
- this.y = xOrObj.y;
26
- }
27
- }
28
- /** 零向量 */
29
- static zero() {
30
- return new Vec2_1(0, 0);
31
- }
32
- /** 单位向量 X */
33
- static unitX() {
34
- return new Vec2_1(1, 0);
35
- }
36
- /** 单位向量 Y */
37
- static unitY() {
38
- return new Vec2_1(0, 1);
39
- }
40
- /** 克隆当前向量 */
41
- clone() {
42
- return new Vec2_1(this.x, this.y);
43
- }
44
- /** 返回替换 X 分量的新向量 */
45
- withX(x) {
46
- return new Vec2_1(x, this.y);
47
- }
48
- /** 返回替换 Y 分量的新向量 */
49
- withY(y) {
50
- return new Vec2_1(this.x, y);
51
- }
52
- /** 设置 X 分量(就地修改) */
53
- setX(x) {
54
- this.x = x;
55
- return this;
56
- }
57
- /** 设置 Y 分量(就地修改) */
58
- setY(y) {
59
- this.y = y;
60
- return this;
61
- }
62
- /** 向量相加(就地修改) */
63
- add(v) {
64
- this.x += v.x;
65
- this.y += v.y;
66
- return this;
67
- }
68
- /** 向量相加(返回新对象) */
69
- added(v) {
70
- return this.clone().add(v);
71
- }
72
- /** 向量相减(就地修改) */
73
- subtract(v) {
74
- this.x -= v.x;
75
- this.y -= v.y;
76
- return this;
77
- }
78
- /** 向量相减(返回新对象) */
79
- subtracted(v) {
80
- return this.clone().subtract(v);
81
- }
82
- /**
83
- * 向量线性叠加:this + v * s
84
- * - 常用于积分、插值、偏移等计算
85
- */
86
- addScaled(v, s) {
87
- this.x += v.x * s;
88
- this.y += v.y * s;
89
- return this;
90
- }
91
- /** 向量线性叠加(返回新对象) */
92
- addScaleded(v, s) {
93
- return this.clone().addScaled(v, s);
94
- }
95
- /** 反向量(取相反方向) */
96
- negate() {
97
- this.x = -this.x;
98
- this.y = -this.y;
99
- return this;
100
- }
101
- /** 反向量(返回新对象) */
102
- negated() {
103
- return this.clone().negate();
104
- }
105
- /**
106
- * 绕原点旋转(弧度)
107
- * - 逆时针为正方向
108
- */
109
- rotate(rad) {
110
- const c = Math.cos(rad);
111
- const s = Math.sin(rad);
112
- const x = this.x * c - this.y * s;
113
- const y = this.x * s + this.y * c;
114
- this.x = x;
115
- this.y = y;
116
- return this;
117
- }
118
- /** 绕原点旋转(返回新对象) */
119
- rotated(rad) {
120
- return this.clone().rotate(rad);
121
- }
122
- /**
123
- * 绕指定点旋转(弧度)
124
- * - 先平移到原点旋转,再平移回去
125
- */
126
- rotateAround(center, rad) {
127
- const x = this.x - center.x;
128
- const y = this.y - center.y;
129
- const c = Math.cos(rad);
130
- const s = Math.sin(rad);
131
- this.x = x * c - y * s + center.x;
132
- this.y = x * s + y * c + center.y;
133
- return this;
134
- }
135
- /**
136
- * 垂直向量(默认逆时针 90°)
137
- * - (x, y) -> (-y, x)
138
- * - 若需顺时针方向,可对结果取反
139
- */
140
- perp() {
141
- const x = -this.y;
142
- const y = this.x;
143
- this.x = x;
144
- this.y = y;
145
- return this;
146
- }
147
- /** 垂直向量(返回新对象) */
148
- perped() {
149
- return this.clone().perp();
150
- }
151
- /** 标量缩放 */
152
- scale(s) {
153
- this.x *= s;
154
- this.y *= s;
155
- return this;
156
- }
157
- /** 标量缩放(返回新对象) */
158
- scaled(s) {
159
- return this.clone().scale(s);
160
- }
161
- /** 点积 */
162
- dot(v) {
163
- return this.x * v.x + this.y * v.y;
164
- }
165
- /** 叉积(返回标量) */
166
- cross(v) {
167
- return this.x * v.y - this.y * v.x;
168
- }
169
- /** 长度平方 */
170
- lenSq() {
171
- return this.x * this.x + this.y * this.y;
172
- }
173
- /** 向量长度 */
174
- len() {
175
- return Math.hypot(this.x, this.y);
176
- }
177
- /**
178
- * 设置向量长度(保持方向)
179
- * - 零向量返回零向量
180
- */
181
- setLength(len, eps = Precision.LEN_EPS) {
182
- const l = this.len();
183
- if (l < eps) {
184
- this.x = 0;
185
- this.y = 0;
186
- return this;
187
- }
188
- return this.scale(len / l);
189
- }
190
- /** 设置向量长度(返回新对象) */
191
- setLengthed(len, eps = Precision.LEN_EPS) {
192
- return this.clone().setLength(len, eps);
193
- }
194
- /** 归一化,极短向量返回零向量 */
195
- normalize(eps = Precision.LEN_EPS) {
196
- const l = this.len();
197
- if (l < eps) {
198
- this.x = 0;
199
- this.y = 0;
200
- return this;
201
- }
202
- return this.scale(1 / l);
203
- }
204
- /** 归一化(返回新对象) */
205
- normalized(eps = Precision.LEN_EPS) {
206
- return this.clone().normalize(eps);
207
- }
208
- /**
209
- * 应用 Mat3 变换(就地修改)
210
- */
211
- applyMat3(m) {
212
- return m.transformPoint(this);
213
- }
214
- /** 应用 Mat3 变换(返回新对象) */
215
- appliedMat3(m) {
216
- return this.clone().applyMat3(m);
217
- }
218
- /** 到目标向量的距离 */
219
- distanceTo(v) {
220
- return Math.hypot(this.x - v.x, this.y - v.y);
221
- }
222
- /** 到目标向量的距离平方(避免开方,更高效) */
223
- distanceToSq(v) {
224
- const dx = this.x - v.x;
225
- const dy = this.y - v.y;
226
- return dx * dx + dy * dy;
227
- }
228
- /**
229
- * 向量投影(投影到目标向量上)
230
- * - 若目标向量为零向量,则返回零向量
231
- * - 结果与目标向量共线
232
- */
233
- project(on, eps = Precision.LEN_EPS) {
234
- const denom = on.lenSq();
235
- if (Precision.nearlyZeroSq(denom, eps)) {
236
- this.x = 0;
237
- this.y = 0;
238
- return this;
239
- }
240
- const scale = this.dot(on) / denom;
241
- this.x = on.x * scale;
242
- this.y = on.y * scale;
243
- return this;
244
- }
245
- /** 向量投影(返回新对象) */
246
- projected(on, eps = Precision.LEN_EPS) {
247
- return this.clone().project(on, eps);
248
- }
249
- /**
250
- * 返回向量的方向角(弧度)
251
- * - 相对于 +X 轴的角度
252
- * - 结果范围为 [-PI, PI]
253
- */
254
- angle() {
255
- return Math.atan2(this.y, this.x);
256
- }
257
- /** 线性插值 */
258
- lerp(v, t) {
259
- return new Vec2_1(this.x + (v.x - this.x) * t, this.y + (v.y - this.y) * t);
260
- }
261
- /**
262
- * 计算当前向量到目标向量的夹角(弧度)
263
- * - 结果范围为 [-PI, PI]
264
- * - 使用 atan2(cross, dot),保留方向(顺时针/逆时针)
265
- */
266
- angleTo(v) {
267
- const dot = this.dot(v);
268
- const det = this.cross(v);
269
- return Math.atan2(det, dot);
270
- }
271
- /** 判断分量是否为有限数 */
272
- isFinite() {
273
- return Number.isFinite(this.x) && Number.isFinite(this.y);
274
- }
275
- /** 判断是否近似相等 */
276
- equals(v, eps = Precision.EPS) {
277
- return Precision.equal(this.x, v.x, eps) && Precision.equal(this.y, v.y, eps);
278
- }
279
- /** 转为元组 */
280
- toArray() {
281
- return [this.x, this.y];
282
- }
283
- /** 序列化为结构对象 */
284
- dump() {
285
- return { type: Vec2_1.type, x: this.x, y: this.y };
286
- }
287
- /** 从结构对象反序列化 */
288
- static load(data) {
289
- return new Vec2_1(data.x, data.y);
290
- }
291
- };
292
- /** 序列化类型标识 */
293
- Vec2.type = EN_GEO_TYPE.Vec2;
294
- Vec2 = Vec2_1 = __decorate([
295
- RegisterGeom
296
- ], Vec2);
297
- export { Vec2 };
@@ -1,49 +0,0 @@
1
- import { EN_GEO_TYPE } from '../constants/geom_type';
2
- import { Box2 } from '../core/box2';
3
- import { Mat3 } from '../core/mat3';
4
- import { Vec2 } from '../core/vec2';
5
- import type { IDBArc2 } from '../serialize/dump_types';
6
- import type { IClosestPointResult } from '../types/type_define';
7
- import { CircleCurve2 } from './circle_curve2';
8
- import { Interval } from './interval';
9
- export declare class Arc2 extends CircleCurve2 {
10
- static readonly type = EN_GEO_TYPE.Arc2;
11
- private _clockwise;
12
- constructor(center: Vec2, radius: number, startAngle: number, endAngle: number, clockwise?: boolean);
13
- get clockwise(): boolean;
14
- get startAngle(): number;
15
- get endAngle(): number;
16
- pointAt(u: number): Vec2;
17
- tangentAt(u: number): Vec2;
18
- derivatives(u: number, n: number): Vec2[];
19
- curvatureAt(u: number): number;
20
- length(range?: Interval): number;
21
- lengthAtParam(u: number): number;
22
- paramAtLength(s: number, tol?: number): number;
23
- split(u: number): Arc2[];
24
- trim(range: Interval): Arc2[];
25
- reverse(): this;
26
- transform(m: Mat3): this;
27
- transformed(m: Mat3): this;
28
- closestPoint(p: Vec2): IClosestPointResult;
29
- boundingBox(): Box2;
30
- isValid(eps?: number): boolean;
31
- isClosed(): boolean;
32
- isArc(): this is Arc2;
33
- /**
34
- * 结构等价判断(字段级)。
35
- * @param other 对比圆弧。
36
- * @param eps 数值容差。
37
- * @returns 圆心、半径、方向和起终角参数近似相等时返回 `true`。
38
- */
39
- equals(other: Arc2, eps?: number): boolean;
40
- clone(): this;
41
- dump(): IDBArc2;
42
- static load(data: IDBArc2): Arc2;
43
- private angleAtParam;
44
- private paramFromAngle;
45
- private resetAngles;
46
- private normalizeAngle;
47
- private positiveMod;
48
- }
49
- //# sourceMappingURL=arc2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arc2.d.ts","sourceRoot":"","sources":["../../src/curves/arc2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAG/D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGrC,qBACa,IAAK,SAAQ,YAAY;IAClC,gBAAuB,IAAI,oBAAmB;IAE9C,OAAO,CAAC,UAAU,CAAS;gBAEf,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,UAAQ;IAOjG,IAAW,SAAS,YAEnB;IAED,IAAW,UAAU,WAEpB;IAED,IAAW,QAAQ,WAMlB;IAEe,OAAO,CAAC,CAAC,EAAE,MAAM;IAIjB,SAAS,CAAC,CAAC,EAAE,MAAM;IAMnB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAYhC,WAAW,CAAC,CAAC,EAAE,MAAM;IAKrB,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ;IAMvB,aAAa,CAAC,CAAC,EAAE,MAAM;IAKvB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,SAA6B;IAQzD,KAAK,CAAC,CAAC,EAAE,MAAM;IAUf,IAAI,CAAC,KAAK,EAAE,QAAQ;IAUpB,OAAO;IAOP,SAAS,CAAC,CAAC,EAAE,IAAI;IAiCjB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI;IAI1B,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,mBAAmB;IAgD1C,WAAW;IAiBX,OAAO,CAAC,GAAG,SAA6B;IAIxC,QAAQ,IAAI,OAAO;IAInB,KAAK,IAAI,IAAI,IAAI,IAAI;IAIrC;;;;;OAKG;IACI,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,SAAgB;IAQ9B,KAAK,IAAI,IAAI;IAIb,IAAI,IAAI,OAAO;WAWjB,IAAI,CAAC,IAAI,EAAE,OAAO;IAUhC,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,WAAW;CAItB"}
@@ -1,265 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- 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;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var Arc2_1;
8
- import { EN_GEO_TYPE } from '../constants/geom_type';
9
- import { MathConst } from '../constants/math_const';
10
- import { Box2 } from '../core/box2';
11
- import { Vec2 } from '../core/vec2';
12
- import { RegisterGeom } from '../serialize/geom_mgr';
13
- import { MathError } from '../utils/math_error';
14
- import { Precision } from '../utils/precision';
15
- import { CircleCurve2 } from './circle_curve2';
16
- import { PeriodInterval } from './period_interval';
17
- let Arc2 = Arc2_1 = class Arc2 extends CircleCurve2 {
18
- constructor(center, radius, startAngle, endAngle, clockwise = false) {
19
- super(center, radius);
20
- MathError.assert(Number.isFinite(startAngle) && Number.isFinite(endAngle), 'Arc2: startAngle/endAngle must be finite');
21
- this._clockwise = clockwise;
22
- this.resetAngles(startAngle, endAngle, clockwise);
23
- }
24
- get clockwise() {
25
- return this._clockwise;
26
- }
27
- get startAngle() {
28
- return this.normalizeAngle(this._range.start);
29
- }
30
- get endAngle() {
31
- const sweep = this._range.length();
32
- const end = this._clockwise
33
- ? this._range.start - sweep
34
- : this._range.start + sweep;
35
- return this.normalizeAngle(end);
36
- }
37
- pointAt(u) {
38
- return this.pointAtAngle(this.angleAtParam(u));
39
- }
40
- tangentAt(u) {
41
- const theta = this.angleAtParam(u);
42
- const sign = this._clockwise ? -1 : 1;
43
- return this.derivativeAtAngle(theta, 1, sign);
44
- }
45
- derivatives(u, n) {
46
- MathError.assert(Number.isInteger(n) && n >= 0, 'Arc2.derivatives: n must be a non-negative integer');
47
- const theta = this.angleAtParam(u);
48
- const sign = this._clockwise ? -1 : 1;
49
- const ret = [this.pointAtAngle(theta)];
50
- for (let i = 1; i <= n; i++) {
51
- ret.push(this.derivativeAtAngle(theta, i, sign));
52
- }
53
- return ret;
54
- }
55
- curvatureAt(u) {
56
- this.angleAtParam(u);
57
- return 1 / this._radius;
58
- }
59
- length(range) {
60
- if (!range)
61
- return this._range.length() * this._radius;
62
- this._range.assertContainsRange(range, Precision.CURVE_PARAM_EPS);
63
- return range.length() * this._radius;
64
- }
65
- lengthAtParam(u) {
66
- const uu = this.normalizeParamForEval(u);
67
- return (uu - this._range.start) * this._radius;
68
- }
69
- paramAtLength(s, tol = Precision.CURVE_LENGTH_EPS) {
70
- const total = this.length();
71
- MathError.assert(Number.isFinite(tol) && tol > 0, 'Arc2.paramAtLength: tol must be > 0');
72
- MathError.assert(s >= -tol && s <= total + tol, `Arc2.paramAtLength: s out of range [0, ${total}]`);
73
- const clamped = Math.min(total, Math.max(0, s));
74
- return this._range.start + clamped / this._radius;
75
- }
76
- split(u) {
77
- const pieces = this._range.split(u, Precision.CURVE_PARAM_EPS);
78
- if (pieces.length === 0)
79
- return [];
80
- const theta = this.angleAtParam(u);
81
- const left = new Arc2_1(this._center, this._radius, this.startAngle, theta, this._clockwise);
82
- const right = new Arc2_1(this._center, this._radius, theta, this.endAngle, this._clockwise);
83
- return [left, right].filter((arc) => arc.length() > Precision.CURVE_LENGTH_EPS);
84
- }
85
- trim(range) {
86
- this._range.assertContainsRange(range, Precision.CURVE_PARAM_EPS);
87
- if (range.length() <= Precision.CURVE_PARAM_EPS)
88
- return [];
89
- const s = this.angleAtParam(range.start);
90
- const e = this.angleAtParam(range.end);
91
- const arc = new Arc2_1(this._center, this._radius, s, e, this._clockwise);
92
- return arc.length() <= Precision.CURVE_LENGTH_EPS ? [] : [arc];
93
- }
94
- reverse() {
95
- const s = this.startAngle;
96
- const e = this.endAngle;
97
- this.resetAngles(e, s, !this._clockwise);
98
- return this;
99
- }
100
- transform(m) {
101
- MathError.assert(m.isSimilarity2D(Precision.CURVE_PARAM_EPS), 'Arc2.transform: matrix must be a 2D similarity transform');
102
- const oldSweep = this._range.length();
103
- const oldClockwise = this._clockwise;
104
- const startPoint = this.pointAt(this._range.start);
105
- const endPoint = this.pointAt(this._range.end);
106
- const nextCenter = m.transformedPoint(this._center);
107
- const nextStartPoint = m.transformedPoint(startPoint);
108
- const nextEndPoint = m.transformedPoint(endPoint);
109
- const nextRadius = this._radius * m.getSimilarityScale2D(Precision.CURVE_PARAM_EPS);
110
- MathError.assert(nextRadius > Precision.CURVE_LENGTH_EPS, 'Arc2.transform: degenerate radius after transform');
111
- const det = m.determinant();
112
- const mirrored = det < 0;
113
- const nextClockwise = mirrored ? !oldClockwise : oldClockwise;
114
- const startAngle = Math.atan2(nextStartPoint.y - nextCenter.y, nextStartPoint.x - nextCenter.x);
115
- let endAngle = Math.atan2(nextEndPoint.y - nextCenter.y, nextEndPoint.x - nextCenter.x);
116
- if (Math.abs(oldSweep - MathConst.PI2) <= Precision.CURVE_PARAM_EPS) {
117
- endAngle = startAngle + (nextClockwise ? -MathConst.PI2 : MathConst.PI2);
118
- }
119
- this._center = nextCenter;
120
- this._radius = nextRadius;
121
- this.resetAngles(startAngle, endAngle, nextClockwise);
122
- MathError.assert(this.length() > Precision.CURVE_LENGTH_EPS || Math.abs(oldSweep) <= Precision.CURVE_PARAM_EPS, 'Arc2.transform: invalid transformed arc');
123
- return this;
124
- }
125
- transformed(m) {
126
- return this.clone().transform(m);
127
- }
128
- closestPoint(p) {
129
- const range = this._range;
130
- const v = p.subtracted(this._center);
131
- let candidateU = this._range.start;
132
- if (v.len() > Precision.CURVE_NEWTON_EPS) {
133
- const theta = Math.atan2(v.y, v.x);
134
- candidateU = this.paramFromAngle(theta);
135
- }
136
- const candidates = [];
137
- if (this.containsParam(candidateU)) {
138
- candidates.push(candidateU);
139
- }
140
- candidates.push(this._range.start, this._range.end);
141
- let bestU = candidates[0];
142
- let bestP = this.pointAt(bestU);
143
- let bestD = bestP.distanceTo(p);
144
- for (let i = 1; i < candidates.length; i++) {
145
- const u = candidates[i];
146
- const q = this.pointAt(u);
147
- const d = q.distanceTo(p);
148
- if (d < bestD - Precision.CURVE_LENGTH_EPS) {
149
- bestU = u;
150
- bestP = q;
151
- bestD = d;
152
- continue;
153
- }
154
- if (Math.abs(d - bestD) <= Precision.CURVE_LENGTH_EPS) {
155
- const uu = range.normalizeInPeriod(u, range.start);
156
- const bb = range.normalizeInPeriod(bestU, range.start);
157
- if (uu < bb) {
158
- bestU = u;
159
- bestP = q;
160
- bestD = d;
161
- }
162
- }
163
- }
164
- return {
165
- point: bestP,
166
- param: bestU,
167
- distance: bestD,
168
- };
169
- }
170
- boundingBox() {
171
- const points = [
172
- this.pointAt(this._range.start),
173
- this.pointAt(this._range.end),
174
- ];
175
- const axes = [0, Math.PI * 0.5, Math.PI, Math.PI * 1.5];
176
- for (const theta of axes) {
177
- const u = this.paramFromAngle(theta);
178
- if (this.containsParam(u)) {
179
- points.push(this.pointAt(u));
180
- }
181
- }
182
- return Box2.fromPoints(points);
183
- }
184
- isValid(eps = Precision.CURVE_LENGTH_EPS) {
185
- return this.isCircleStructValid(eps) && this._range.length() >= 0 && this._range.length() <= MathConst.PI2 + Precision.CURVE_PARAM_EPS;
186
- }
187
- isClosed() {
188
- return Precision.equal(this._range.length(), MathConst.PI2, Precision.CURVE_PARAM_EPS);
189
- }
190
- isArc() {
191
- return true;
192
- }
193
- /**
194
- * 结构等价判断(字段级)。
195
- * @param other 对比圆弧。
196
- * @param eps 数值容差。
197
- * @returns 圆心、半径、方向和起终角参数近似相等时返回 `true`。
198
- */
199
- equals(other, eps = Precision.EPS) {
200
- return this._clockwise === other._clockwise &&
201
- this._center.equals(other._center, eps) &&
202
- Precision.equal(this._radius, other._radius, eps) &&
203
- Precision.equal(this.startAngle, other.startAngle, eps) &&
204
- Precision.equal(this.endAngle, other.endAngle, eps);
205
- }
206
- clone() {
207
- return new Arc2_1(this._center, this._radius, this.startAngle, this.endAngle, this._clockwise);
208
- }
209
- dump() {
210
- return {
211
- type: Arc2_1.type,
212
- center: { x: this._center.x, y: this._center.y },
213
- radius: this._radius,
214
- startAngle: this.startAngle,
215
- endAngle: this.endAngle,
216
- clockwise: this._clockwise,
217
- };
218
- }
219
- static load(data) {
220
- return new Arc2_1(new Vec2(data.center.x, data.center.y), data.radius, data.startAngle, data.endAngle, data.clockwise);
221
- }
222
- angleAtParam(u) {
223
- const uu = this.normalizeParamForEval(u);
224
- // 内部参数域总是递增;顺时针时通过镜像映射回几何角度。
225
- if (!this._clockwise)
226
- return uu;
227
- return this._range.start - (uu - this._range.start);
228
- }
229
- paramFromAngle(theta) {
230
- const range = this._range;
231
- if (!this._clockwise) {
232
- return range.normalizeInPeriod(theta, range.start);
233
- }
234
- // 反向参数化:关于 start 角做镜像。
235
- const reflected = 2 * range.start - theta;
236
- return range.normalizeInPeriod(reflected, range.start);
237
- }
238
- resetAngles(startAngle, endAngle, clockwise) {
239
- const s = this.normalizeAngle(startAngle);
240
- const startEqEnd = Precision.equal(startAngle, endAngle, Precision.CURVE_PARAM_EPS);
241
- let sweep = 0;
242
- if (!startEqEnd) {
243
- const raw = clockwise ? (startAngle - endAngle) : (endAngle - startAngle);
244
- sweep = this.positiveMod(raw);
245
- if (Precision.equal(sweep, 0, Precision.CURVE_PARAM_EPS)) {
246
- sweep = MathConst.PI2;
247
- }
248
- }
249
- this._clockwise = clockwise;
250
- this.setRange(new PeriodInterval(s, s + sweep, MathConst.PI2));
251
- }
252
- normalizeAngle(a) {
253
- const r = a % MathConst.PI2;
254
- return r < 0 ? r + MathConst.PI2 : r;
255
- }
256
- positiveMod(x) {
257
- const r = x % MathConst.PI2;
258
- return r < 0 ? r + MathConst.PI2 : r;
259
- }
260
- };
261
- Arc2.type = EN_GEO_TYPE.Arc2;
262
- Arc2 = Arc2_1 = __decorate([
263
- RegisterGeom
264
- ], Arc2);
265
- export { Arc2 };