@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.
- package/index.cjs +226 -0
- package/package.json +19 -37
- package/types/algorithm/bool_operate/bool2d/bool2d.d.ts +22 -0
- package/types/algorithm/bool_operate/bool2d/difference.d.ts +9 -0
- package/types/algorithm/bool_operate/bool2d/intersect.d.ts +9 -0
- package/types/algorithm/bool_operate/bool2d/split.d.ts +3 -0
- package/types/algorithm/bool_operate/bool2d/union.d.ts +9 -0
- package/types/algorithm/bool_operate/bool2d/utils.d.ts +40 -0
- package/types/algorithm/bool_operate/bool_operate_clipper.d.ts +18 -0
- package/types/algorithm/bool_operate/polycurve_polygon_bool.d.ts +13 -0
- package/types/algorithm/bool_operate_2d.d.ts +67 -0
- package/types/algorithm/calc_d.d.ts +85 -0
- package/types/algorithm/calc_offset.d.ts +70 -0
- package/types/algorithm/calc_overlap.d.ts +56 -0
- package/types/algorithm/calc_project.d.ts +29 -0
- package/types/algorithm/calc_x.d.ts +215 -0
- package/types/algorithm/calculate_util/geometry_subdevide_infos.d.ts +73 -0
- package/types/algorithm/calculate_util/iterative_method.d.ts +30 -0
- package/types/algorithm/discrete/discrete_curve.d.ts +31 -0
- package/types/algorithm/discrete/discrete_refiner.d.ts +35 -0
- package/types/algorithm/discrete/discrete_surface.d.ts +74 -0
- package/types/algorithm/discrete/discrete_topology.d.ts +32 -0
- package/types/algorithm/discrete/discrete_util.d.ts +96 -0
- package/types/algorithm/discrete/grid_discrete_data.d.ts +58 -0
- package/types/algorithm/discrete/libtess.d.ts +12 -0
- package/types/algorithm/discrete/uniform_grid_discrete.d.ts +3 -0
- package/types/algorithm/distance/base_calc_distance/curves_distance_util.d.ts +20 -0
- package/types/algorithm/distance/base_calc_distance/define_of_calculate_distance.d.ts +12 -0
- package/types/algorithm/distance/curve2ds_distance/arc2s_distance.d.ts +17 -0
- package/types/algorithm/distance/curve2ds_distance/line2d_to_arc2d_distance.d.ts +17 -0
- package/types/algorithm/distance/curve2ds_distance/line2s_distance.d.ts +15 -0
- package/types/algorithm/distance/curve2s_distance.d.ts +15 -0
- package/types/algorithm/distance/curve3ds_distance/line3d_to_line3d_distance_paramed.d.ts +12 -0
- package/types/algorithm/distance/curve3s_distance.d.ts +31 -0
- package/types/algorithm/distance/pt_to_curve2_signed_distance.d.ts +17 -0
- package/types/algorithm/distance/pt_to_curve3_distance.d.ts +25 -0
- package/types/algorithm/distance/pt_to_curve_distance_info.d.ts +12 -0
- package/types/algorithm/distance/pt_to_surface_distance.d.ts +17 -0
- package/types/algorithm/distance/pts_to_curves_distance.d.ts +13 -0
- package/types/algorithm/distance/pts_to_pts_distance.d.ts +7 -0
- package/types/algorithm/geometry_merge.d.ts +22 -0
- package/types/algorithm/index.d.ts +32 -0
- package/types/algorithm/intersect/box_cut_line.d.ts +6 -0
- package/types/algorithm/intersect/curve_self_x.d.ts +13 -0
- package/types/algorithm/intersect/curve_surface_x.d.ts +34 -0
- package/types/algorithm/intersect/curve_surface_x_util.d.ts +32 -0
- package/types/algorithm/intersect/curves_x/circulars_x.d.ts +35 -0
- package/types/algorithm/intersect/curves_x/linear_circular_x.d.ts +40 -0
- package/types/algorithm/intersect/curves_x/lines_x.d.ts +17 -0
- package/types/algorithm/intersect/curves_x/lines_x_util.d.ts +4 -0
- package/types/algorithm/intersect/curves_x.d.ts +26 -0
- package/types/algorithm/intersect/curves_x_util.d.ts +35 -0
- package/types/algorithm/intersect/intersect_info_util.d.ts +9 -0
- package/types/algorithm/intersect/surface_self_x.d.ts +8 -0
- package/types/algorithm/intersect/surfaces_x.d.ts +53 -0
- package/types/algorithm/intersect/surfaces_x_complex.d.ts +29 -0
- package/types/algorithm/intersect/surfaces_x_special.d.ts +16 -0
- package/types/algorithm/intersect/surfaces_x_util.d.ts +41 -0
- package/types/algorithm/intersect/x_info.d.ts +65 -0
- package/types/algorithm/loop_property/loop-area.d.ts +49 -0
- package/types/algorithm/loop_property/loop-centroid.d.ts +40 -0
- package/types/algorithm/merge_geometry/halfplane.d.ts +24 -0
- package/types/algorithm/merge_geometry/merge_curve.d.ts +14 -0
- package/types/algorithm/merge_geometry/merge_point.d.ts +18 -0
- package/types/algorithm/mesh/clip_mesh.d.ts +27 -0
- package/types/algorithm/mesh/extrude_clip.d.ts +236 -0
- package/types/algorithm/mesh/mesh_assist.d.ts +21 -0
- package/types/algorithm/mesh/mesh_contour.d.ts +26 -0
- package/types/algorithm/mesh/mesh_util.d.ts +115 -0
- package/types/algorithm/offset/loop2d_offset.d.ts +22 -0
- package/types/algorithm/offset/polygon_offset.d.ts +27 -0
- package/types/algorithm/overlap/curve_surface_coincide.d.ts +6 -0
- package/types/algorithm/overlap/curves_colinear.d.ts +38 -0
- package/types/algorithm/overlap/curves_merge.d.ts +74 -0
- package/types/algorithm/overlap/curves_overlap.d.ts +34 -0
- package/types/algorithm/overlap/i_overlap.d.ts +9 -0
- package/types/algorithm/overlap/surfaces_coplaner.d.ts +5 -0
- package/types/algorithm/pattern/blocks2Geometry.d.ts +50 -0
- package/types/algorithm/pattern/math.d.ts +42 -0
- package/types/algorithm/pattern/pattern.d.ts +43 -0
- package/types/algorithm/pattern/pattern_util.d.ts +53 -0
- package/types/algorithm/pattern/pave.d.ts +33 -0
- package/types/algorithm/pj/curves_oj.d.ts +19 -0
- package/types/algorithm/pj/curves_pj.d.ts +19 -0
- package/types/algorithm/pj/loops_pj.d.ts +13 -0
- package/types/algorithm/pj/pj_type.d.ts +46 -0
- package/types/algorithm/pj/pt_loop_pj.d.ts +24 -0
- package/types/algorithm/pj/pt_polygon_pj.d.ts +18 -0
- package/types/algorithm/pj/pt_polygon_position_judger.d.ts +11 -0
- package/types/algorithm/position_judge.d.ts +72 -0
- package/types/algorithm/project/curve3d_to_plane_project.d.ts +11 -0
- package/types/algorithm/project/curve_curve_project.d.ts +9 -0
- package/types/algorithm/search_graph/iloops_polygonex.d.ts +28 -0
- package/types/algorithm/search_graph/loop_tree_node.d.ts +30 -0
- package/types/algorithm/search_graph/loops_to_loop_tree_search_graph.d.ts +25 -0
- package/types/algorithm/search_graph/polygon_polygonex.d.ts +13 -0
- package/types/algorithm/search_graph/search_loop2d.d.ts +20 -0
- package/types/algorithm/search_graph/search_polyline.d.ts +11 -0
- package/types/algorithm/search_graph.d.ts +45 -0
- package/types/algorithm/topology_edit.d.ts +10 -0
- package/types/base/box.d.ts +100 -0
- package/types/base/box2.d.ts +17 -0
- package/types/base/box3.d.ts +20 -0
- package/types/base/coord.d.ts +10 -0
- package/types/base/coord2.d.ts +92 -0
- package/types/base/coord3.d.ts +139 -0
- package/types/base/discrete_param.d.ts +28 -0
- package/types/base/euler.d.ts +102 -0
- package/types/base/geo_element.d.ts +54 -0
- package/types/base/interval.d.ts +122 -0
- package/types/base/ivector.d.ts +126 -0
- package/types/base/matrix.d.ts +108 -0
- package/types/base/matrix3.d.ts +118 -0
- package/types/base/matrix4.d.ts +166 -0
- package/types/base/matrix_util.d.ts +5 -0
- package/types/base/period_inverval.d.ts +127 -0
- package/types/base/quaternion.d.ts +39 -0
- package/types/base/tangent_cone.d.ts +11 -0
- package/types/base/tilt_box.d.ts +11 -0
- package/types/base/tol.d.ts +120 -0
- package/types/base/vec.d.ts +46 -0
- package/types/base/vec2.d.ts +146 -0
- package/types/base/vec3.d.ts +158 -0
- package/types/brep-src/algorithm/alg_const.d.ts +23 -0
- package/types/brep-src/algorithm/alg_types.d.ts +47 -0
- package/types/brep-src/algorithm/algorithm_util/base_define.d.ts +7 -0
- package/types/brep-src/algorithm/algorithm_util/body_base_util.d.ts +4 -0
- package/types/brep-src/algorithm/algorithm_util/curve_solid_analysis.d.ts +28 -0
- package/types/brep-src/algorithm/algorithm_util/face_face_analysis.d.ts +39 -0
- package/types/brep-src/algorithm/algorithm_util/search_wire.d.ts +8 -0
- package/types/brep-src/algorithm/body_builder/basic_body_builder.d.ts +15 -0
- package/types/brep-src/algorithm/body_builder/extrude_body.d.ts +23 -0
- package/types/brep-src/algorithm/body_builder/sweep_body.d.ts +37 -0
- package/types/brep-src/algorithm/body_builder.d.ts +36 -0
- package/types/brep-src/algorithm/body_util.d.ts +21 -0
- package/types/brep-src/algorithm/bool_sk/brep_converter.d.ts +11 -0
- package/types/brep-src/algorithm/brep_calc_project.d.ts +50 -0
- package/types/brep-src/algorithm/brep_calc_x.d.ts +34 -0
- package/types/brep-src/algorithm/brep_pj.d.ts +47 -0
- package/types/brep-src/algorithm/index.d.ts +5 -0
- package/types/brep-src/algorithm/intersect/curve_face_overlap.d.ts +10 -0
- package/types/brep-src/algorithm/intersect/face_face_intersect.d.ts +22 -0
- package/types/brep-src/algorithm/intersect/face_faces_intersect.d.ts +15 -0
- package/types/brep-src/algorithm/intersect/line_face_intersect.d.ts +16 -0
- package/types/brep-src/algorithm/podition_judge/body_pj.d.ts +25 -0
- package/types/brep-src/algorithm/podition_judge/extrude_pj.d.ts +28 -0
- package/types/brep-src/algorithm/podition_judge/pt_body_pj.d.ts +32 -0
- package/types/brep-src/algorithm/project/body_project.d.ts +8 -0
- package/types/brep-src/algorithm/project/face_project.d.ts +20 -0
- package/types/brep-src/algorithm/project/face_surface_project.d.ts +8 -0
- package/types/brep-src/algorithm/project/space_project.d.ts +26 -0
- package/types/brep-src/algorithm/project/space_project_simple.d.ts +10 -0
- package/types/brep-src/algorithm/project/view_project.d.ts +25 -0
- package/types/brep-src/algorithm/shell_builder/create_shell_from_curves.d.ts +38 -0
- package/types/brep-src/algorithm/shell_builder.d.ts +25 -0
- package/types/brep-src/algorithm/shell_edit/add_edges/add_edges.d.ts +14 -0
- package/types/brep-src/algorithm/shell_edit/add_edges/add_edges_core.d.ts +11 -0
- package/types/brep-src/algorithm/shell_edit/copy_faces.d.ts +20 -0
- package/types/brep-src/algorithm/shell_edit/delete_faces_edges/delete_edge.d.ts +9 -0
- package/types/brep-src/algorithm/shell_edit/delete_faces_edges/delete_faces_edges.d.ts +17 -0
- package/types/brep-src/algorithm/shell_edit/faces_boolean/faces_boolean.d.ts +19 -0
- package/types/brep-src/algorithm/shell_edit/faces_boolean/faces_shells_boolean.d.ts +13 -0
- package/types/brep-src/algorithm/shell_edit/faces_boolean/octree.d.ts +11 -0
- package/types/brep-src/algorithm/shell_edit/isolate_faces.d.ts +21 -0
- package/types/brep-src/algorithm/shell_edit/merge_connect_faces.d.ts +14 -0
- package/types/brep-src/algorithm/shell_edit/merge_edges.d.ts +8 -0
- package/types/brep-src/algorithm/shell_edit/move_operators/move_edges.d.ts +31 -0
- package/types/brep-src/algorithm/shell_edit/move_operators/move_faces.d.ts +14 -0
- package/types/brep-src/algorithm/shell_edit/operator/dispose_topo.d.ts +2 -0
- package/types/brep-src/algorithm/shell_edit/operator/merge_connect_edge.d.ts +3 -0
- package/types/brep-src/algorithm/shell_edit/operator/merge_connect_face.d.ts +2 -0
- package/types/brep-src/algorithm/shell_edit/operator/merge_overlap_edge.d.ts +3 -0
- package/types/brep-src/algorithm/shell_edit/operator/merge_shell.d.ts +11 -0
- package/types/brep-src/algorithm/shell_edit/operator/merge_vertex.d.ts +2 -0
- package/types/brep-src/algorithm/shell_edit/operator/split_edge.d.ts +4 -0
- package/types/brep-src/algorithm/shell_edit/operator/split_shell.d.ts +6 -0
- package/types/brep-src/algorithm/shell_edit/pull_push_face/pull_push_face.d.ts +18 -0
- package/types/brep-src/algorithm/shell_edit/pull_push_face/pull_push_face_core.d.ts +6 -0
- package/types/brep-src/algorithm/shell_edit/pull_push_face/pull_push_face_preview.d.ts +16 -0
- package/types/brep-src/algorithm/shell_edit/pull_push_face/pull_push_face_preview_core.d.ts +24 -0
- package/types/brep-src/algorithm/shell_edit/roundinng/2d_rounding.d.ts +22 -0
- package/types/brep-src/algorithm/shell_edit/shell_modeling_base.d.ts +10 -0
- package/types/brep-src/algorithm/shell_edit/shell_modeling_result.d.ts +21 -0
- package/types/brep-src/algorithm/shell_edit/smooth/detect_loop_util.d.ts +27 -0
- package/types/brep-src/algorithm/shell_edit/smooth/shell_modeling_util.d.ts +24 -0
- package/types/brep-src/algorithm/shell_edit/smooth/smooth_util.d.ts +22 -0
- package/types/brep-src/algorithm/shell_edit/split_edge.d.ts +10 -0
- package/types/brep-src/algorithm/shell_edit.d.ts +119 -0
- package/types/brep-src/algorithm/shell_valid/base_brep_topo_error.d.ts +176 -0
- package/types/brep-src/algorithm/shell_valid/diagnose_shell.d.ts +14 -0
- package/types/brep-src/brep/brep_body.d.ts +19 -0
- package/types/brep-src/brep/coedge3d.d.ts +83 -0
- package/types/brep-src/brep/edge.d.ts +96 -0
- package/types/brep-src/brep/face.d.ts +150 -0
- package/types/brep-src/brep/shell.d.ts +166 -0
- package/types/brep-src/brep/topo_object.d.ts +40 -0
- package/types/brep-src/brep/vertex.d.ts +48 -0
- package/types/brep-src/brep/wire.d.ts +66 -0
- package/types/brep-src/continuous/continuous_edge.d.ts +17 -0
- package/types/brep-src/continuous/continuous_face.d.ts +10 -0
- package/types/brep-src/continuous/continuous_util.d.ts +60 -0
- package/types/brep-src/continuous/continuous_uv.d.ts +24 -0
- package/types/brep-src/continuous/index.d.ts +4 -0
- package/types/brep-src/index.d.ts +14 -0
- package/types/brep-src/type_define/i_types.d.ts +46 -0
- package/types/brep-src/util/util.d.ts +23 -0
- package/types/conversion/units_conversion.d.ts +14 -0
- package/types/geometry/arc2d.d.ts +249 -0
- package/types/geometry/arc3d.d.ts +204 -0
- package/types/geometry/circle3d.d.ts +92 -0
- package/types/geometry/circular_surface.d.ts +52 -0
- package/types/geometry/coord_based_surface.d.ts +25 -0
- package/types/geometry/curve.d.ts +228 -0
- package/types/geometry/curve2.d.ts +62 -0
- package/types/geometry/curve3d.d.ts +66 -0
- package/types/geometry/cylinder.d.ts +73 -0
- package/types/geometry/discrete_arrow.d.ts +3 -0
- package/types/geometry/extend_curve2.d.ts +75 -0
- package/types/geometry/geometry2d.d.ts +35 -0
- package/types/geometry/geometry3d.d.ts +36 -0
- package/types/geometry/intersect_curve3.d.ts +90 -0
- package/types/geometry/ln2.d.ts +168 -0
- package/types/geometry/ln3.d.ts +152 -0
- package/types/geometry/nurbs_curve2.d.ts +106 -0
- package/types/geometry/nurbs_curve3.d.ts +191 -0
- package/types/geometry/offset_curve2.d.ts +63 -0
- package/types/geometry/offset_curve3.d.ts +97 -0
- package/types/geometry/offset_parameter_mapper.d.ts +72 -0
- package/types/geometry/plane.d.ts +109 -0
- package/types/geometry/polyline.d.ts +12 -0
- package/types/geometry/smooth_poly2.d.ts +78 -0
- package/types/geometry/smooth_poly3.d.ts +85 -0
- package/types/geometry/surface.d.ts +173 -0
- package/types/index.d.ts +78 -0
- package/types/io/obj_parser.d.ts +4 -0
- package/types/io/svgparser.d.ts +22 -0
- package/types/loader/loader.d.ts +23 -0
- package/types/loader/register_geo.d.ts +7 -0
- package/types/math/gauss_integration.d.ts +13 -0
- package/types/math/inv_bilinear.d.ts +33 -0
- package/types/solve_equations/cubic_equation.d.ts +7 -0
- package/types/solve_equations/linear_system.d.ts +6 -0
- package/types/solve_equations/nonlinear_system.d.ts +11 -0
- package/types/solve_equations/plurality.d.ts +9 -0
- package/types/solve_equations/polynomial_equation.d.ts +6 -0
- package/types/solve_equations/quadratic_equation.d.ts +6 -0
- package/types/solve_equations/quartic_equation.d.ts +6 -0
- package/types/solve_equations/solve_equation_util.d.ts +50 -0
- package/types/test_util/loop_generator.d.ts +21 -0
- package/types/topology/evolution_map.d.ts +90 -0
- package/types/topology/loop.d.ts +50 -0
- package/types/topology/polycurve.d.ts +109 -0
- package/types/topology/polygon.d.ts +118 -0
- package/types/topology/trimmed_surface.d.ts +136 -0
- package/types/type_define/const.d.ts +18 -0
- package/types/type_define/i_element.d.ts +9 -0
- package/types/type_define/i_element_type.d.ts +34 -0
- package/types/type_define/i_geometry.d.ts +191 -0
- package/types/type_define/i_types.d.ts +280 -0
- package/types/util/array_util.d.ts +8 -0
- package/types/util/assert.d.ts +21 -0
- package/types/util/clipper2_util.d.ts +5 -0
- package/types/util/clipper_format_converter.d.ts +21 -0
- package/types/util/clipper_util.d.ts +10 -0
- package/types/util/curve_util.d.ts +72 -0
- package/types/util/geom_util.d.ts +23 -0
- package/types/util/log.d.ts +19 -0
- package/types/util/math_error.d.ts +37 -0
- package/types/util/surface_util.d.ts +13 -0
- package/types/util/util.d.ts +18 -0
- package/types/util/uv_util.d.ts +68 -0
- package/types/verb/export_verb.d.ts +2 -0
- package/types/wasm/a2d.d.ts +19 -0
- package/types/wasm/bx2.d.ts +16 -0
- package/types/wasm/c2d.d.ts +29 -0
- package/types/wasm/elli.d.ts +19 -0
- package/types/wasm/grapher2d.d.ts +39 -0
- package/types/wasm/grapherutil.d.ts +9 -0
- package/types/wasm/l2d.d.ts +14 -0
- package/types/wasm/loader.d.ts +8 -0
- package/types/wasm/pt.d.ts +19 -0
- package/types/wasm/wasm-geom.d.ts +296 -0
- package/types/wasm/wasminstance.d.ts +19 -0
- package/types/wasm/wrapper.d.ts +82 -0
- package/README.md +0 -21
- package/dist/constants/geom_type.d.ts +0 -13
- package/dist/constants/geom_type.d.ts.map +0 -1
- package/dist/constants/geom_type.js +0 -17
- package/dist/constants/math_const.d.ts +0 -9
- package/dist/constants/math_const.d.ts.map +0 -1
- package/dist/constants/math_const.js +0 -12
- package/dist/core/box2.d.ts +0 -71
- package/dist/core/box2.d.ts.map +0 -1
- package/dist/core/box2.js +0 -243
- package/dist/core/coord2d.d.ts +0 -62
- package/dist/core/coord2d.d.ts.map +0 -1
- package/dist/core/coord2d.js +0 -155
- package/dist/core/geom_base.d.ts +0 -19
- package/dist/core/geom_base.d.ts.map +0 -1
- package/dist/core/geom_base.js +0 -18
- package/dist/core/mat3.d.ts +0 -101
- package/dist/core/mat3.d.ts.map +0 -1
- package/dist/core/mat3.js +0 -290
- package/dist/core/vec2.d.ts +0 -138
- package/dist/core/vec2.d.ts.map +0 -1
- package/dist/core/vec2.js +0 -297
- package/dist/curves/arc2.d.ts +0 -49
- package/dist/curves/arc2.d.ts.map +0 -1
- package/dist/curves/arc2.js +0 -265
- package/dist/curves/bspline2.d.ts +0 -150
- package/dist/curves/bspline2.d.ts.map +0 -1
- package/dist/curves/bspline2.js +0 -793
- package/dist/curves/circle2.d.ts +0 -42
- package/dist/curves/circle2.d.ts.map +0 -1
- package/dist/curves/circle2.js +0 -135
- package/dist/curves/circle_curve2.d.ts +0 -38
- package/dist/curves/circle_curve2.d.ts.map +0 -1
- package/dist/curves/circle_curve2.js +0 -112
- package/dist/curves/curve2.d.ts +0 -214
- package/dist/curves/curve2.d.ts.map +0 -1
- package/dist/curves/curve2.js +0 -238
- package/dist/curves/ellipse2.d.ts +0 -42
- package/dist/curves/ellipse2.d.ts.map +0 -1
- package/dist/curves/ellipse2.js +0 -125
- package/dist/curves/ellipse_arc2.d.ts +0 -49
- package/dist/curves/ellipse_arc2.d.ts.map +0 -1
- package/dist/curves/ellipse_arc2.js +0 -184
- package/dist/curves/ellipse_curve2.d.ts +0 -56
- package/dist/curves/ellipse_curve2.d.ts.map +0 -1
- package/dist/curves/ellipse_curve2.js +0 -262
- package/dist/curves/interval.d.ts +0 -112
- package/dist/curves/interval.d.ts.map +0 -1
- package/dist/curves/interval.js +0 -200
- package/dist/curves/line2.d.ts +0 -64
- package/dist/curves/line2.d.ts.map +0 -1
- package/dist/curves/line2.js +0 -193
- package/dist/curves/period_interval.d.ts +0 -129
- package/dist/curves/period_interval.d.ts.map +0 -1
- package/dist/curves/period_interval.js +0 -240
- package/dist/discretize/discretize_defaults.d.ts +0 -12
- package/dist/discretize/discretize_defaults.d.ts.map +0 -1
- package/dist/discretize/discretize_defaults.js +0 -12
- package/dist/discretize/discretize_engine.d.ts +0 -33
- package/dist/discretize/discretize_engine.d.ts.map +0 -1
- package/dist/discretize/discretize_engine.js +0 -347
- package/dist/discretize/discretize_errors.d.ts +0 -15
- package/dist/discretize/discretize_errors.d.ts.map +0 -1
- package/dist/discretize/discretize_errors.js +0 -30
- package/dist/discretize/discretize_options.d.ts +0 -18
- package/dist/discretize/discretize_options.d.ts.map +0 -1
- package/dist/discretize/discretize_options.js +0 -19
- package/dist/discretize/discretize_types.d.ts +0 -36
- package/dist/discretize/discretize_types.d.ts.map +0 -1
- package/dist/discretize/discretize_types.js +0 -1
- package/dist/discretize/internal/curve_guards.d.ts +0 -35
- package/dist/discretize/internal/curve_guards.d.ts.map +0 -1
- package/dist/discretize/internal/curve_guards.js +0 -62
- package/dist/discretize/internal/postprocess.d.ts +0 -5
- package/dist/discretize/internal/postprocess.d.ts.map +0 -1
- package/dist/discretize/internal/postprocess.js +0 -109
- package/dist/discretize/internal/sampling_utils.d.ts +0 -8
- package/dist/discretize/internal/sampling_utils.d.ts.map +0 -1
- package/dist/discretize/internal/sampling_utils.js +0 -36
- package/dist/discretize/register_builtin_strategies.d.ts +0 -3
- package/dist/discretize/register_builtin_strategies.d.ts.map +0 -1
- package/dist/discretize/register_builtin_strategies.js +0 -10
- package/dist/discretize/strategies/bspline_strategy.d.ts +0 -4
- package/dist/discretize/strategies/bspline_strategy.d.ts.map +0 -1
- package/dist/discretize/strategies/bspline_strategy.js +0 -115
- package/dist/discretize/strategies/circle_strategy.d.ts +0 -7
- package/dist/discretize/strategies/circle_strategy.d.ts.map +0 -1
- package/dist/discretize/strategies/circle_strategy.js +0 -55
- package/dist/discretize/strategies/ellipse_strategy.d.ts +0 -7
- package/dist/discretize/strategies/ellipse_strategy.d.ts.map +0 -1
- package/dist/discretize/strategies/ellipse_strategy.js +0 -86
- package/dist/discretize/strategies/line_strategy.d.ts +0 -4
- package/dist/discretize/strategies/line_strategy.d.ts.map +0 -1
- package/dist/discretize/strategies/line_strategy.js +0 -40
- package/dist/discretize/strategy_registry.d.ts +0 -9
- package/dist/discretize/strategy_registry.d.ts.map +0 -1
- package/dist/discretize/strategy_registry.js +0 -34
- package/dist/index.d.ts +0 -30
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -24
- package/dist/intersections/analytic_x_algorithm.d.ts +0 -10
- package/dist/intersections/analytic_x_algorithm.d.ts.map +0 -1
- package/dist/intersections/analytic_x_algorithm.js +0 -83
- package/dist/intersections/curve_x_engine.d.ts +0 -9
- package/dist/intersections/curve_x_engine.d.ts.map +0 -1
- package/dist/intersections/curve_x_engine.js +0 -27
- package/dist/intersections/index.d.ts +0 -5
- package/dist/intersections/index.d.ts.map +0 -1
- package/dist/intersections/index.js +0 -11
- package/dist/intersections/internal/certification.d.ts +0 -34
- package/dist/intersections/internal/certification.d.ts.map +0 -1
- package/dist/intersections/internal/certification.js +0 -238
- package/dist/intersections/internal/interval_clipping.d.ts +0 -29
- package/dist/intersections/internal/interval_clipping.d.ts.map +0 -1
- package/dist/intersections/internal/interval_clipping.js +0 -123
- package/dist/intersections/internal/kind.d.ts +0 -4
- package/dist/intersections/internal/kind.d.ts.map +0 -1
- package/dist/intersections/internal/kind.js +0 -16
- package/dist/intersections/internal/pair.d.ts +0 -9
- package/dist/intersections/internal/pair.d.ts.map +0 -1
- package/dist/intersections/internal/pair.js +0 -14
- package/dist/intersections/internal/result.d.ts +0 -20
- package/dist/intersections/internal/result.d.ts.map +0 -1
- package/dist/intersections/internal/result.js +0 -125
- package/dist/intersections/internal/sampling.d.ts +0 -15
- package/dist/intersections/internal/sampling.d.ts.map +0 -1
- package/dist/intersections/internal/sampling.js +0 -131
- package/dist/intersections/internal/segment.d.ts +0 -32
- package/dist/intersections/internal/segment.d.ts.map +0 -1
- package/dist/intersections/internal/segment.js +0 -137
- package/dist/intersections/internal/tolerance.d.ts +0 -10
- package/dist/intersections/internal/tolerance.d.ts.map +0 -1
- package/dist/intersections/internal/tolerance.js +0 -20
- package/dist/intersections/intersector.d.ts +0 -6
- package/dist/intersections/intersector.d.ts.map +0 -1
- package/dist/intersections/intersector.js +0 -1
- package/dist/intersections/numeric_x_algorithm.d.ts +0 -10
- package/dist/intersections/numeric_x_algorithm.d.ts.map +0 -1
- package/dist/intersections/numeric_x_algorithm.js +0 -73
- package/dist/intersections/solvers/bspline_self_solver.d.ts +0 -7
- package/dist/intersections/solvers/bspline_self_solver.d.ts.map +0 -1
- package/dist/intersections/solvers/bspline_self_solver.js +0 -308
- package/dist/intersections/solvers/line_line_pair_solver.d.ts +0 -7
- package/dist/intersections/solvers/line_line_pair_solver.d.ts.map +0 -1
- package/dist/intersections/solvers/line_line_pair_solver.js +0 -35
- package/dist/intersections/solvers/pair_solvers.d.ts +0 -94
- package/dist/intersections/solvers/pair_solvers.d.ts.map +0 -1
- package/dist/intersections/solvers/pair_solvers.js +0 -1078
- package/dist/intersections/solvers/polyline_pair_intersector.d.ts +0 -51
- package/dist/intersections/solvers/polyline_pair_intersector.d.ts.map +0 -1
- package/dist/intersections/solvers/polyline_pair_intersector.js +0 -731
- package/dist/intersections/types.d.ts +0 -11
- package/dist/intersections/types.d.ts.map +0 -1
- package/dist/intersections/types.js +0 -1
- package/dist/serialize/dump_types.d.ts +0 -101
- package/dist/serialize/dump_types.d.ts.map +0 -1
- package/dist/serialize/dump_types.js +0 -5
- package/dist/serialize/geom_mgr.d.ts +0 -24
- package/dist/serialize/geom_mgr.d.ts.map +0 -1
- package/dist/serialize/geom_mgr.js +0 -30
- package/dist/types/type_define.d.ts +0 -29
- package/dist/types/type_define.d.ts.map +0 -1
- package/dist/types/type_define.js +0 -10
- package/dist/types/type_guard.d.ts +0 -46
- package/dist/types/type_guard.d.ts.map +0 -1
- package/dist/types/type_guard.js +0 -5
- package/dist/utils/math_error.d.ts +0 -16
- package/dist/utils/math_error.d.ts.map +0 -1
- package/dist/utils/math_error.js +0 -35
- package/dist/utils/math_utils.d.ts +0 -9
- package/dist/utils/math_utils.d.ts.map +0 -1
- package/dist/utils/math_utils.js +0 -25
- package/dist/utils/precision.d.ts +0 -29
- package/dist/utils/precision.d.ts.map +0 -1
- package/dist/utils/precision.js +0 -44
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Vec2 } from '../core/vec2';
|
|
2
|
-
import type { Curve2 } from '../curves/curve2';
|
|
3
|
-
import { DiscretizeOptions } from './discretize_options';
|
|
4
|
-
export declare class DiscretizeEngine {
|
|
5
|
-
private constructor();
|
|
6
|
-
private static readonly CHORD_CHECK_FRACTIONS;
|
|
7
|
-
private static readonly HARD_MAX_SEGMENTS;
|
|
8
|
-
private static readonly HARD_MAX_REFINEMENT_STEPS;
|
|
9
|
-
static discretize(curve: Curve2, options?: DiscretizeOptions): Vec2[];
|
|
10
|
-
private static dispatch;
|
|
11
|
-
private static postprocessResult;
|
|
12
|
-
private static discretizeLineCurve;
|
|
13
|
-
private static discretizeCircleLikeCurve;
|
|
14
|
-
private static discretizeEllipseLikeCurve;
|
|
15
|
-
private static discretizeBSplineCurve;
|
|
16
|
-
private static dThetaByChord;
|
|
17
|
-
private static buildCircleLikeSamples;
|
|
18
|
-
private static buildInitialEllipseSegments;
|
|
19
|
-
private static buildInitialBSplineSegments;
|
|
20
|
-
private static refineAdaptiveSegments;
|
|
21
|
-
private static registerSegment;
|
|
22
|
-
private static popValidHeapItem;
|
|
23
|
-
private static pushMaxHeap;
|
|
24
|
-
private static popMaxHeap;
|
|
25
|
-
private static evaluateAdaptiveSegment;
|
|
26
|
-
private static isTurnCriterionRelevant;
|
|
27
|
-
private static segmentsToSamples;
|
|
28
|
-
private static maxChordDeviationAtFractions;
|
|
29
|
-
private static distancePointToSegment;
|
|
30
|
-
private static tangentTurnAbs;
|
|
31
|
-
private static deduplicateAdjacent;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=discretize_engine.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discretize_engine.d.ts","sourceRoot":"","sources":["../../src/discretize/discretize_engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAIxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAI9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAyBxD,qBAAa,gBAAgB;IACzB,OAAO;IAEP,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAA6B;IAC1E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAY;IACrD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAY;WAE/C,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI,EAAE;IAQ5E,OAAO,CAAC,MAAM,CAAC,QAAQ;IAkBvB,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAoChC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IASlC,OAAO,CAAC,MAAM,CAAC,yBAAyB;IA2BxC,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAazC,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAarC,OAAO,CAAC,MAAM,CAAC,aAAa;IAO5B,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAerC,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAmB1C,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAwB1C,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAoDrC,OAAO,CAAC,MAAM,CAAC,eAAe;IAiB9B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAS/B,OAAO,CAAC,MAAM,CAAC,WAAW;IAa1B,OAAO,CAAC,MAAM,CAAC,UAAU;IAuBzB,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAgCtC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAKtC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAQhC,OAAO,CAAC,MAAM,CAAC,4BAA4B;IAoB3C,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAarC,OAAO,CAAC,MAAM,CAAC,cAAc;IAS7B,OAAO,CAAC,MAAM,CAAC,mBAAmB;CAYrC"}
|
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
import { MathError } from '../utils/math_error';
|
|
2
|
-
import { MathUtils } from '../utils/math_utils';
|
|
3
|
-
import { Precision } from '../utils/precision';
|
|
4
|
-
import { DiscretizeOptions } from './discretize_options';
|
|
5
|
-
export class DiscretizeEngine {
|
|
6
|
-
constructor() { }
|
|
7
|
-
static discretize(curve, options) {
|
|
8
|
-
const resolved = options ?? DiscretizeOptions.medium;
|
|
9
|
-
MathError.assert(curve.isValid(), '离散参数错误: 曲线无效');
|
|
10
|
-
const raw = this.dispatch(curve, resolved);
|
|
11
|
-
const samples = this.postprocessResult(curve, raw, resolved);
|
|
12
|
-
return samples.map((sample) => sample.p.clone());
|
|
13
|
-
}
|
|
14
|
-
static dispatch(curve, options) {
|
|
15
|
-
if (curve.isLine())
|
|
16
|
-
return this.discretizeLineCurve(curve);
|
|
17
|
-
if (curve.isCircle() || curve.isArc()) {
|
|
18
|
-
return this.discretizeCircleLikeCurve(curve, options);
|
|
19
|
-
}
|
|
20
|
-
if (curve.isEllipse() || curve.isEllipseArc()) {
|
|
21
|
-
return this.discretizeEllipseLikeCurve(curve, options);
|
|
22
|
-
}
|
|
23
|
-
if (curve.isBSpline()) {
|
|
24
|
-
return this.discretizeBSplineCurve(curve, options);
|
|
25
|
-
}
|
|
26
|
-
MathError.assert(false, `离散不支持: ${curve.getType()}`);
|
|
27
|
-
}
|
|
28
|
-
static postprocessResult(curve, raw, options) {
|
|
29
|
-
const range = curve.getRange();
|
|
30
|
-
const startParam = range.start;
|
|
31
|
-
const endParam = range.end;
|
|
32
|
-
const startPoint = curve.pointAt(startParam);
|
|
33
|
-
const endPoint = curve.pointAt(endParam);
|
|
34
|
-
let samples = raw.map((sample) => ({ u: sample.u, p: sample.p }));
|
|
35
|
-
if (samples.length === 0) {
|
|
36
|
-
samples = [{ u: startParam, p: startPoint }];
|
|
37
|
-
}
|
|
38
|
-
samples = this.deduplicateAdjacent(samples, options.chordTol);
|
|
39
|
-
samples[0] = { u: startParam, p: startPoint };
|
|
40
|
-
if (curve.isClosed()) {
|
|
41
|
-
while (samples.length > 1) {
|
|
42
|
-
const first = samples[0];
|
|
43
|
-
const last = samples[samples.length - 1];
|
|
44
|
-
if (first.p.distanceTo(last.p) <= options.chordTol) {
|
|
45
|
-
samples.pop();
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
const endSample = {
|
|
53
|
-
u: endParam,
|
|
54
|
-
p: endPoint,
|
|
55
|
-
};
|
|
56
|
-
samples[samples.length - 1] = endSample;
|
|
57
|
-
}
|
|
58
|
-
return samples;
|
|
59
|
-
}
|
|
60
|
-
static discretizeLineCurve(curve) {
|
|
61
|
-
const range = curve.getRange();
|
|
62
|
-
if (curve.isDegenerate())
|
|
63
|
-
return [{ u: range.start, p: curve.pointAt(range.start) }];
|
|
64
|
-
return [
|
|
65
|
-
{ u: range.start, p: curve.pointAt(range.start) },
|
|
66
|
-
{ u: range.end, p: curve.pointAt(range.end) },
|
|
67
|
-
];
|
|
68
|
-
}
|
|
69
|
-
static discretizeCircleLikeCurve(curve, options) {
|
|
70
|
-
const range = curve.getRange();
|
|
71
|
-
const sweep = range.length();
|
|
72
|
-
if (curve.isDegenerate())
|
|
73
|
-
return [{ u: range.start, p: curve.pointAt(range.start) }];
|
|
74
|
-
const totalLen = curve.length();
|
|
75
|
-
const radius = curve.radius;
|
|
76
|
-
MathError.assert(Number.isFinite(radius) && radius > 0, `离散不支持: ${curve.getType()} 半径无效`);
|
|
77
|
-
const maxByInternal = Math.max(1, Math.floor(totalLen / Precision.CURVE_LENGTH_EPS));
|
|
78
|
-
const maxByMinLength = Math.max(1, Math.ceil(totalLen / options.minSegmentLength));
|
|
79
|
-
const dThetaChord = this.dThetaByChord(radius, options.chordTol);
|
|
80
|
-
const dTheta = Math.max(Precision.CURVE_PARAM_EPS, Math.min(dThetaChord, options.angleTolRad));
|
|
81
|
-
const byTolerance = Math.max(1, Math.ceil(sweep / dTheta));
|
|
82
|
-
const requiredSegments = Math.min(byTolerance, maxByInternal, maxByMinLength, this.HARD_MAX_SEGMENTS);
|
|
83
|
-
const closed = curve.isClosed();
|
|
84
|
-
return this.buildCircleLikeSamples(curve, requiredSegments, closed);
|
|
85
|
-
}
|
|
86
|
-
static discretizeEllipseLikeCurve(curve, options) {
|
|
87
|
-
const range = curve.getRange();
|
|
88
|
-
if (curve.isDegenerate())
|
|
89
|
-
return [{ u: range.start, p: curve.pointAt(range.start) }];
|
|
90
|
-
const initialSegmentCount = 1;
|
|
91
|
-
const segments = this.refineAdaptiveSegments(curve, this.buildInitialEllipseSegments(curve, initialSegmentCount), options);
|
|
92
|
-
return this.segmentsToSamples(segments);
|
|
93
|
-
}
|
|
94
|
-
static discretizeBSplineCurve(curve, options) {
|
|
95
|
-
const range = curve.getRange();
|
|
96
|
-
if (curve.isDegenerate())
|
|
97
|
-
return [{ u: range.start, p: curve.pointAt(range.start) }];
|
|
98
|
-
const initialSegments = this.buildInitialBSplineSegments(curve);
|
|
99
|
-
if (initialSegments.length === 0) {
|
|
100
|
-
return [{ u: range.start, p: curve.pointAt(range.start) }];
|
|
101
|
-
}
|
|
102
|
-
const refined = this.refineAdaptiveSegments(curve, initialSegments, options);
|
|
103
|
-
return this.segmentsToSamples(refined);
|
|
104
|
-
}
|
|
105
|
-
static dThetaByChord(radius, chordTol) {
|
|
106
|
-
const ratio = 1 - chordTol / radius;
|
|
107
|
-
if (ratio <= -1)
|
|
108
|
-
return Math.PI * 2;
|
|
109
|
-
const clamped = Math.min(1, Math.max(-1, ratio));
|
|
110
|
-
return 2 * Math.acos(clamped);
|
|
111
|
-
}
|
|
112
|
-
static buildCircleLikeSamples(curve, segmentCount, closed) {
|
|
113
|
-
const range = curve.getRange();
|
|
114
|
-
const start = range.start;
|
|
115
|
-
const span = range.length();
|
|
116
|
-
const steps = closed ? segmentCount : segmentCount + 1;
|
|
117
|
-
const samples = [];
|
|
118
|
-
for (let i = 0; i < steps; i++) {
|
|
119
|
-
const t = i / segmentCount;
|
|
120
|
-
const u = start + span * t;
|
|
121
|
-
samples.push({ u, p: curve.pointAt(u) });
|
|
122
|
-
}
|
|
123
|
-
return samples;
|
|
124
|
-
}
|
|
125
|
-
static buildInitialEllipseSegments(curve, segmentCount) {
|
|
126
|
-
const range = curve.getRange();
|
|
127
|
-
const start = range.start;
|
|
128
|
-
const span = range.length();
|
|
129
|
-
const segments = [];
|
|
130
|
-
for (let i = 0; i < segmentCount; i++) {
|
|
131
|
-
const u0 = start + (span * i) / segmentCount;
|
|
132
|
-
const u1 = start + (span * (i + 1)) / segmentCount;
|
|
133
|
-
segments.push({
|
|
134
|
-
u0,
|
|
135
|
-
u1,
|
|
136
|
-
p0: curve.pointAt(u0),
|
|
137
|
-
p1: curve.pointAt(u1),
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
return segments;
|
|
141
|
-
}
|
|
142
|
-
static buildInitialBSplineSegments(curve) {
|
|
143
|
-
const range = curve.getRange();
|
|
144
|
-
const boundaries = new Set([
|
|
145
|
-
range.start,
|
|
146
|
-
range.end,
|
|
147
|
-
...curve.getContinuityBreakParams(Precision.CURVE_PARAM_EPS),
|
|
148
|
-
]);
|
|
149
|
-
const sorted = [...boundaries].sort((a, b) => a - b);
|
|
150
|
-
const segments = [];
|
|
151
|
-
for (let i = 0; i < sorted.length - 1; i++) {
|
|
152
|
-
const u0 = sorted[i];
|
|
153
|
-
const u1 = sorted[i + 1];
|
|
154
|
-
if (u1 - u0 <= Precision.CURVE_PARAM_EPS)
|
|
155
|
-
continue;
|
|
156
|
-
segments.push({
|
|
157
|
-
u0,
|
|
158
|
-
u1,
|
|
159
|
-
p0: curve.pointAt(u0),
|
|
160
|
-
p1: curve.pointAt(u1),
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
return segments;
|
|
164
|
-
}
|
|
165
|
-
static refineAdaptiveSegments(curve, initialSegments, options) {
|
|
166
|
-
const states = new Map();
|
|
167
|
-
const heap = [];
|
|
168
|
-
let nextId = 1;
|
|
169
|
-
for (const segment of initialSegments) {
|
|
170
|
-
nextId = this.registerSegment(states, heap, nextId, curve, segment, options);
|
|
171
|
-
}
|
|
172
|
-
for (;;) {
|
|
173
|
-
if (states.size >= this.HARD_MAX_SEGMENTS || nextId >= this.HARD_MAX_REFINEMENT_STEPS) {
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
const picked = this.popValidHeapItem(heap, states);
|
|
177
|
-
if (!picked)
|
|
178
|
-
break;
|
|
179
|
-
const segment = states.get(picked.id);
|
|
180
|
-
if (!segment)
|
|
181
|
-
continue;
|
|
182
|
-
const decision = this.evaluateAdaptiveSegment(curve, segment, options);
|
|
183
|
-
if (!decision.split)
|
|
184
|
-
continue;
|
|
185
|
-
MathError.assert(!decision.blocked, '离散溢出: 无法继续细分');
|
|
186
|
-
const mid = (segment.u0 + segment.u1) * 0.5;
|
|
187
|
-
MathError.assert(Math.abs(mid - segment.u0) > Precision.CURVE_PARAM_EPS
|
|
188
|
-
&& Math.abs(segment.u1 - mid) > Precision.CURVE_PARAM_EPS, '离散不收敛');
|
|
189
|
-
const pm = curve.pointAt(mid);
|
|
190
|
-
const left = {
|
|
191
|
-
u0: segment.u0,
|
|
192
|
-
u1: mid,
|
|
193
|
-
p0: segment.p0,
|
|
194
|
-
p1: pm,
|
|
195
|
-
};
|
|
196
|
-
const right = {
|
|
197
|
-
u0: mid,
|
|
198
|
-
u1: segment.u1,
|
|
199
|
-
p0: pm,
|
|
200
|
-
p1: segment.p1,
|
|
201
|
-
};
|
|
202
|
-
states.delete(picked.id);
|
|
203
|
-
nextId = this.registerSegment(states, heap, nextId, curve, left, options);
|
|
204
|
-
nextId = this.registerSegment(states, heap, nextId, curve, right, options);
|
|
205
|
-
}
|
|
206
|
-
return [...states.values()]
|
|
207
|
-
.sort((a, b) => a.u0 - b.u0 || a.u1 - b.u1);
|
|
208
|
-
}
|
|
209
|
-
static registerSegment(states, heap, nextId, curve, segment, options) {
|
|
210
|
-
const id = nextId;
|
|
211
|
-
states.set(id, segment);
|
|
212
|
-
const decision = this.evaluateAdaptiveSegment(curve, segment, options);
|
|
213
|
-
if (decision.split) {
|
|
214
|
-
this.pushMaxHeap(heap, { id, score: decision.score });
|
|
215
|
-
}
|
|
216
|
-
return nextId + 1;
|
|
217
|
-
}
|
|
218
|
-
static popValidHeapItem(heap, states) {
|
|
219
|
-
for (;;) {
|
|
220
|
-
const candidate = this.popMaxHeap(heap);
|
|
221
|
-
if (!candidate)
|
|
222
|
-
return undefined;
|
|
223
|
-
if (!states.has(candidate.id))
|
|
224
|
-
continue;
|
|
225
|
-
return candidate;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
static pushMaxHeap(heap, item) {
|
|
229
|
-
heap.push(item);
|
|
230
|
-
let i = heap.length - 1;
|
|
231
|
-
while (i > 0) {
|
|
232
|
-
const p = (i - 1) >> 1;
|
|
233
|
-
if (heap[p].score >= heap[i].score)
|
|
234
|
-
break;
|
|
235
|
-
const tmp = heap[p];
|
|
236
|
-
heap[p] = heap[i];
|
|
237
|
-
heap[i] = tmp;
|
|
238
|
-
i = p;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
static popMaxHeap(heap) {
|
|
242
|
-
if (heap.length === 0)
|
|
243
|
-
return undefined;
|
|
244
|
-
const top = heap[0];
|
|
245
|
-
const tail = heap.pop();
|
|
246
|
-
if (tail && heap.length > 0) {
|
|
247
|
-
heap[0] = tail;
|
|
248
|
-
let i = 0;
|
|
249
|
-
for (;;) {
|
|
250
|
-
const l = i * 2 + 1;
|
|
251
|
-
const r = l + 1;
|
|
252
|
-
let m = i;
|
|
253
|
-
if (l < heap.length && heap[l].score > heap[m].score)
|
|
254
|
-
m = l;
|
|
255
|
-
if (r < heap.length && heap[r].score > heap[m].score)
|
|
256
|
-
m = r;
|
|
257
|
-
if (m === i)
|
|
258
|
-
break;
|
|
259
|
-
const tmp = heap[m];
|
|
260
|
-
heap[m] = heap[i];
|
|
261
|
-
heap[i] = tmp;
|
|
262
|
-
i = m;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
return top;
|
|
266
|
-
}
|
|
267
|
-
static evaluateAdaptiveSegment(curve, segment, options) {
|
|
268
|
-
const chordLenSq = segment.p0.distanceToSq(segment.p1);
|
|
269
|
-
const midParam = MathUtils.lerp(segment.u0, segment.u1, 0.5);
|
|
270
|
-
const midPoint = curve.pointAt(midParam);
|
|
271
|
-
const approxLength = segment.p0.distanceTo(midPoint) + midPoint.distanceTo(segment.p1);
|
|
272
|
-
if (approxLength <= options.minSegmentLength) {
|
|
273
|
-
return { split: false, blocked: false, score: 0 };
|
|
274
|
-
}
|
|
275
|
-
const useTurn = this.isTurnCriterionRelevant(chordLenSq, options);
|
|
276
|
-
const deviation = this.maxChordDeviationAtFractions(curve, segment.u0, segment.u1, segment.p0, segment.p1);
|
|
277
|
-
const turn = useTurn ? this.tangentTurnAbs(curve, segment.u0, segment.u1) : 0;
|
|
278
|
-
const splitByDeviation = deviation > options.chordTol;
|
|
279
|
-
const splitByTurn = useTurn && turn > options.angleTolRad;
|
|
280
|
-
const split = splitByDeviation || splitByTurn;
|
|
281
|
-
const blocked = split && Math.abs(segment.u1 - segment.u0) <= Precision.CURVE_PARAM_EPS;
|
|
282
|
-
const chordTolSafe = Math.max(options.chordTol, Precision.CURVE_LENGTH_EPS);
|
|
283
|
-
const angleTolSafe = Math.max(options.angleTolRad, Precision.ANG_EPS);
|
|
284
|
-
const scoreDeviation = deviation / chordTolSafe;
|
|
285
|
-
const scoreTurn = useTurn ? (turn / angleTolSafe) : 0;
|
|
286
|
-
const score = Math.max(scoreDeviation, scoreTurn);
|
|
287
|
-
return { split, blocked, score };
|
|
288
|
-
}
|
|
289
|
-
static isTurnCriterionRelevant(chordLenSq, options) {
|
|
290
|
-
const minChordForTurn = Math.max(options.chordTol * 2, Precision.CURVE_LENGTH_EPS * 10);
|
|
291
|
-
return chordLenSq > minChordForTurn * minChordForTurn;
|
|
292
|
-
}
|
|
293
|
-
static segmentsToSamples(segments) {
|
|
294
|
-
const samples = [{ u: segments[0].u0, p: segments[0].p0 }];
|
|
295
|
-
for (const segment of segments) {
|
|
296
|
-
samples.push({ u: segment.u1, p: segment.p1 });
|
|
297
|
-
}
|
|
298
|
-
return samples;
|
|
299
|
-
}
|
|
300
|
-
static maxChordDeviationAtFractions(curve, u0, u1, p0, p1, fractions = this.CHORD_CHECK_FRACTIONS) {
|
|
301
|
-
let maxDeviation = 0;
|
|
302
|
-
for (const fraction of fractions) {
|
|
303
|
-
const um = MathUtils.lerp(u0, u1, fraction);
|
|
304
|
-
const pm = curve.pointAt(um);
|
|
305
|
-
const deviation = this.distancePointToSegment(pm, p0, p1);
|
|
306
|
-
if (deviation > maxDeviation) {
|
|
307
|
-
maxDeviation = deviation;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
return maxDeviation;
|
|
311
|
-
}
|
|
312
|
-
static distancePointToSegment(point, segStart, segEnd) {
|
|
313
|
-
const edge = segEnd.subtracted(segStart);
|
|
314
|
-
const lenSq = edge.lenSq();
|
|
315
|
-
if (lenSq <= Precision.CURVE_LENGTH_EPS_SQ) {
|
|
316
|
-
return point.distanceTo(segStart);
|
|
317
|
-
}
|
|
318
|
-
const rel = point.subtracted(segStart);
|
|
319
|
-
const t = Math.max(0, Math.min(1, rel.dot(edge) / lenSq));
|
|
320
|
-
const proj = segStart.added(edge.scaled(t));
|
|
321
|
-
return point.distanceTo(proj);
|
|
322
|
-
}
|
|
323
|
-
static tangentTurnAbs(curve, u0, u1) {
|
|
324
|
-
const t0 = curve.tangentAt(u0);
|
|
325
|
-
const t1 = curve.tangentAt(u1);
|
|
326
|
-
if (Math.min(t0.lenSq(), t1.lenSq()) <= Precision.CURVE_NEWTON_EPS) {
|
|
327
|
-
return 0;
|
|
328
|
-
}
|
|
329
|
-
return Math.abs(t0.angleTo(t1));
|
|
330
|
-
}
|
|
331
|
-
static deduplicateAdjacent(samples, tol) {
|
|
332
|
-
if (samples.length <= 1)
|
|
333
|
-
return samples;
|
|
334
|
-
const deduped = [samples[0]];
|
|
335
|
-
for (let i = 1; i < samples.length; i++) {
|
|
336
|
-
const prev = deduped[deduped.length - 1];
|
|
337
|
-
const cur = samples[i];
|
|
338
|
-
if (prev.p.distanceTo(cur.p) <= tol)
|
|
339
|
-
continue;
|
|
340
|
-
deduped.push(cur);
|
|
341
|
-
}
|
|
342
|
-
return deduped;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
DiscretizeEngine.CHORD_CHECK_FRACTIONS = [0.25, 0.5, 0.75];
|
|
346
|
-
DiscretizeEngine.HARD_MAX_SEGMENTS = 1000000;
|
|
347
|
-
DiscretizeEngine.HARD_MAX_REFINEMENT_STEPS = 2000000;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const DISCRETIZE_ERROR_PREFIX: Readonly<{
|
|
2
|
-
options: "DiscretizeOptionsError";
|
|
3
|
-
notSupported: "DiscretizeNotSupported";
|
|
4
|
-
overflow: "DiscretizeOverflowError";
|
|
5
|
-
convergence: "DiscretizeConvergenceError";
|
|
6
|
-
}>;
|
|
7
|
-
type DiscretizeErrorPrefix = typeof DISCRETIZE_ERROR_PREFIX[keyof typeof DISCRETIZE_ERROR_PREFIX];
|
|
8
|
-
export declare function throwDiscretizeError(prefix: DiscretizeErrorPrefix, message: string): never;
|
|
9
|
-
export declare function assertDiscretize(condition: unknown, prefix: DiscretizeErrorPrefix, message: string): asserts condition;
|
|
10
|
-
export declare function throwDiscretizeOptionsError(message: string): never;
|
|
11
|
-
export declare function throwDiscretizeNotSupportedError(message: string): never;
|
|
12
|
-
export declare function throwDiscretizeOverflowError(message: string): never;
|
|
13
|
-
export declare function throwDiscretizeConvergenceError(message: string): never;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=discretize_errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discretize_errors.d.ts","sourceRoot":"","sources":["../../src/discretize/discretize_errors.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB;;;;;EAKlC,CAAA;AAEF,KAAK,qBAAqB,GAAG,OAAO,uBAAuB,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAA;AAMjG,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAE1F;AAED,wBAAgB,gBAAgB,CAC5B,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,GAChB,OAAO,CAAC,SAAS,CAInB;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAElE;AAED,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAEvE;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAEnE;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAEtE"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { MathError } from '../utils/math_error';
|
|
2
|
-
export const DISCRETIZE_ERROR_PREFIX = Object.freeze({
|
|
3
|
-
options: 'DiscretizeOptionsError',
|
|
4
|
-
notSupported: 'DiscretizeNotSupported',
|
|
5
|
-
overflow: 'DiscretizeOverflowError',
|
|
6
|
-
convergence: 'DiscretizeConvergenceError',
|
|
7
|
-
});
|
|
8
|
-
function makeMessage(prefix, message) {
|
|
9
|
-
return `${prefix}: ${message}`;
|
|
10
|
-
}
|
|
11
|
-
export function throwDiscretizeError(prefix, message) {
|
|
12
|
-
MathError.throw(makeMessage(prefix, message));
|
|
13
|
-
}
|
|
14
|
-
export function assertDiscretize(condition, prefix, message) {
|
|
15
|
-
if (!condition) {
|
|
16
|
-
throwDiscretizeError(prefix, message);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export function throwDiscretizeOptionsError(message) {
|
|
20
|
-
return throwDiscretizeError(DISCRETIZE_ERROR_PREFIX.options, message);
|
|
21
|
-
}
|
|
22
|
-
export function throwDiscretizeNotSupportedError(message) {
|
|
23
|
-
return throwDiscretizeError(DISCRETIZE_ERROR_PREFIX.notSupported, message);
|
|
24
|
-
}
|
|
25
|
-
export function throwDiscretizeOverflowError(message) {
|
|
26
|
-
return throwDiscretizeError(DISCRETIZE_ERROR_PREFIX.overflow, message);
|
|
27
|
-
}
|
|
28
|
-
export function throwDiscretizeConvergenceError(message) {
|
|
29
|
-
return throwDiscretizeError(DISCRETIZE_ERROR_PREFIX.convergence, message);
|
|
30
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 曲线离散参数类。
|
|
3
|
-
*/
|
|
4
|
-
export declare class DiscretizeOptions {
|
|
5
|
-
static readonly low: DiscretizeOptions;
|
|
6
|
-
static readonly medium: DiscretizeOptions;
|
|
7
|
-
static readonly high: DiscretizeOptions;
|
|
8
|
-
static readonly ultra: DiscretizeOptions;
|
|
9
|
-
/** 弦高容差(世界坐标长度单位)。 */
|
|
10
|
-
chordTol: number;
|
|
11
|
-
/** 相邻采样切向转角容差(弧度)。 */
|
|
12
|
-
angleTolRad: number;
|
|
13
|
-
/** 允许继续细分的最小线段长度。 */
|
|
14
|
-
minSegmentLength: number;
|
|
15
|
-
constructor(chordTol?: number, angleTolRad?: number, minSegmentLength?: number);
|
|
16
|
-
clone(): DiscretizeOptions;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=discretize_options.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discretize_options.d.ts","sourceRoot":"","sources":["../../src/discretize/discretize_options.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,iBAAiB;IAC1B,gBAAuB,GAAG,oBAAkD;IAE5E,gBAAuB,MAAM,oBAAkD;IAE/E,gBAAuB,IAAI,oBAAmD;IAE9E,gBAAuB,KAAK,oBAAmD;IAE/E,sBAAsB;IACf,QAAQ,EAAE,MAAM,CAAA;IAEvB,sBAAsB;IACf,WAAW,EAAE,MAAM,CAAA;IAE1B,qBAAqB;IACd,gBAAgB,EAAE,MAAM,CAAA;gBAG3B,QAAQ,SAAO,EACf,WAAW,SAAgB,EAC3B,gBAAgB,SAAO;IAWpB,KAAK,IAAI,iBAAiB;CAIpC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { MathError } from '../utils/math_error';
|
|
2
|
-
/**
|
|
3
|
-
* 曲线离散参数类。
|
|
4
|
-
*/
|
|
5
|
-
export class DiscretizeOptions {
|
|
6
|
-
constructor(chordTol = 1e-3, angleTolRad = Math.PI / 180, minSegmentLength = 1e-6) {
|
|
7
|
-
MathError.assert(Number.isFinite(minSegmentLength) && minSegmentLength > 0, 'DiscretizeOptionsError: minSegmentLength 必须是大于 0 的有限数');
|
|
8
|
-
this.chordTol = chordTol;
|
|
9
|
-
this.angleTolRad = angleTolRad;
|
|
10
|
-
this.minSegmentLength = minSegmentLength;
|
|
11
|
-
}
|
|
12
|
-
clone() {
|
|
13
|
-
return new DiscretizeOptions(this.chordTol, this.angleTolRad, this.minSegmentLength);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
DiscretizeOptions.low = new DiscretizeOptions(5e-2, Math.PI / 18, 5e-3);
|
|
17
|
-
DiscretizeOptions.medium = new DiscretizeOptions(5e-3, Math.PI / 90, 5e-4);
|
|
18
|
-
DiscretizeOptions.high = new DiscretizeOptions(1e-4, Math.PI / 360, 1e-5);
|
|
19
|
-
DiscretizeOptions.ultra = new DiscretizeOptions(1e-5, Math.PI / 720, 1e-6);
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { Vec2 } from '../core/vec2';
|
|
2
|
-
export interface DiscretizeOptions {
|
|
3
|
-
mode?: 'world' | 'view';
|
|
4
|
-
chordTol?: number;
|
|
5
|
-
angleTolRad?: number;
|
|
6
|
-
maxSegmentLength?: number;
|
|
7
|
-
minSegments?: number;
|
|
8
|
-
maxSegments?: number;
|
|
9
|
-
includeEnd?: boolean;
|
|
10
|
-
pointMergeTol?: number;
|
|
11
|
-
pixelTol?: number;
|
|
12
|
-
worldPerPixel?: number;
|
|
13
|
-
}
|
|
14
|
-
export interface ResolvedDiscretizeOptions {
|
|
15
|
-
mode: 'world';
|
|
16
|
-
chordTol: number;
|
|
17
|
-
angleTolRad: number;
|
|
18
|
-
maxSegmentLength: number;
|
|
19
|
-
minSegments: number;
|
|
20
|
-
maxSegments: number;
|
|
21
|
-
minSegmentsExplicit: boolean;
|
|
22
|
-
includeEnd: boolean;
|
|
23
|
-
pointMergeTol: number;
|
|
24
|
-
effectiveChordTol: number;
|
|
25
|
-
effectivePointMergeTol: number;
|
|
26
|
-
minSegmentLengthInternal: number;
|
|
27
|
-
}
|
|
28
|
-
export interface PolylineSample {
|
|
29
|
-
u: number;
|
|
30
|
-
p: Vec2;
|
|
31
|
-
}
|
|
32
|
-
export interface DiscretizeResult {
|
|
33
|
-
samples: PolylineSample[];
|
|
34
|
-
closed: boolean;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=discretize_types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discretize_types.d.ts","sourceRoot":"","sources":["../../src/discretize/discretize_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAExC,MAAM,WAAW,iBAAiB;IAC9B,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAEvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,yBAAyB;IACtC,IAAI,EAAE,OAAO,CAAA;IAEb,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;IAExB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,EAAE,OAAO,CAAA;IAE5B,UAAU,EAAE,OAAO,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IAErB,iBAAiB,EAAE,MAAM,CAAA;IACzB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,wBAAwB,EAAE,MAAM,CAAA;CACnC;AAED,MAAM,WAAW,cAAc;IAC3B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,IAAI,CAAA;CACV;AAED,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,MAAM,EAAE,OAAO,CAAA;CAClB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Vec2 } from '../../core/vec2';
|
|
2
|
-
import type { Curve2 } from '../../curves/curve2';
|
|
3
|
-
export type LineCurveLike = Curve2 & {
|
|
4
|
-
start: Vec2;
|
|
5
|
-
end: Vec2;
|
|
6
|
-
};
|
|
7
|
-
export type CircleCurveLike = Curve2 & {
|
|
8
|
-
center: Vec2;
|
|
9
|
-
radius: number;
|
|
10
|
-
};
|
|
11
|
-
export type ArcCurveLike = CircleCurveLike & {
|
|
12
|
-
clockwise: boolean;
|
|
13
|
-
};
|
|
14
|
-
export type EllipseCurveLike = Curve2 & {
|
|
15
|
-
center: Vec2;
|
|
16
|
-
rx: number;
|
|
17
|
-
ry: number;
|
|
18
|
-
rotation: number;
|
|
19
|
-
};
|
|
20
|
-
export type EllipseArcCurveLike = EllipseCurveLike & {
|
|
21
|
-
clockwise: boolean;
|
|
22
|
-
};
|
|
23
|
-
export type BSplineCurveLike = Curve2 & {
|
|
24
|
-
degree: number;
|
|
25
|
-
expandedKnots: number[];
|
|
26
|
-
controlPoints: Vec2[];
|
|
27
|
-
};
|
|
28
|
-
export declare function isLineCurveLike(curve: Curve2): curve is LineCurveLike;
|
|
29
|
-
export declare function isCircleCurveLike(curve: Curve2): curve is CircleCurveLike;
|
|
30
|
-
export declare function isArcCurveLike(curve: Curve2): curve is ArcCurveLike;
|
|
31
|
-
export declare function isEllipseCurveLike(curve: Curve2): curve is EllipseCurveLike;
|
|
32
|
-
export declare function isEllipseArcCurveLike(curve: Curve2): curve is EllipseArcCurveLike;
|
|
33
|
-
export declare function isBSplineCurveLike(curve: Curve2): curve is BSplineCurveLike;
|
|
34
|
-
export declare function isCurveSemanticallyClosed(curve: Curve2): boolean;
|
|
35
|
-
//# sourceMappingURL=curve_guards.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"curve_guards.d.ts","sourceRoot":"","sources":["../../../src/discretize/internal/curve_guards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAEjD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,IAAI,CAAA;CAAE,CAAA;AAC/D,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AACvE,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAA;AACnE,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA;AAClG,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,CAAA;AAC3E,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAC;IAAC,aAAa,EAAE,IAAI,EAAE,CAAA;CAAE,CAAA;AAc1G,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,aAAa,CAGrE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,eAAe,CAKzE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,YAAY,CAGnE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,gBAAgB,CAM3E;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,mBAAmB,CAOjF;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,gBAAgB,CAM3E;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,WAOtD"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Vec2 } from '../../core/vec2';
|
|
2
|
-
import { Precision } from '../../utils/precision';
|
|
3
|
-
function isVec2(value) {
|
|
4
|
-
return value instanceof Vec2;
|
|
5
|
-
}
|
|
6
|
-
function isFiniteNumber(value) {
|
|
7
|
-
return typeof value === 'number' && Number.isFinite(value);
|
|
8
|
-
}
|
|
9
|
-
function hasBoolean(value) {
|
|
10
|
-
return typeof value === 'boolean';
|
|
11
|
-
}
|
|
12
|
-
export function isLineCurveLike(curve) {
|
|
13
|
-
const c = curve;
|
|
14
|
-
return isVec2(c.start) && isVec2(c.end);
|
|
15
|
-
}
|
|
16
|
-
export function isCircleCurveLike(curve) {
|
|
17
|
-
const c = curve;
|
|
18
|
-
if (!isVec2(c.center) || !isFiniteNumber(c.radius))
|
|
19
|
-
return false;
|
|
20
|
-
const maybeArc = curve;
|
|
21
|
-
return !hasBoolean(maybeArc.clockwise);
|
|
22
|
-
}
|
|
23
|
-
export function isArcCurveLike(curve) {
|
|
24
|
-
const c = curve;
|
|
25
|
-
return isVec2(c.center) && isFiniteNumber(c.radius) && hasBoolean(c.clockwise);
|
|
26
|
-
}
|
|
27
|
-
export function isEllipseCurveLike(curve) {
|
|
28
|
-
const c = curve;
|
|
29
|
-
if (!isVec2(c.center))
|
|
30
|
-
return false;
|
|
31
|
-
if (!isFiniteNumber(c.rx) || !isFiniteNumber(c.ry) || !isFiniteNumber(c.rotation))
|
|
32
|
-
return false;
|
|
33
|
-
const maybeArc = curve;
|
|
34
|
-
return !hasBoolean(maybeArc.clockwise);
|
|
35
|
-
}
|
|
36
|
-
export function isEllipseArcCurveLike(curve) {
|
|
37
|
-
const c = curve;
|
|
38
|
-
return isVec2(c.center) &&
|
|
39
|
-
isFiniteNumber(c.rx) &&
|
|
40
|
-
isFiniteNumber(c.ry) &&
|
|
41
|
-
isFiniteNumber(c.rotation) &&
|
|
42
|
-
hasBoolean(c.clockwise);
|
|
43
|
-
}
|
|
44
|
-
export function isBSplineCurveLike(curve) {
|
|
45
|
-
const c = curve;
|
|
46
|
-
if (!isFiniteNumber(c.degree))
|
|
47
|
-
return false;
|
|
48
|
-
if (!Array.isArray(c.expandedKnots) || !c.expandedKnots.every((k) => Number.isFinite(k)))
|
|
49
|
-
return false;
|
|
50
|
-
if (!Array.isArray(c.controlPoints) || !c.controlPoints.every((p) => p instanceof Vec2))
|
|
51
|
-
return false;
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
export function isCurveSemanticallyClosed(curve) {
|
|
55
|
-
if (isCircleCurveLike(curve) || isEllipseCurveLike(curve))
|
|
56
|
-
return true;
|
|
57
|
-
if (isArcCurveLike(curve) || isEllipseArcCurveLike(curve)) {
|
|
58
|
-
const sweep = curve.getRange().length();
|
|
59
|
-
return Math.abs(sweep - Math.PI * 2) <= Precision.CURVE_PARAM_EPS;
|
|
60
|
-
}
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Curve2 } from '../../curves/curve2';
|
|
2
|
-
import type { DiscretizeResult, ResolvedDiscretizeOptions } from '../discretize_types';
|
|
3
|
-
export declare function postprocessDiscretizeResult(curve: Curve2, raw: DiscretizeResult, options: ResolvedDiscretizeOptions): DiscretizeResult;
|
|
4
|
-
export declare function assertDiscretizeResult(curve: Curve2, result: DiscretizeResult, options: ResolvedDiscretizeOptions): void;
|
|
5
|
-
//# sourceMappingURL=postprocess.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postprocess.d.ts","sourceRoot":"","sources":["../../../src/discretize/internal/postprocess.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAGjD,OAAO,KAAK,EAAE,gBAAgB,EAAkB,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAkEtG,wBAAgB,2BAA2B,CACvC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,gBAAgB,EACrB,OAAO,EAAE,yBAAyB,oBA+BrC;AAED,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,yBAAyB,QA+BrC"}
|