@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,125 +0,0 @@
|
|
|
1
|
-
import { Interval } from '../../curves/interval';
|
|
2
|
-
import { Precision } from '../../utils/precision';
|
|
3
|
-
export function swapCurveXInfos(items) {
|
|
4
|
-
return items.map((item) => ({
|
|
5
|
-
point: item.point.clone(),
|
|
6
|
-
u1: item.u2,
|
|
7
|
-
u2: item.u1,
|
|
8
|
-
isOverlap: item.isOverlap,
|
|
9
|
-
range1: item.range2 ? new Interval(item.range2.start, item.range2.end) : undefined,
|
|
10
|
-
range2: item.range1 ? new Interval(item.range1.start, item.range1.end) : undefined,
|
|
11
|
-
}));
|
|
12
|
-
}
|
|
13
|
-
export function postprocessCurveXInfos(items, pointTol = Precision.CURVE_LENGTH_EPS * 8) {
|
|
14
|
-
const deduped = deduplicateCurveXInfos(items, pointTol);
|
|
15
|
-
const merged = mergeOverlaps(deduped);
|
|
16
|
-
return merged.sort((a, b) => a.u1 - b.u1 || a.u2 - b.u2);
|
|
17
|
-
}
|
|
18
|
-
export function analyzeCurveXInfosQuality(items, pointTol = Precision.CURVE_LENGTH_EPS * 8) {
|
|
19
|
-
const rawCount = items.length;
|
|
20
|
-
const overlapCount = items.filter((x) => x.isOverlap).length;
|
|
21
|
-
const uniquePoints = [];
|
|
22
|
-
for (const item of items) {
|
|
23
|
-
if (item.isOverlap)
|
|
24
|
-
continue;
|
|
25
|
-
const dup = uniquePoints.some((u) => u.point.distanceTo(item.point) <= pointTol);
|
|
26
|
-
if (!dup)
|
|
27
|
-
uniquePoints.push(item);
|
|
28
|
-
}
|
|
29
|
-
const uniquePointCount = uniquePoints.length;
|
|
30
|
-
const uniqueCount = uniquePointCount + overlapCount;
|
|
31
|
-
const duplicatePointCount = Math.max(0, rawCount - overlapCount - uniquePointCount);
|
|
32
|
-
return {
|
|
33
|
-
rawCount,
|
|
34
|
-
uniqueCount,
|
|
35
|
-
overlapCount,
|
|
36
|
-
uniquePointCount,
|
|
37
|
-
duplicatePointCount,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
function deduplicateCurveXInfos(items, pointTol) {
|
|
41
|
-
const sorted = [...items].sort((a, b) => a.u1 - b.u1 || a.u2 - b.u2);
|
|
42
|
-
const ret = [];
|
|
43
|
-
for (const cur of sorted) {
|
|
44
|
-
let merged = false;
|
|
45
|
-
for (const prev of ret) {
|
|
46
|
-
if (!isSameCurveXInfo(prev, cur, pointTol))
|
|
47
|
-
continue;
|
|
48
|
-
if (prev.isOverlap) {
|
|
49
|
-
prev.range1 = mergeRange(prev.range1, cur.range1);
|
|
50
|
-
prev.range2 = mergeRange(prev.range2, cur.range2);
|
|
51
|
-
}
|
|
52
|
-
merged = true;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
if (!merged)
|
|
56
|
-
ret.push(cur);
|
|
57
|
-
}
|
|
58
|
-
return ret;
|
|
59
|
-
}
|
|
60
|
-
function mergeOverlaps(items) {
|
|
61
|
-
const points = items.filter((x) => !x.isOverlap);
|
|
62
|
-
const overlaps = items.filter((x) => x.isOverlap);
|
|
63
|
-
if (overlaps.length <= 1)
|
|
64
|
-
return [...points, ...overlaps];
|
|
65
|
-
overlaps.sort((a, b) => (a.range1?.start ?? a.u1) - (b.range1?.start ?? b.u1));
|
|
66
|
-
const merged = [normalizeOverlap(overlaps[0])];
|
|
67
|
-
for (let i = 1; i < overlaps.length; i++) {
|
|
68
|
-
const cur = normalizeOverlap(overlaps[i]);
|
|
69
|
-
const prev = merged[merged.length - 1];
|
|
70
|
-
if (!prev.range1 || !cur.range1 || !prev.range2 || !cur.range2) {
|
|
71
|
-
merged.push(cur);
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
if (cur.range1.start <= prev.range1.end + Precision.CURVE_PARAM_EPS) {
|
|
75
|
-
prev.range1 = new Interval(prev.range1.start, Math.max(prev.range1.end, cur.range1.end));
|
|
76
|
-
prev.range2 = new Interval(prev.range2.start, Math.max(prev.range2.end, cur.range2.end));
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
merged.push(cur);
|
|
80
|
-
}
|
|
81
|
-
return [...points, ...merged];
|
|
82
|
-
}
|
|
83
|
-
function mergeRange(a, b) {
|
|
84
|
-
if (!a)
|
|
85
|
-
return b ? new Interval(b.start, b.end) : undefined;
|
|
86
|
-
if (!b)
|
|
87
|
-
return new Interval(a.start, a.end);
|
|
88
|
-
return new Interval(Math.min(a.start, b.start), Math.max(a.end, b.end));
|
|
89
|
-
}
|
|
90
|
-
function isSameCurveXInfo(a, b, pointTol) {
|
|
91
|
-
if (a.isOverlap !== b.isOverlap)
|
|
92
|
-
return false;
|
|
93
|
-
const paramTol = Precision.CURVE_PARAM_EPS * 8;
|
|
94
|
-
if (!a.isOverlap && a.point.distanceTo(b.point) <= pointTol) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
if (Math.abs(a.u1 - b.u1) <= paramTol * 8 &&
|
|
98
|
-
Math.abs(a.u2 - b.u2) <= paramTol * 8 &&
|
|
99
|
-
a.point.distanceTo(b.point) <= pointTol * 2) {
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
if (!a.isOverlap || !a.range1 || !a.range2 || !b.range1 || !b.range2) {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
const a1 = normalizeRange(a.range1);
|
|
106
|
-
const a2 = normalizeRange(a.range2);
|
|
107
|
-
const b1 = normalizeRange(b.range1);
|
|
108
|
-
const b2 = normalizeRange(b.range2);
|
|
109
|
-
return (Math.abs(a1.start - b1.start) <= paramTol &&
|
|
110
|
-
Math.abs(a1.end - b1.end) <= paramTol &&
|
|
111
|
-
Math.abs(a2.start - b2.start) <= paramTol &&
|
|
112
|
-
Math.abs(a2.end - b2.end) <= paramTol);
|
|
113
|
-
}
|
|
114
|
-
function normalizeOverlap(item) {
|
|
115
|
-
if (!item.isOverlap)
|
|
116
|
-
return item;
|
|
117
|
-
return {
|
|
118
|
-
...item,
|
|
119
|
-
range1: item.range1 ? normalizeRange(item.range1) : undefined,
|
|
120
|
-
range2: item.range2 ? normalizeRange(item.range2) : undefined,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
function normalizeRange(x) {
|
|
124
|
-
return x.start <= x.end ? x : new Interval(x.end, x.start);
|
|
125
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Curve2 } from '../../curves/curve2';
|
|
2
|
-
import { Vec2 } from '../../core/vec2';
|
|
3
|
-
export type CurveSample = {
|
|
4
|
-
u: number;
|
|
5
|
-
p: Vec2;
|
|
6
|
-
};
|
|
7
|
-
export declare function sampleCurveByParam(curve: Curve2, segmentCount: number): CurveSample[];
|
|
8
|
-
export type AdaptiveSampleOptions = {
|
|
9
|
-
maxDepth?: number;
|
|
10
|
-
chordErrorTol?: number;
|
|
11
|
-
tangentAngleTol?: number;
|
|
12
|
-
maxSamples?: number;
|
|
13
|
-
};
|
|
14
|
-
export declare function sampleCurveAdaptive(curve: Curve2, targetSegmentCount: number, options?: AdaptiveSampleOptions): CurveSample[];
|
|
15
|
-
//# sourceMappingURL=sampling.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sampling.d.ts","sourceRoot":"","sources":["../../../src/intersections/internal/sampling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAItC,MAAM,MAAM,WAAW,GAAG;IACtB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,IAAI,CAAA;CACV,CAAA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,WAAW,EAAE,CAUrF;AAED,MAAM,MAAM,qBAAqB,GAAG;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B,GAAG,WAAW,EAAE,CA4CjI"}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { Precision } from '../../utils/precision';
|
|
2
|
-
import { MathUtils } from '../../utils/math_utils';
|
|
3
|
-
export function sampleCurveByParam(curve, segmentCount) {
|
|
4
|
-
const range = curve.getRange();
|
|
5
|
-
const total = Math.max(2, segmentCount);
|
|
6
|
-
const samples = [];
|
|
7
|
-
for (let i = 0; i <= total; i++) {
|
|
8
|
-
const t = i / total;
|
|
9
|
-
const u = range.start + (range.end - range.start) * t;
|
|
10
|
-
samples.push({ u, p: curve.pointAt(u) });
|
|
11
|
-
}
|
|
12
|
-
return collapseDuplicateSamplePoints(samples);
|
|
13
|
-
}
|
|
14
|
-
export function sampleCurveAdaptive(curve, targetSegmentCount, options = {}) {
|
|
15
|
-
const range = curve.getRange();
|
|
16
|
-
if (range.length() <= Precision.CURVE_PARAM_EPS) {
|
|
17
|
-
return [{ u: range.start, p: curve.pointAt(range.start) }];
|
|
18
|
-
}
|
|
19
|
-
const bbox = curve.boundingBox();
|
|
20
|
-
const diag = Math.hypot(bbox.width(), bbox.height());
|
|
21
|
-
const scale = Math.max(diag, 1);
|
|
22
|
-
const segCount = Math.max(8, targetSegmentCount);
|
|
23
|
-
const maxDepth = options.maxDepth ?? (Math.ceil(Math.log2(segCount)) + 8);
|
|
24
|
-
const chordErrorTol = options.chordErrorTol ?? Math.max(Precision.CURVE_LENGTH_EPS * 8, scale / (segCount * 10));
|
|
25
|
-
const tangentAngleTol = options.tangentAngleTol ?? 0.22;
|
|
26
|
-
const maxSamples = options.maxSamples ?? segCount * 8;
|
|
27
|
-
const cutParams = collectCutParams(curve);
|
|
28
|
-
const samples = [];
|
|
29
|
-
for (let i = 0; i < cutParams.length - 1; i++) {
|
|
30
|
-
const u0 = cutParams[i];
|
|
31
|
-
const u1 = cutParams[i + 1];
|
|
32
|
-
if (u1 - u0 <= Precision.CURVE_PARAM_EPS)
|
|
33
|
-
continue;
|
|
34
|
-
const p0 = curve.pointAt(u0);
|
|
35
|
-
const p1 = curve.pointAt(u1);
|
|
36
|
-
subdivideAdaptive(curve, u0, p0, u1, p1, 0, maxDepth, chordErrorTol, tangentAngleTol, maxSamples, samples);
|
|
37
|
-
}
|
|
38
|
-
// Ensure terminal endpoint is present.
|
|
39
|
-
const end = cutParams[cutParams.length - 1];
|
|
40
|
-
samples.push({ u: end, p: curve.pointAt(end) });
|
|
41
|
-
return collapseDuplicateSamplePoints(samples);
|
|
42
|
-
}
|
|
43
|
-
function collectCutParams(curve) {
|
|
44
|
-
const range = curve.getRange();
|
|
45
|
-
const cuts = [range.start];
|
|
46
|
-
if (curve.isBSpline()) {
|
|
47
|
-
for (const u of curve.getContinuityBreakParams(Precision.CURVE_PARAM_EPS)) {
|
|
48
|
-
if (u > range.start + Precision.CURVE_PARAM_EPS && u < range.end - Precision.CURVE_PARAM_EPS) {
|
|
49
|
-
cuts.push(u);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
cuts.push(range.end);
|
|
54
|
-
cuts.sort((a, b) => a - b);
|
|
55
|
-
const unique = [];
|
|
56
|
-
for (const u of cuts) {
|
|
57
|
-
if (unique.length === 0 || Math.abs(unique[unique.length - 1] - u) > Precision.CURVE_PARAM_EPS) {
|
|
58
|
-
unique.push(u);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return unique;
|
|
62
|
-
}
|
|
63
|
-
function subdivideAdaptive(curve, u0, p0, u1, p1, depth, maxDepth, chordErrorTol, tangentAngleTol, maxSamples, out) {
|
|
64
|
-
if (out.length >= maxSamples) {
|
|
65
|
-
out.push({ u: u0, p: p0 });
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (!shouldSplit(curve, u0, p0, u1, p1, depth, maxDepth, chordErrorTol, tangentAngleTol)) {
|
|
69
|
-
out.push({ u: u0, p: p0 });
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const um = 0.5 * (u0 + u1);
|
|
73
|
-
if (um <= u0 + Precision.CURVE_PARAM_EPS || um >= u1 - Precision.CURVE_PARAM_EPS) {
|
|
74
|
-
out.push({ u: u0, p: p0 });
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const pm = curve.pointAt(um);
|
|
78
|
-
subdivideAdaptive(curve, u0, p0, um, pm, depth + 1, maxDepth, chordErrorTol, tangentAngleTol, maxSamples, out);
|
|
79
|
-
subdivideAdaptive(curve, um, pm, u1, p1, depth + 1, maxDepth, chordErrorTol, tangentAngleTol, maxSamples, out);
|
|
80
|
-
}
|
|
81
|
-
function shouldSplit(curve, u0, p0, u1, p1, depth, maxDepth, chordErrorTol, tangentAngleTol) {
|
|
82
|
-
if (depth >= maxDepth)
|
|
83
|
-
return false;
|
|
84
|
-
if (u1 - u0 <= Precision.CURVE_PARAM_EPS * 2)
|
|
85
|
-
return false;
|
|
86
|
-
const chord = p1.subtracted(p0);
|
|
87
|
-
const chordLen = chord.len();
|
|
88
|
-
if (chordLen <= Precision.CURVE_LENGTH_EPS)
|
|
89
|
-
return true;
|
|
90
|
-
const um = 0.5 * (u0 + u1);
|
|
91
|
-
const pm = curve.pointAt(um);
|
|
92
|
-
const midError = pointToLineDistance(pm, p0, p1, chordLen);
|
|
93
|
-
if (midError > chordErrorTol)
|
|
94
|
-
return true;
|
|
95
|
-
const t0 = curve.tangentAt(u0);
|
|
96
|
-
const t1 = curve.tangentAt(u1);
|
|
97
|
-
if (t0.len() <= Precision.CURVE_NEWTON_EPS || t1.len() <= Precision.CURVE_NEWTON_EPS)
|
|
98
|
-
return true;
|
|
99
|
-
const a0 = vectorAngle(t0, chord);
|
|
100
|
-
const a1 = vectorAngle(t1, chord);
|
|
101
|
-
const ae = vectorAngle(t0, t1);
|
|
102
|
-
return a0 > tangentAngleTol || a1 > tangentAngleTol || ae > tangentAngleTol * 2;
|
|
103
|
-
}
|
|
104
|
-
function pointToLineDistance(p, a, b, abLen) {
|
|
105
|
-
if (abLen <= Precision.CURVE_LENGTH_EPS)
|
|
106
|
-
return p.distanceTo(a);
|
|
107
|
-
const ap = p.subtracted(a);
|
|
108
|
-
const ab = b.subtracted(a);
|
|
109
|
-
return Math.abs(ap.cross(ab)) / abLen;
|
|
110
|
-
}
|
|
111
|
-
function vectorAngle(v1, v2) {
|
|
112
|
-
const l1 = v1.len();
|
|
113
|
-
const l2 = v2.len();
|
|
114
|
-
if (l1 <= Precision.CURVE_NEWTON_EPS || l2 <= Precision.CURVE_NEWTON_EPS)
|
|
115
|
-
return Math.PI;
|
|
116
|
-
const x = v1.dot(v2) / (l1 * l2);
|
|
117
|
-
return Math.acos(MathUtils.clamp(x, -1, 1));
|
|
118
|
-
}
|
|
119
|
-
function collapseDuplicateSamplePoints(samples) {
|
|
120
|
-
if (samples.length <= 1)
|
|
121
|
-
return samples;
|
|
122
|
-
const ret = [samples[0]];
|
|
123
|
-
for (let i = 1; i < samples.length; i++) {
|
|
124
|
-
const prev = ret[ret.length - 1];
|
|
125
|
-
const cur = samples[i];
|
|
126
|
-
if (prev.p.distanceTo(cur.p) <= Precision.CURVE_LENGTH_EPS)
|
|
127
|
-
continue;
|
|
128
|
-
ret.push(cur);
|
|
129
|
-
}
|
|
130
|
-
return ret;
|
|
131
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Vec2 } from '../../core/vec2';
|
|
2
|
-
export type Segment = {
|
|
3
|
-
p0: Vec2;
|
|
4
|
-
p1: Vec2;
|
|
5
|
-
v: Vec2;
|
|
6
|
-
len: number;
|
|
7
|
-
unit: Vec2;
|
|
8
|
-
minX: number;
|
|
9
|
-
minY: number;
|
|
10
|
-
maxX: number;
|
|
11
|
-
maxY: number;
|
|
12
|
-
};
|
|
13
|
-
export type SegmentHit = {
|
|
14
|
-
kind: 'none';
|
|
15
|
-
} | {
|
|
16
|
-
kind: 'point';
|
|
17
|
-
t1: number;
|
|
18
|
-
t2: number;
|
|
19
|
-
} | {
|
|
20
|
-
kind: 'overlap';
|
|
21
|
-
t1s: number;
|
|
22
|
-
t1e: number;
|
|
23
|
-
t2s: number;
|
|
24
|
-
t2e: number;
|
|
25
|
-
};
|
|
26
|
-
export declare function makeSegment(p0: Vec2, p1: Vec2): Segment;
|
|
27
|
-
export declare function segmentBoxesMayIntersect(s1: Segment, s2: Segment, pad?: number): boolean;
|
|
28
|
-
export declare function segmentDistance(s1: Segment, s2: Segment): number;
|
|
29
|
-
export declare function intersectSegments(s1: Segment, s2: Segment): SegmentHit;
|
|
30
|
-
export declare function pointAtSegmentUnit(seg: Segment, t: number): Vec2;
|
|
31
|
-
export declare function lerp(a: number, b: number, t: number): number;
|
|
32
|
-
//# sourceMappingURL=segment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"segment.d.ts","sourceRoot":"","sources":["../../../src/intersections/internal/segment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAGtC,MAAM,MAAM,OAAO,GAAG;IAClB,EAAE,EAAE,IAAI,CAAA;IACR,EAAE,EAAE,IAAI,CAAA;IACR,CAAC,EAAE,IAAI,CAAA;IACP,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,IAAI,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,UAAU,GAChB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7E,wBAAgB,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,GAAG,OAAO,CAmBvD;AAED,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,SAA6B,WAElG;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,UAoBvD;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,GAAG,UAAU,CAqBtE;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,QAEzD;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAEnD"}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { Vec2 } from '../../core/vec2';
|
|
2
|
-
import { Precision } from '../../utils/precision';
|
|
3
|
-
export function makeSegment(p0, p1) {
|
|
4
|
-
const v = p1.subtracted(p0);
|
|
5
|
-
const len = v.len();
|
|
6
|
-
const unit = len > Precision.CURVE_LENGTH_EPS ? v.scaled(1 / len) : Vec2.zero();
|
|
7
|
-
const minX = Math.min(p0.x, p1.x);
|
|
8
|
-
const minY = Math.min(p0.y, p1.y);
|
|
9
|
-
const maxX = Math.max(p0.x, p1.x);
|
|
10
|
-
const maxY = Math.max(p0.y, p1.y);
|
|
11
|
-
return {
|
|
12
|
-
p0: p0.clone(),
|
|
13
|
-
p1: p1.clone(),
|
|
14
|
-
v,
|
|
15
|
-
len,
|
|
16
|
-
unit,
|
|
17
|
-
minX,
|
|
18
|
-
minY,
|
|
19
|
-
maxX,
|
|
20
|
-
maxY,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export function segmentBoxesMayIntersect(s1, s2, pad = Precision.CURVE_LENGTH_EPS) {
|
|
24
|
-
return !(s1.maxX + pad < s2.minX || s2.maxX + pad < s1.minX || s1.maxY + pad < s2.minY || s2.maxY + pad < s1.minY);
|
|
25
|
-
}
|
|
26
|
-
export function segmentDistance(s1, s2) {
|
|
27
|
-
if (s1.len <= Precision.CURVE_LENGTH_EPS && s2.len <= Precision.CURVE_LENGTH_EPS) {
|
|
28
|
-
return s1.p0.distanceTo(s2.p0);
|
|
29
|
-
}
|
|
30
|
-
if (s1.len <= Precision.CURVE_LENGTH_EPS) {
|
|
31
|
-
return pointSegmentDistance(s1.p0, s2);
|
|
32
|
-
}
|
|
33
|
-
if (s2.len <= Precision.CURVE_LENGTH_EPS) {
|
|
34
|
-
return pointSegmentDistance(s2.p0, s1);
|
|
35
|
-
}
|
|
36
|
-
const hit = intersectSegments(s1, s2);
|
|
37
|
-
if (hit.kind !== 'none')
|
|
38
|
-
return 0;
|
|
39
|
-
return Math.min(pointSegmentDistance(s1.p0, s2), pointSegmentDistance(s1.p1, s2), pointSegmentDistance(s2.p0, s1), pointSegmentDistance(s2.p1, s1));
|
|
40
|
-
}
|
|
41
|
-
export function intersectSegments(s1, s2) {
|
|
42
|
-
if (s1.len <= Precision.CURVE_LENGTH_EPS || s2.len <= Precision.CURVE_LENGTH_EPS) {
|
|
43
|
-
return { kind: 'none' };
|
|
44
|
-
}
|
|
45
|
-
const cross = s1.v.cross(s2.v);
|
|
46
|
-
const delta = s2.p0.subtracted(s1.p0);
|
|
47
|
-
const collinear = delta.cross(s1.v);
|
|
48
|
-
const crossTol = crossTolerance(s1, s2);
|
|
49
|
-
const collinearTol = collinearTolerance(s1, s2, delta.len());
|
|
50
|
-
const rangeTol = paramRangeTolerance(s1, s2);
|
|
51
|
-
if (Math.abs(cross) <= crossTol) {
|
|
52
|
-
if (Math.abs(collinear) > collinearTol)
|
|
53
|
-
return { kind: 'none' };
|
|
54
|
-
return intersectCollinearSegments(s1, s2, rangeTol);
|
|
55
|
-
}
|
|
56
|
-
const t1Raw = delta.cross(s2.v) / cross;
|
|
57
|
-
const t2Raw = delta.cross(s1.v) / cross;
|
|
58
|
-
if (!inRange01(t1Raw, rangeTol) || !inRange01(t2Raw, rangeTol))
|
|
59
|
-
return { kind: 'none' };
|
|
60
|
-
return { kind: 'point', t1: clamp01(t1Raw), t2: clamp01(t2Raw) };
|
|
61
|
-
}
|
|
62
|
-
export function pointAtSegmentUnit(seg, t) {
|
|
63
|
-
return seg.p0.added(seg.v.scaled(t));
|
|
64
|
-
}
|
|
65
|
-
export function lerp(a, b, t) {
|
|
66
|
-
return a + (b - a) * t;
|
|
67
|
-
}
|
|
68
|
-
function intersectCollinearSegments(s1, s2, tol) {
|
|
69
|
-
const x0 = s2.p0.subtracted(s1.p0).dot(s1.unit);
|
|
70
|
-
const x1 = s2.p1.subtracted(s1.p0).dot(s1.unit);
|
|
71
|
-
const os = Math.max(0, Math.min(x0, x1));
|
|
72
|
-
const oe = Math.min(s1.len, Math.max(x0, x1));
|
|
73
|
-
if (oe < os - tol)
|
|
74
|
-
return { kind: 'none' };
|
|
75
|
-
if (Math.abs(oe - os) <= tol) {
|
|
76
|
-
const pos1 = clamp(os, 0, s1.len);
|
|
77
|
-
const p = s1.p0.added(s1.unit.scaled(pos1));
|
|
78
|
-
const pos2 = clamp(p.subtracted(s2.p0).dot(s2.unit), 0, s2.len);
|
|
79
|
-
return {
|
|
80
|
-
kind: 'point',
|
|
81
|
-
t1: s1.len > 0 ? pos1 / s1.len : 0,
|
|
82
|
-
t2: s2.len > 0 ? pos2 / s2.len : 0,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
const p1s = clamp(os, 0, s1.len);
|
|
86
|
-
const p1e = clamp(oe, 0, s1.len);
|
|
87
|
-
const ps = s1.p0.added(s1.unit.scaled(p1s));
|
|
88
|
-
const pe = s1.p0.added(s1.unit.scaled(p1e));
|
|
89
|
-
const p2s = clamp(ps.subtracted(s2.p0).dot(s2.unit), 0, s2.len);
|
|
90
|
-
const p2e = clamp(pe.subtracted(s2.p0).dot(s2.unit), 0, s2.len);
|
|
91
|
-
return {
|
|
92
|
-
kind: 'overlap',
|
|
93
|
-
t1s: s1.len > 0 ? p1s / s1.len : 0,
|
|
94
|
-
t1e: s1.len > 0 ? p1e / s1.len : 0,
|
|
95
|
-
t2s: s2.len > 0 ? p2s / s2.len : 0,
|
|
96
|
-
t2e: s2.len > 0 ? p2e / s2.len : 0,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
function inRange01(t, eps) {
|
|
100
|
-
return t >= -eps && t <= 1 + eps;
|
|
101
|
-
}
|
|
102
|
-
function clamp01(t) {
|
|
103
|
-
return clamp(t, 0, 1);
|
|
104
|
-
}
|
|
105
|
-
function clamp(x, min, max) {
|
|
106
|
-
return Math.min(max, Math.max(min, x));
|
|
107
|
-
}
|
|
108
|
-
function pointSegmentDistance(p, s) {
|
|
109
|
-
if (s.len <= Precision.CURVE_LENGTH_EPS)
|
|
110
|
-
return p.distanceTo(s.p0);
|
|
111
|
-
const t = clamp(p.subtracted(s.p0).dot(s.v) / (s.len * s.len), 0, 1);
|
|
112
|
-
const q = pointAtSegmentUnit(s, t);
|
|
113
|
-
return p.distanceTo(q);
|
|
114
|
-
}
|
|
115
|
-
function segmentScale(s1, s2) {
|
|
116
|
-
const maxCoord = Math.max(Math.abs(s1.p0.x), Math.abs(s1.p0.y), Math.abs(s1.p1.x), Math.abs(s1.p1.y), Math.abs(s2.p0.x), Math.abs(s2.p0.y), Math.abs(s2.p1.x), Math.abs(s2.p1.y), 1);
|
|
117
|
-
return {
|
|
118
|
-
maxLen: Math.max(s1.len, s2.len, 1),
|
|
119
|
-
maxCoord,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
function crossTolerance(s1, s2) {
|
|
123
|
-
const { maxLen, maxCoord } = segmentScale(s1, s2);
|
|
124
|
-
const lenProd = Math.max(s1.len * s2.len, 1);
|
|
125
|
-
const base = Math.max(Precision.CURVE_LENGTH_EPS * maxLen, maxCoord * 1e-12 * maxLen);
|
|
126
|
-
return Math.max(base, lenProd * 1e-12);
|
|
127
|
-
}
|
|
128
|
-
function collinearTolerance(s1, s2, deltaLen) {
|
|
129
|
-
const { maxLen, maxCoord } = segmentScale(s1, s2);
|
|
130
|
-
const lever = Math.max(deltaLen, maxLen, 1);
|
|
131
|
-
const base = Math.max(Precision.CURVE_LENGTH_EPS * lever, maxCoord * 1e-12 * lever);
|
|
132
|
-
return Math.max(base, maxLen * lever * 1e-12);
|
|
133
|
-
}
|
|
134
|
-
function paramRangeTolerance(s1, s2) {
|
|
135
|
-
const { maxLen } = segmentScale(s1, s2);
|
|
136
|
-
return Math.max(Precision.CURVE_PARAM_EPS, 1e-10 / maxLen);
|
|
137
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Curve2 } from '../../curves/curve2';
|
|
2
|
-
export type IntersectionTolerance = {
|
|
3
|
-
pointTol: number;
|
|
4
|
-
paramTol: number;
|
|
5
|
-
seedParamTol: number;
|
|
6
|
-
overlapPointTol: number;
|
|
7
|
-
};
|
|
8
|
-
export declare function makeIntersectionTolerance(c1: Curve2, c2: Curve2): IntersectionTolerance;
|
|
9
|
-
export declare function curvePointTolerance(curve: Curve2): number;
|
|
10
|
-
//# sourceMappingURL=tolerance.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tolerance.d.ts","sourceRoot":"","sources":["../../../src/intersections/internal/tolerance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAGjD,MAAM,MAAM,qBAAqB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,qBAAqB,CAevF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,UAKhD"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Precision } from '../../utils/precision';
|
|
2
|
-
export function makeIntersectionTolerance(c1, c2) {
|
|
3
|
-
const b1 = c1.boundingBox();
|
|
4
|
-
const b2 = c2.boundingBox();
|
|
5
|
-
const diag = Math.hypot(Math.max(b1.maxX, b2.maxX) - Math.min(b1.minX, b2.minX), Math.max(b1.maxY, b2.maxY) - Math.min(b1.minY, b2.minY));
|
|
6
|
-
const scaleTol = (Number.isFinite(diag) && diag > 0) ? diag * 1e-7 : 0;
|
|
7
|
-
const pointTol = Math.max(Precision.CURVE_LENGTH_EPS * 8, scaleTol);
|
|
8
|
-
return {
|
|
9
|
-
pointTol,
|
|
10
|
-
paramTol: Precision.CURVE_PARAM_EPS * 8,
|
|
11
|
-
seedParamTol: Precision.CURVE_PARAM_EPS * 8,
|
|
12
|
-
overlapPointTol: pointTol * 2.5,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export function curvePointTolerance(curve) {
|
|
16
|
-
const box = curve.boundingBox();
|
|
17
|
-
const diag = Math.hypot(box.width(), box.height());
|
|
18
|
-
const scaleTol = (Number.isFinite(diag) && diag > 0) ? diag * 1e-9 : 0;
|
|
19
|
-
return Math.max(Precision.CURVE_LENGTH_EPS * 8, scaleTol);
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intersector.d.ts","sourceRoot":"","sources":["../../src/intersections/intersector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,MAAM,WAAW,qBAAqB;IAClC,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,EAAE,CAAA;CAClD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Curve2 } from '../curves/curve2';
|
|
2
|
-
import type { CurveXInfo } from './types';
|
|
3
|
-
export declare class NumericXAlgorithm {
|
|
4
|
-
private readonly map;
|
|
5
|
-
private readonly retryMap;
|
|
6
|
-
intersect(c1: Curve2, c2: Curve2): CurveXInfo[];
|
|
7
|
-
private shouldRetry;
|
|
8
|
-
private boxesLikelyIntersect;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=numeric_x_algorithm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"numeric_x_algorithm.d.ts","sourceRoot":"","sources":["../../src/intersections/numeric_x_algorithm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAgB9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAOnB;IAED,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAOxB;IAEM,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,EAAE;IA2BtD,OAAO,CAAC,WAAW;IAmBnB,OAAO,CAAC,oBAAoB;CAM/B"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { MathError } from '../utils/math_error';
|
|
2
|
-
import { getCurveKind } from './internal/kind';
|
|
3
|
-
import { normalizePair } from './internal/pair';
|
|
4
|
-
import { analyzeCurveXInfosQuality, postprocessCurveXInfos, swapCurveXInfos } from './internal/result';
|
|
5
|
-
import { makeIntersectionTolerance } from './internal/tolerance';
|
|
6
|
-
import { ArcBSplinePairSolver, BSplineBSplinePairSolver, CircleBSplinePairSolver, EllipseArcBSplinePairSolver, EllipseBSplinePairSolver, LineBSplinePairSolver, } from './solvers/pair_solvers';
|
|
7
|
-
import { PolylinePairIntersector } from './solvers/polyline_pair_intersector';
|
|
8
|
-
export class NumericXAlgorithm {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.map = {
|
|
11
|
-
'line|bspline': new LineBSplinePairSolver(),
|
|
12
|
-
'circle|bspline': new CircleBSplinePairSolver(),
|
|
13
|
-
'arc|bspline': new ArcBSplinePairSolver(),
|
|
14
|
-
'ellipse|bspline': new EllipseBSplinePairSolver(),
|
|
15
|
-
'ellipseArc|bspline': new EllipseArcBSplinePairSolver(),
|
|
16
|
-
'bspline|bspline': new BSplineBSplinePairSolver(),
|
|
17
|
-
};
|
|
18
|
-
this.retryMap = {
|
|
19
|
-
'line|bspline': new PolylinePairIntersector(640, 96),
|
|
20
|
-
'circle|bspline': new PolylinePairIntersector(640, 96),
|
|
21
|
-
'arc|bspline': new PolylinePairIntersector(640, 96),
|
|
22
|
-
'ellipse|bspline': new PolylinePairIntersector(704, 96),
|
|
23
|
-
'ellipseArc|bspline': new PolylinePairIntersector(704, 96),
|
|
24
|
-
'bspline|bspline': new PolylinePairIntersector(768, 96),
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
intersect(c1, c2) {
|
|
28
|
-
const k1 = getCurveKind(c1);
|
|
29
|
-
const k2 = getCurveKind(c2);
|
|
30
|
-
const pair = normalizePair(k1, k2);
|
|
31
|
-
const solver = this.map[pair.key];
|
|
32
|
-
if (!solver) {
|
|
33
|
-
MathError.throw(`NumericXAlgorithm: unsupported pair ${c1.getType()}|${c2.getType()}`);
|
|
34
|
-
}
|
|
35
|
-
const tol = makeIntersectionTolerance(c1, c2);
|
|
36
|
-
const diagBefore = PolylinePairIntersector.getDiagnostics();
|
|
37
|
-
const raw = pair.swapped ? solver.intersect(c2, c1) : solver.intersect(c1, c2);
|
|
38
|
-
const ordered = pair.swapped ? swapCurveXInfos(raw) : raw;
|
|
39
|
-
const primary = postprocessCurveXInfos(ordered, tol.pointTol);
|
|
40
|
-
const quality = analyzeCurveXInfosQuality(ordered, tol.pointTol);
|
|
41
|
-
if (!this.shouldRetry(pair.key, c1, c2, quality, diagBefore, PolylinePairIntersector.getDiagnostics())) {
|
|
42
|
-
return primary;
|
|
43
|
-
}
|
|
44
|
-
const retrySolver = this.retryMap[pair.key];
|
|
45
|
-
if (!retrySolver)
|
|
46
|
-
return primary;
|
|
47
|
-
const retryRaw = pair.swapped ? retrySolver.intersect(c2, c1) : retrySolver.intersect(c1, c2);
|
|
48
|
-
if (retryRaw.length === 0)
|
|
49
|
-
return primary;
|
|
50
|
-
const retryOrdered = pair.swapped ? swapCurveXInfos(retryRaw) : retryRaw;
|
|
51
|
-
return postprocessCurveXInfos([...ordered, ...retryOrdered], tol.pointTol);
|
|
52
|
-
}
|
|
53
|
-
shouldRetry(key, c1, c2, quality, before, after) {
|
|
54
|
-
if (!this.retryMap[key])
|
|
55
|
-
return false;
|
|
56
|
-
if (!this.boxesLikelyIntersect(c1, c2))
|
|
57
|
-
return false;
|
|
58
|
-
if (quality.rawCount === 0)
|
|
59
|
-
return true;
|
|
60
|
-
if (quality.duplicatePointCount > 0)
|
|
61
|
-
return true;
|
|
62
|
-
const certificationMissDelta = after.certificationMissCount - before.certificationMissCount;
|
|
63
|
-
const refineFailDelta = after.refineFailureCount - before.refineFailureCount;
|
|
64
|
-
const rejectDelta = after.certificationRejectCount - before.certificationRejectCount;
|
|
65
|
-
return certificationMissDelta > 0 || refineFailDelta > 0 || rejectDelta > 0;
|
|
66
|
-
}
|
|
67
|
-
boxesLikelyIntersect(c1, c2) {
|
|
68
|
-
const t = makeIntersectionTolerance(c1, c2);
|
|
69
|
-
const b1 = c1.boundingBox().expandByScalar(t.pointTol * 2);
|
|
70
|
-
const b2 = c2.boundingBox().expandByScalar(t.pointTol * 2);
|
|
71
|
-
return b1.intersects(b2);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { BSpline2 } from '../../curves/bspline2';
|
|
2
|
-
import type { CurveXInfo } from '../types';
|
|
3
|
-
export declare class BSplineSelfSolver {
|
|
4
|
-
intersect(curve: BSpline2): CurveXInfo[];
|
|
5
|
-
}
|
|
6
|
-
export declare function intersectBSplineSelf(curve: BSpline2): CurveXInfo[];
|
|
7
|
-
//# sourceMappingURL=bspline_self_solver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bspline_self_solver.d.ts","sourceRoot":"","sources":["../../../src/intersections/solvers/bspline_self_solver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAwB1C,qBAAa,iBAAiB;IACnB,SAAS,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,EAAE;CAmBlD;AAID,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,EAAE,CAElE"}
|