@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
@@ -1,238 +0,0 @@
1
- /*
2
- * Linea Math - Curves
3
- * Curve2: 二维曲线抽象基类
4
- */
5
- import { GeomBase } from '../core/geom_base';
6
- import { MathError } from '../utils/math_error';
7
- import { Precision } from '../utils/precision';
8
- import { DiscretizeEngine } from '../discretize/discretize_engine';
9
- import { Interval } from './interval';
10
- export class Curve2 extends GeomBase {
11
- constructor() {
12
- super(...arguments);
13
- /**
14
- * 参数域
15
- * - 默认使用无界区间,具体曲线应在子类中覆盖
16
- * - 子类可直接赋值 this._range,或调用 setRange()
17
- */
18
- this._range = Interval.infinite();
19
- }
20
- /**
21
- * 获取参数域。
22
- * @returns 参数域副本,调用方修改不会影响内部状态。
23
- */
24
- getRange() {
25
- return this._range.clone();
26
- }
27
- /**
28
- * 判断参数是否落在当前曲线参数域内。
29
- * @param u 待判断参数。
30
- * @param eps 区间边界比较容差。
31
- * @returns 落在参数域内返回 `true`。
32
- */
33
- containsParam(u, eps = Precision.CURVE_PARAM_EPS) {
34
- return this._range.contains(u, eps);
35
- }
36
- /**
37
- * 是否为退化曲线。
38
- * 默认规则:参数域过小或曲线长度过小。
39
- */
40
- isDegenerate() {
41
- return this._range.length() <= Precision.CURVE_PARAM_EPS || this.length() <= Precision.CURVE_LENGTH_EPS;
42
- }
43
- /**
44
- * 是否为闭合曲线。
45
- * 默认返回 `false`,由闭合曲线子类覆盖。
46
- */
47
- isClosed() {
48
- return false;
49
- }
50
- /** 是否为线段曲线。 */
51
- isLine() {
52
- return false;
53
- }
54
- /** 是否为整圆曲线。 */
55
- isCircle() {
56
- return false;
57
- }
58
- /** 是否为圆弧曲线。 */
59
- isArc() {
60
- return false;
61
- }
62
- /** 是否为整椭圆曲线。 */
63
- isEllipse() {
64
- return false;
65
- }
66
- /** 是否为椭圆弧曲线。 */
67
- isEllipseArc() {
68
- return false;
69
- }
70
- /** 是否为 B 样条曲线。 */
71
- isBSpline() {
72
- return false;
73
- }
74
- /**
75
- * 获取第 `n` 阶导数(默认由 `derivatives` 派生)。
76
- * @param u 曲线参数。
77
- * @param n 导数阶数,要求为非负整数。
78
- * @returns 第 `n` 阶导数向量。
79
- */
80
- derivativeAt(u, n) {
81
- MathError.assert(Number.isInteger(n) && n >= 0, 'Curve2.derivativeAt: n must be a non-negative integer');
82
- const ds = this.derivatives(u, n);
83
- MathError.assert(ds.length > n, 'Curve2.derivativeAt: derivative order is not available');
84
- return ds[n];
85
- }
86
- /**
87
- * 最近参数(默认由 `closestPoint` 派生)。
88
- * @param p 查询点。
89
- * @param tol 计算容差。
90
- * @returns 最近点对应参数。
91
- */
92
- closestParam(p, tol = Precision.LEN_EPS) {
93
- return this.closestPoint(p, tol).param;
94
- }
95
- /**
96
- * 点到曲线距离(默认由 `closestPoint` 派生)。
97
- * @param p 查询点。
98
- * @param tol 计算容差。
99
- * @returns 点到曲线的最短距离。
100
- */
101
- distanceToPoint(p, tol = Precision.LEN_EPS) {
102
- return this.closestPoint(p, tol).distance;
103
- }
104
- /**
105
- * 曲线离散化便捷入口(薄封装)。
106
- * @param options 离散参数。
107
- * @returns 折线采样结果。
108
- */
109
- discretize(options) {
110
- return DiscretizeEngine.discretize(this, options);
111
- }
112
- /**
113
- * 设置参数域(供子类构造期使用)。
114
- * @param range 参数区间。
115
- * @returns 当前实例。
116
- */
117
- setRange(range) {
118
- this._range = range.clone();
119
- return this;
120
- }
121
- /**
122
- * Newton + 二分混合求解参数(常用于弧长反参)。
123
- * @param target 目标值(如目标弧长)。
124
- * @param start 参数下界。
125
- * @param end 参数上界。
126
- * @param tol 收敛容差。
127
- * @param evalValue 参数到目标量的映射函数(要求在 [start, end] 上单调)。
128
- * @param evalSlope 参数处导数量(如速度),用于 Newton 步。
129
- * @param failMessage 未收敛时抛错信息。
130
- * @param initialGuess 可选初值;不传时取区间中点。
131
- * @returns 收敛后的参数。
132
- */
133
- solveParamByHybridNewton(target, start, end, tol, evalValue, evalSlope, failMessage, initialGuess) {
134
- MathError.assert(Number.isFinite(start) && Number.isFinite(end) && end > start, 'Curve2.solveParamByHybridNewton: invalid range');
135
- MathError.assert(Number.isFinite(tol) && tol > 0, 'Curve2.solveParamByHybridNewton: tol must be > 0');
136
- // lo/hi 始终包住当前根,Newton 出界时回退到二分保证收敛性。
137
- let lo = start;
138
- let hi = end;
139
- let u = initialGuess ?? ((lo + hi) * 0.5);
140
- if (!Number.isFinite(u) || u <= lo || u >= hi) {
141
- u = (lo + hi) * 0.5;
142
- }
143
- for (let i = 0; i < Precision.CURVE_MAX_ITER; i++) {
144
- const value = evalValue(u);
145
- const f = value - target;
146
- if (Math.abs(f) <= tol)
147
- return u;
148
- const slope = evalSlope(u);
149
- let next = Number.NaN;
150
- if (Math.abs(slope) > Precision.CURVE_NEWTON_EPS) {
151
- next = u - f / slope;
152
- }
153
- // Newton 步越界或数值异常时,退回二分步,避免振荡/发散。
154
- if (!Number.isFinite(next) || next <= lo || next >= hi) {
155
- next = (lo + hi) * 0.5;
156
- }
157
- if (f > 0) {
158
- hi = u;
159
- }
160
- else {
161
- lo = u;
162
- }
163
- u = next;
164
- }
165
- MathError.throw(failMessage);
166
- }
167
- /**
168
- * “采样粗定位 + Newton 细化”最近点求解通用流程。
169
- * @param p 查询点。
170
- * @param tol 收敛容差。
171
- * @param sampleCount 初始采样数(含两端点)。
172
- * @param evalPoint 参数求点函数。
173
- * @param evalD1 一阶导函数。
174
- * @param evalD2 二阶导函数。
175
- * @param failMessage 未收敛时抛错信息。
176
- * @param compareParam 参数平局比较器(返回 <0 表示 a 更优)。
177
- * @returns 最近点结果。
178
- */
179
- solveClosestPointBySampleNewton(p, tol, sampleCount, evalPoint, evalD1, evalD2, failMessage, compareParam = (a, b) => a - b) {
180
- MathError.assert(Number.isFinite(tol) && tol > 0, 'Curve2.solveClosestPointBySampleNewton: tol must be > 0');
181
- MathError.assert(Number.isInteger(sampleCount) && sampleCount > 0, 'Curve2.solveClosestPointBySampleNewton: sampleCount must be a positive integer');
182
- const start = this._range.start;
183
- const span = this._range.length();
184
- // 零跨度参数域直接退化为单点评估。
185
- if (span <= Precision.CURVE_PARAM_EPS) {
186
- const point = evalPoint(start);
187
- return { point, param: start, distance: point.distanceTo(p) };
188
- }
189
- // 第 1 阶段:均匀采样找一个稳定的初始参数。
190
- let bestU = start;
191
- let bestDistSq = Number.POSITIVE_INFINITY;
192
- for (let i = 0; i <= sampleCount; i++) {
193
- const u = start + (span * i) / sampleCount;
194
- const q = evalPoint(u);
195
- const d2 = q.distanceToSq(p);
196
- if (d2 < bestDistSq - tol * tol) {
197
- bestDistSq = d2;
198
- bestU = u;
199
- continue;
200
- }
201
- if (Math.abs(d2 - bestDistSq) <= tol * tol && compareParam(u, bestU) < 0) {
202
- bestU = u;
203
- }
204
- }
205
- // 第 2 阶段:在采样命中的局部窗口做 Newton 迭代。
206
- const step = span / sampleCount;
207
- let lo = Math.max(start, bestU - step);
208
- let hi = Math.min(start + span, bestU + step);
209
- let u = bestU;
210
- for (let i = 0; i < Precision.CURVE_MAX_ITER; i++) {
211
- const c = evalPoint(u);
212
- const d1 = evalD1(u);
213
- const d2 = evalD2(u);
214
- const cp = c.subtracted(p);
215
- const f = cp.dot(d1);
216
- if (Math.abs(f) <= tol) {
217
- return { point: c, param: u, distance: c.distanceTo(p) };
218
- }
219
- const fp = d1.dot(d1) + cp.dot(d2);
220
- let next = Number.NaN;
221
- if (Math.abs(fp) > Precision.CURVE_NEWTON_EPS) {
222
- next = u - f / fp;
223
- }
224
- // Newton 失效时回退二分,保持区间收缩。
225
- if (!Number.isFinite(next) || next <= lo || next >= hi) {
226
- next = (lo + hi) * 0.5;
227
- }
228
- if (f > 0) {
229
- hi = u;
230
- }
231
- else {
232
- lo = u;
233
- }
234
- u = next;
235
- }
236
- MathError.throw(failMessage);
237
- }
238
- }
@@ -1,42 +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 { IDBEllipse2 } from '../serialize/dump_types';
6
- import { EllipseArc2 } from './ellipse_arc2';
7
- import { EllipseCurve2 } from './ellipse_curve2';
8
- import { Interval } from './interval';
9
- export declare class Ellipse2 extends EllipseCurve2 {
10
- static readonly type = EN_GEO_TYPE.Ellipse2;
11
- /**
12
- * 构造整椭圆。
13
- * @param center 中心点。
14
- * @param rx 长半轴。
15
- * @param ry 短半轴。
16
- * @param rotation 椭圆局部 x 轴相对全局 x 轴旋转角(弧度)。
17
- */
18
- constructor(center: Vec2, rx: number, ry: number, rotation?: number);
19
- split(u: number): EllipseArc2[];
20
- trim(range: Interval): EllipseArc2[];
21
- reverse(): this;
22
- transform(m: Mat3): this;
23
- transformed(m: Mat3): this;
24
- boundingBox(): Box2;
25
- isValid(eps?: number): boolean;
26
- isClosed(): boolean;
27
- isEllipse(): this is Ellipse2;
28
- /**
29
- * 结构等价判断(字段级)。
30
- * @param other 对比椭圆。
31
- * @param eps 数值容差。
32
- * @returns 中心、长短半轴和旋转角近似相等时返回 `true`。
33
- */
34
- equals(other: Ellipse2, eps?: number): boolean;
35
- clone(): this;
36
- dump(): IDBEllipse2;
37
- static load(data: IDBEllipse2): Ellipse2;
38
- protected paramToAngle(u: number): number;
39
- protected angleToParam(theta: number): number;
40
- protected angleDerivativeSign(): 1 | -1;
41
- }
42
- //# sourceMappingURL=ellipse2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ellipse2.d.ts","sourceRoot":"","sources":["../../src/curves/ellipse2.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,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAI1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGrC,qBAKa,QAAS,SAAQ,aAAa;IACvC,gBAAuB,IAAI,wBAAuB;IAElD;;;;;;OAMG;gBACS,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,SAAI;IAK9C,KAAK,CAAC,CAAC,EAAE,MAAM;IAYf,IAAI,CAAC,KAAK,EAAE,QAAQ;IAOpB,OAAO;IAKP,SAAS,CAAC,CAAC,EAAE,IAAI;IAWjB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI;IAI1B,WAAW;IAaX,OAAO,CAAC,GAAG,SAA6B;IAIxC,QAAQ,IAAI,OAAO;IAInB,SAAS,IAAI,IAAI,IAAI,QAAQ;IAI7C;;;;;OAKG;IACI,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,SAAgB;IAOlC,KAAK,IAAI,IAAI;IAIb,IAAI,IAAI,WAAW;WAUrB,IAAI,CAAC,IAAI,EAAE,WAAW;cASjB,YAAY,CAAC,CAAC,EAAE,MAAM;cAKtB,YAAY,CAAC,KAAK,EAAE,MAAM;cAK1B,mBAAmB,IAAI,CAAC,GAAG,CAAC,CAAC;CAGnD"}
@@ -1,125 +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 Ellipse2_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 { EllipseArc2 } from './ellipse_arc2';
16
- import { EllipseCurve2 } from './ellipse_curve2';
17
- import { PeriodInterval } from './period_interval';
18
- let Ellipse2 = Ellipse2_1 = class Ellipse2 extends EllipseCurve2 {
19
- /**
20
- * 构造整椭圆。
21
- * @param center 中心点。
22
- * @param rx 长半轴。
23
- * @param ry 短半轴。
24
- * @param rotation 椭圆局部 x 轴相对全局 x 轴旋转角(弧度)。
25
- */
26
- constructor(center, rx, ry, rotation = 0) {
27
- super(center, rx, ry, rotation);
28
- this.setRange(new PeriodInterval(0, MathConst.PI2, MathConst.PI2));
29
- }
30
- split(u) {
31
- const range = this._range;
32
- const uu = range.normalizeInPeriod(u, range.start);
33
- if (Math.abs(uu - range.start) <= Precision.CURVE_PARAM_EPS || Math.abs(uu - range.end) <= Precision.CURVE_PARAM_EPS) {
34
- return [];
35
- }
36
- const left = new EllipseArc2(this._center, this._rx, this._ry, this._rotation, range.start, uu, false);
37
- const right = new EllipseArc2(this._center, this._rx, this._ry, this._rotation, uu, range.start + range.period, false);
38
- return [left, right].filter((arc) => arc.length() > Precision.CURVE_LENGTH_EPS);
39
- }
40
- trim(range) {
41
- this._range.assertContainsRange(range, Precision.CURVE_PARAM_EPS);
42
- if (range.length() <= Precision.CURVE_PARAM_EPS)
43
- return [];
44
- return [new EllipseArc2(this._center, this._rx, this._ry, this._rotation, range.start, range.end, false)];
45
- }
46
- reverse() {
47
- // 整椭圆反转后几何与参数域等价,保持不变即可。
48
- return this;
49
- }
50
- transform(m) {
51
- const next = this.transformedEllipseParams(m);
52
- MathError.assert(next.rx > Precision.CURVE_LENGTH_EPS && next.ry > Precision.CURVE_LENGTH_EPS, 'Ellipse2.transform: degenerate ellipse after transform');
53
- this._center = next.center;
54
- this._rx = next.rx;
55
- this._ry = next.ry;
56
- this._rotation = next.rotation;
57
- return this;
58
- }
59
- transformed(m) {
60
- return this.clone().transform(m);
61
- }
62
- boundingBox() {
63
- const c = Math.cos(this._rotation);
64
- const s = Math.sin(this._rotation);
65
- const ex = Math.hypot(this._rx * c, this._ry * s);
66
- const ey = Math.hypot(this._rx * s, this._ry * c);
67
- return new Box2(this._center.x - ex, this._center.y - ey, this._center.x + ex, this._center.y + ey);
68
- }
69
- isValid(eps = Precision.CURVE_LENGTH_EPS) {
70
- return this.isEllipseStructValid(eps);
71
- }
72
- isClosed() {
73
- return true;
74
- }
75
- isEllipse() {
76
- return true;
77
- }
78
- /**
79
- * 结构等价判断(字段级)。
80
- * @param other 对比椭圆。
81
- * @param eps 数值容差。
82
- * @returns 中心、长短半轴和旋转角近似相等时返回 `true`。
83
- */
84
- equals(other, eps = Precision.EPS) {
85
- return this._center.equals(other._center, eps) &&
86
- Precision.equal(this._rx, other._rx, eps) &&
87
- Precision.equal(this._ry, other._ry, eps) &&
88
- Precision.equal(this._rotation, other._rotation, eps);
89
- }
90
- clone() {
91
- return new Ellipse2_1(this._center, this._rx, this._ry, this._rotation);
92
- }
93
- dump() {
94
- return {
95
- type: Ellipse2_1.type,
96
- center: { x: this._center.x, y: this._center.y },
97
- rx: this._rx,
98
- ry: this._ry,
99
- rotation: this._rotation,
100
- };
101
- }
102
- static load(data) {
103
- return new Ellipse2_1(new Vec2(data.center.x, data.center.y), data.rx, data.ry, data.rotation);
104
- }
105
- paramToAngle(u) {
106
- const range = this._range;
107
- return range.normalizeInPeriod(u, range.start);
108
- }
109
- angleToParam(theta) {
110
- const range = this._range;
111
- return range.normalizeInPeriod(theta, range.start);
112
- }
113
- angleDerivativeSign() {
114
- return 1;
115
- }
116
- };
117
- Ellipse2.type = EN_GEO_TYPE.Ellipse2;
118
- Ellipse2 = Ellipse2_1 = __decorate([
119
- RegisterGeom
120
- /**
121
- * 二维整椭圆曲线。
122
- * 参数域固定为 `PeriodInterval(0, 2π, 2π)`。
123
- */
124
- ], Ellipse2);
125
- export { Ellipse2 };
@@ -1,49 +0,0 @@
1
- import { EN_GEO_TYPE } from '../constants/geom_type';
2
- import { Mat3 } from '../core/mat3';
3
- import { Vec2 } from '../core/vec2';
4
- import type { IDBEllipseArc2 } from '../serialize/dump_types';
5
- import { EllipseCurve2 } from './ellipse_curve2';
6
- import { Interval } from './interval';
7
- export declare class EllipseArc2 extends EllipseCurve2 {
8
- static readonly type = EN_GEO_TYPE.EllipseArc2;
9
- private _clockwise;
10
- /**
11
- * 构造椭圆弧。
12
- * @param center 中心点。
13
- * @param rx 长半轴。
14
- * @param ry 短半轴。
15
- * @param rotation 椭圆局部 x 轴相对全局 x 轴旋转角(弧度)。
16
- * @param startAngle 起始角(几何语义)。
17
- * @param endAngle 终止角(几何语义)。
18
- * @param clockwise 是否顺时针。
19
- */
20
- constructor(center: Vec2, rx: number, ry: number, rotation: number, startAngle: number, endAngle: number, clockwise?: boolean);
21
- get clockwise(): boolean;
22
- get startAngle(): number;
23
- get endAngle(): number;
24
- split(u: number): EllipseArc2[];
25
- trim(range: Interval): EllipseArc2[];
26
- reverse(): this;
27
- transform(m: Mat3): this;
28
- transformed(m: Mat3): this;
29
- isValid(eps?: number): boolean;
30
- isClosed(): boolean;
31
- isEllipseArc(): this is EllipseArc2;
32
- /**
33
- * 结构等价判断(字段级)。
34
- * @param other 对比椭圆弧。
35
- * @param eps 数值容差。
36
- * @returns 中心、轴长、旋转、方向与起终角参数近似相等时返回 `true`。
37
- */
38
- equals(other: EllipseArc2, eps?: number): boolean;
39
- clone(): this;
40
- dump(): IDBEllipseArc2;
41
- static load(data: IDBEllipseArc2): EllipseArc2;
42
- protected paramToAngle(u: number): number;
43
- protected angleToParam(theta: number): number;
44
- protected angleDerivativeSign(): 1 | -1;
45
- private resetAngles;
46
- private normalizeAngle;
47
- private positiveMod;
48
- }
49
- //# sourceMappingURL=ellipse_arc2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ellipse_arc2.d.ts","sourceRoot":"","sources":["../../src/curves/ellipse_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,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAI7D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGrC,qBAKa,WAAY,SAAQ,aAAa;IAC1C,gBAAuB,IAAI,2BAA0B;IAErD,OAAO,CAAC,UAAU,CAAS;IAE3B;;;;;;;;;OASG;gBACS,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,UAAQ;IAO3H,IAAW,SAAS,YAEnB;IAED,IAAW,UAAU,WAEpB;IAED,IAAW,QAAQ,WAMlB;IAEe,KAAK,CAAC,CAAC,EAAE,MAAM;IAUf,IAAI,CAAC,KAAK,EAAE,QAAQ;IAUpB,OAAO;IAOP,SAAS,CAAC,CAAC,EAAE,IAAI;IA4BjB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI;IAI1B,OAAO,CAAC,GAAG,SAA6B;IAIxC,QAAQ,IAAI,OAAO;IAInB,YAAY,IAAI,IAAI,IAAI,WAAW;IAInD;;;;;OAKG;IACI,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,SAAgB;IAUrC,KAAK,IAAI,IAAI;IAYb,IAAI,IAAI,cAAc;WAaxB,IAAI,CAAC,IAAI,EAAE,cAAc;cAYpB,YAAY,CAAC,CAAC,EAAE,MAAM;cAMtB,YAAY,CAAC,KAAK,EAAE,MAAM;cAS1B,mBAAmB,IAAI,CAAC,GAAG,CAAC,CAAC;IAIhD,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,WAAW;CAItB"}
@@ -1,184 +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 EllipseArc2_1;
8
- import { EN_GEO_TYPE } from '../constants/geom_type';
9
- import { MathConst } from '../constants/math_const';
10
- import { Vec2 } from '../core/vec2';
11
- import { RegisterGeom } from '../serialize/geom_mgr';
12
- import { MathError } from '../utils/math_error';
13
- import { Precision } from '../utils/precision';
14
- import { EllipseCurve2 } from './ellipse_curve2';
15
- import { PeriodInterval } from './period_interval';
16
- let EllipseArc2 = EllipseArc2_1 = class EllipseArc2 extends EllipseCurve2 {
17
- /**
18
- * 构造椭圆弧。
19
- * @param center 中心点。
20
- * @param rx 长半轴。
21
- * @param ry 短半轴。
22
- * @param rotation 椭圆局部 x 轴相对全局 x 轴旋转角(弧度)。
23
- * @param startAngle 起始角(几何语义)。
24
- * @param endAngle 终止角(几何语义)。
25
- * @param clockwise 是否顺时针。
26
- */
27
- constructor(center, rx, ry, rotation, startAngle, endAngle, clockwise = false) {
28
- super(center, rx, ry, rotation);
29
- MathError.assert(Number.isFinite(startAngle) && Number.isFinite(endAngle), 'EllipseArc2: startAngle/endAngle must be finite');
30
- this._clockwise = clockwise;
31
- this.resetAngles(startAngle, endAngle, clockwise);
32
- }
33
- get clockwise() {
34
- return this._clockwise;
35
- }
36
- get startAngle() {
37
- return this.normalizeAngle(this._range.start);
38
- }
39
- get endAngle() {
40
- const sweep = this._range.length();
41
- const end = this._clockwise
42
- ? this._range.start - sweep
43
- : this._range.start + sweep;
44
- return this.normalizeAngle(end);
45
- }
46
- split(u) {
47
- const parts = this._range.split(u, Precision.CURVE_PARAM_EPS);
48
- if (parts.length === 0)
49
- return [];
50
- const theta = this.paramToAngle(u);
51
- const left = new EllipseArc2_1(this._center, this._rx, this._ry, this._rotation, this.startAngle, theta, this._clockwise);
52
- const right = new EllipseArc2_1(this._center, this._rx, this._ry, this._rotation, theta, this.endAngle, this._clockwise);
53
- return [left, right].filter((arc) => arc.length() > Precision.CURVE_LENGTH_EPS);
54
- }
55
- trim(range) {
56
- this._range.assertContainsRange(range, Precision.CURVE_PARAM_EPS);
57
- if (range.length() <= Precision.CURVE_PARAM_EPS)
58
- return [];
59
- const start = this.paramToAngle(range.start);
60
- const end = this.paramToAngle(range.end);
61
- const arc = new EllipseArc2_1(this._center, this._rx, this._ry, this._rotation, start, end, this._clockwise);
62
- return arc.length() <= Precision.CURVE_LENGTH_EPS ? [] : [arc];
63
- }
64
- reverse() {
65
- const s = this.startAngle;
66
- const e = this.endAngle;
67
- this.resetAngles(e, s, !this._clockwise);
68
- return this;
69
- }
70
- transform(m) {
71
- const oldSweep = this._range.length();
72
- const startPoint = this.pointAt(this._range.start);
73
- const endPoint = this.pointAt(this._range.end);
74
- const next = this.transformedEllipseParams(m);
75
- MathError.assert(next.rx > Precision.CURVE_LENGTH_EPS && next.ry > Precision.CURVE_LENGTH_EPS, 'EllipseArc2.transform: degenerate ellipse after transform');
76
- const nextStartPoint = m.transformedPoint(startPoint);
77
- const nextEndPoint = m.transformedPoint(endPoint);
78
- const startAngle = this.angleFromPointOnEllipse(nextStartPoint, next.center, next.rx, next.ry, next.rotation);
79
- let endAngle = this.angleFromPointOnEllipse(nextEndPoint, next.center, next.rx, next.ry, next.rotation);
80
- const nextClockwise = next.mirrored ? !this._clockwise : this._clockwise;
81
- if (Math.abs(oldSweep - MathConst.PI2) <= Precision.CURVE_PARAM_EPS) {
82
- endAngle = startAngle + (nextClockwise ? -MathConst.PI2 : MathConst.PI2);
83
- }
84
- this._center = next.center;
85
- this._rx = next.rx;
86
- this._ry = next.ry;
87
- this._rotation = next.rotation;
88
- this.resetAngles(startAngle, endAngle, nextClockwise);
89
- return this;
90
- }
91
- transformed(m) {
92
- return this.clone().transform(m);
93
- }
94
- isValid(eps = Precision.CURVE_LENGTH_EPS) {
95
- return this.isEllipseStructValid(eps) && this._range.length() >= 0 && this._range.length() <= MathConst.PI2 + Precision.CURVE_PARAM_EPS;
96
- }
97
- isClosed() {
98
- return Precision.equal(this._range.length(), MathConst.PI2, Precision.CURVE_PARAM_EPS);
99
- }
100
- isEllipseArc() {
101
- return true;
102
- }
103
- /**
104
- * 结构等价判断(字段级)。
105
- * @param other 对比椭圆弧。
106
- * @param eps 数值容差。
107
- * @returns 中心、轴长、旋转、方向与起终角参数近似相等时返回 `true`。
108
- */
109
- equals(other, eps = Precision.EPS) {
110
- return this._clockwise === other._clockwise &&
111
- this._center.equals(other._center, eps) &&
112
- Precision.equal(this._rx, other._rx, eps) &&
113
- Precision.equal(this._ry, other._ry, eps) &&
114
- Precision.equal(this._rotation, other._rotation, eps) &&
115
- Precision.equal(this.startAngle, other.startAngle, eps) &&
116
- Precision.equal(this.endAngle, other.endAngle, eps);
117
- }
118
- clone() {
119
- return new EllipseArc2_1(this._center, this._rx, this._ry, this._rotation, this.startAngle, this.endAngle, this._clockwise);
120
- }
121
- dump() {
122
- return {
123
- type: EllipseArc2_1.type,
124
- center: { x: this._center.x, y: this._center.y },
125
- rx: this._rx,
126
- ry: this._ry,
127
- rotation: this._rotation,
128
- startAngle: this.startAngle,
129
- endAngle: this.endAngle,
130
- clockwise: this._clockwise,
131
- };
132
- }
133
- static load(data) {
134
- return new EllipseArc2_1(new Vec2(data.center.x, data.center.y), data.rx, data.ry, data.rotation, data.startAngle, data.endAngle, data.clockwise);
135
- }
136
- paramToAngle(u) {
137
- const uu = this.normalizeParamForEval(u);
138
- if (!this._clockwise)
139
- return uu;
140
- return this._range.start - (uu - this._range.start);
141
- }
142
- angleToParam(theta) {
143
- const range = this._range;
144
- if (!this._clockwise) {
145
- return range.normalizeInPeriod(theta, range.start);
146
- }
147
- const reflected = 2 * range.start - theta;
148
- return range.normalizeInPeriod(reflected, range.start);
149
- }
150
- angleDerivativeSign() {
151
- return this._clockwise ? -1 : 1;
152
- }
153
- resetAngles(startAngle, endAngle, clockwise) {
154
- const s = this.normalizeAngle(startAngle);
155
- const startEqEnd = Precision.equal(startAngle, endAngle, Precision.CURVE_PARAM_EPS);
156
- let sweep = 0;
157
- if (!startEqEnd) {
158
- const raw = clockwise ? (startAngle - endAngle) : (endAngle - startAngle);
159
- sweep = this.positiveMod(raw);
160
- if (Precision.equal(sweep, 0, Precision.CURVE_PARAM_EPS)) {
161
- sweep = MathConst.PI2;
162
- }
163
- }
164
- this._clockwise = clockwise;
165
- this.setRange(new PeriodInterval(s, s + sweep, MathConst.PI2));
166
- }
167
- normalizeAngle(a) {
168
- const r = a % MathConst.PI2;
169
- return r < 0 ? r + MathConst.PI2 : r;
170
- }
171
- positiveMod(x) {
172
- const r = x % MathConst.PI2;
173
- return r < 0 ? r + MathConst.PI2 : r;
174
- }
175
- };
176
- EllipseArc2.type = EN_GEO_TYPE.EllipseArc2;
177
- EllipseArc2 = EllipseArc2_1 = __decorate([
178
- RegisterGeom
179
- /**
180
- * 二维椭圆弧曲线。
181
- * 内部参数域统一为递增区间 `[s, s + sweep]`,方向由 `clockwise` 表示。
182
- */
183
- ], EllipseArc2);
184
- export { EllipseArc2 };