@ccpc/math 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
package/README.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# @ccpc/math
|
|
2
|
-
|
|
3
|
-
2D geometry and curve math library for Linea.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pnpm add @ccpc/math
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { Vec2, Line2, Circle2, BSpline2 } from '@ccpc/math'
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Build
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
pnpm --filter "@ccpc/math" build
|
|
21
|
-
```
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare enum EN_GEO_TYPE {
|
|
2
|
-
Vec2 = "Vec2",
|
|
3
|
-
Mat3 = "Mat3",
|
|
4
|
-
Box2 = "Box2",
|
|
5
|
-
Coord2D = "Coord2D",
|
|
6
|
-
Line2 = "Line2",
|
|
7
|
-
Circle2 = "Circle2",
|
|
8
|
-
Arc2 = "Arc2",
|
|
9
|
-
Ellipse2 = "Ellipse2",
|
|
10
|
-
EllipseArc2 = "EllipseArc2",
|
|
11
|
-
BSpline2 = "BSpline2"
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=geom_type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"geom_type.d.ts","sourceRoot":"","sources":["../../src/constants/geom_type.ts"],"names":[],"mappings":"AAKA,oBAAY,WAAW;IACnB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,YAAY;IAEnB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,QAAQ,aAAa;CACxB"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Linea Math - Types
|
|
3
|
-
* 用于序列化的几何类型枚举
|
|
4
|
-
*/
|
|
5
|
-
export var EN_GEO_TYPE;
|
|
6
|
-
(function (EN_GEO_TYPE) {
|
|
7
|
-
EN_GEO_TYPE["Vec2"] = "Vec2";
|
|
8
|
-
EN_GEO_TYPE["Mat3"] = "Mat3";
|
|
9
|
-
EN_GEO_TYPE["Box2"] = "Box2";
|
|
10
|
-
EN_GEO_TYPE["Coord2D"] = "Coord2D";
|
|
11
|
-
EN_GEO_TYPE["Line2"] = "Line2";
|
|
12
|
-
EN_GEO_TYPE["Circle2"] = "Circle2";
|
|
13
|
-
EN_GEO_TYPE["Arc2"] = "Arc2";
|
|
14
|
-
EN_GEO_TYPE["Ellipse2"] = "Ellipse2";
|
|
15
|
-
EN_GEO_TYPE["EllipseArc2"] = "EllipseArc2";
|
|
16
|
-
EN_GEO_TYPE["BSpline2"] = "BSpline2";
|
|
17
|
-
})(EN_GEO_TYPE || (EN_GEO_TYPE = {}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"math_const.d.ts","sourceRoot":"","sources":["../../src/constants/math_const.ts"],"names":[],"mappings":"AAKA,qBAAa,SAAS;IAClB,kBAAkB;IAClB,gBAAuB,GAAG,SAA2B;IAErD,kBAAkB;IAClB,gBAAuB,GAAG,SAA2B;IAErD,aAAa;IACb,gBAAuB,GAAG,SAAc;CAC3C"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Linea Math - Constants
|
|
3
|
-
* MathConst: 数学常量集中定义
|
|
4
|
-
*/
|
|
5
|
-
export class MathConst {
|
|
6
|
-
}
|
|
7
|
-
/** 负无穷,表示无界最小值 */
|
|
8
|
-
MathConst.MIN = Number.NEGATIVE_INFINITY;
|
|
9
|
-
/** 正无穷,表示无界最大值 */
|
|
10
|
-
MathConst.MAX = Number.POSITIVE_INFINITY;
|
|
11
|
-
/** 2 * PI */
|
|
12
|
-
MathConst.PI2 = Math.PI * 2;
|
package/dist/core/box2.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { GeomBase } from './geom_base';
|
|
2
|
-
import { EN_GEO_TYPE } from '../constants/geom_type';
|
|
3
|
-
import type { IDBBox2 } from '../serialize/dump_types';
|
|
4
|
-
import { Vec2 } from './vec2';
|
|
5
|
-
import { Mat3 } from './mat3';
|
|
6
|
-
export declare class Box2 extends GeomBase {
|
|
7
|
-
/** 序列化类型标识 */
|
|
8
|
-
static readonly type = EN_GEO_TYPE.Box2;
|
|
9
|
-
/** 最小/最大边界 */
|
|
10
|
-
readonly minX: number;
|
|
11
|
-
readonly minY: number;
|
|
12
|
-
readonly maxX: number;
|
|
13
|
-
readonly maxY: number;
|
|
14
|
-
/** 创建 Box2(默认为空盒) */
|
|
15
|
-
constructor();
|
|
16
|
-
constructor(b: Box2);
|
|
17
|
-
constructor(min: Vec2, max: Vec2);
|
|
18
|
-
constructor(points: readonly Vec2[]);
|
|
19
|
-
constructor(minX: number, minY: number, maxX: number, maxY: number);
|
|
20
|
-
/** 空盒 */
|
|
21
|
-
static empty(): Box2;
|
|
22
|
-
/** 由最小/最大点创建 */
|
|
23
|
-
static fromMinMax(min: Vec2, max: Vec2): Box2;
|
|
24
|
-
/** 由点集创建 */
|
|
25
|
-
static fromPoints(points: readonly Vec2[]): Box2;
|
|
26
|
-
/** 克隆 */
|
|
27
|
-
clone(): Box2;
|
|
28
|
-
/** 是否为空盒 */
|
|
29
|
-
isEmpty(): boolean;
|
|
30
|
-
/** 是否为有限数 */
|
|
31
|
-
isFinite(): boolean;
|
|
32
|
-
/** 宽度 */
|
|
33
|
-
width(): number;
|
|
34
|
-
/** 高度 */
|
|
35
|
-
height(): number;
|
|
36
|
-
/** 尺寸 */
|
|
37
|
-
size(): Vec2;
|
|
38
|
-
/** 中心点 */
|
|
39
|
-
center(): Vec2;
|
|
40
|
-
/** 是否包含点 */
|
|
41
|
-
containsPoint(v: Vec2): boolean;
|
|
42
|
-
/** 是否包含盒 */
|
|
43
|
-
containsBox(b: Box2): boolean;
|
|
44
|
-
/** 是否相交 */
|
|
45
|
-
intersects(b: Box2): boolean;
|
|
46
|
-
/** 扩展以包含点 */
|
|
47
|
-
expandByPoint(v: Vec2): Box2;
|
|
48
|
-
/** 按标量扩展 */
|
|
49
|
-
expandByScalar(s: number): Box2;
|
|
50
|
-
/** 合并盒 */
|
|
51
|
-
union(b: Box2): Box2;
|
|
52
|
-
/** 平移 */
|
|
53
|
-
translate(dx: number, dy: number): Box2;
|
|
54
|
-
/** 变换(返回新对象) */
|
|
55
|
-
transform(m: Mat3): Box2;
|
|
56
|
-
/** 变换(返回新对象) */
|
|
57
|
-
transformed(m: Mat3): Box2;
|
|
58
|
-
/** 点到盒子的最短距离 */
|
|
59
|
-
distanceToPoint(p: Vec2): number;
|
|
60
|
-
/** 将点限制在盒子范围内 */
|
|
61
|
-
clampPoint(p: Vec2): Vec2;
|
|
62
|
-
/** 交集盒 */
|
|
63
|
-
intersect(b: Box2): Box2;
|
|
64
|
-
/** 近似相等 */
|
|
65
|
-
equals(b: Box2, eps?: number): boolean;
|
|
66
|
-
/** 序列化为结构对象 */
|
|
67
|
-
dump(): IDBBox2;
|
|
68
|
-
/** 从结构对象反序列化 */
|
|
69
|
-
static load(data: IDBBox2): Box2;
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=box2.d.ts.map
|
package/dist/core/box2.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"box2.d.ts","sourceRoot":"","sources":["../../src/core/box2.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAG7B,qBACa,IAAK,SAAQ,QAAQ;IAC9B,cAAc;IACd,gBAAuB,IAAI,oBAAmB;IAE9C,cAAc;IACd,SAAgB,IAAI,EAAE,MAAM,CAAA;IAC5B,SAAgB,IAAI,EAAE,MAAM,CAAA;IAC5B,SAAgB,IAAI,EAAE,MAAM,CAAA;IAC5B,SAAgB,IAAI,EAAE,MAAM,CAAA;IAE5B,qBAAqB;;gBAET,CAAC,EAAE,IAAI;gBACP,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI;gBACpB,MAAM,EAAE,SAAS,IAAI,EAAE;gBACvB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IA2ClE,SAAS;WACK,KAAK;IAInB,gBAAgB;WACF,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI;IAI7C,YAAY;WACE,UAAU,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE;IAehD,SAAS;IACF,KAAK;IAIZ,YAAY;IACL,OAAO;IAId,aAAa;IACN,QAAQ;IASf,SAAS;IACF,KAAK;IAIZ,SAAS;IACF,MAAM;IAIb,SAAS;IACF,IAAI;IAIX,UAAU;IACH,MAAM;IAQb,YAAY;IACL,aAAa,CAAC,CAAC,EAAE,IAAI;IAU5B,YAAY;IACL,WAAW,CAAC,CAAC,EAAE,IAAI;IAU1B,WAAW;IACJ,UAAU,CAAC,CAAC,EAAE,IAAI;IAUzB,aAAa;IACN,aAAa,CAAC,CAAC,EAAE,IAAI;IAY5B,YAAY;IACL,cAAc,CAAC,CAAC,EAAE,MAAM;IAU/B,UAAU;IACH,KAAK,CAAC,CAAC,EAAE,IAAI;IAWpB,SAAS;IACF,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAUvC,gBAAgB;IACT,SAAS,CAAC,CAAC,EAAE,IAAI;IAaxB,gBAAgB;IACT,WAAW,CAAC,CAAC,EAAE,IAAI;IAI1B,gBAAgB;IACT,eAAe,CAAC,CAAC,EAAE,IAAI;IAW9B,iBAAiB;IACV,UAAU,CAAC,CAAC,EAAE,IAAI;IAOzB,UAAU;IACH,SAAS,CAAC,CAAC,EAAE,IAAI;IASxB,WAAW;IACJ,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,SAAgB;IAW1C,eAAe;IACR,IAAI,IAAI,OAAO;IAUtB,gBAAgB;WACF,IAAI,CAAC,IAAI,EAAE,OAAO;CAGnC"}
|
package/dist/core/box2.js
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Linea Math - Core
|
|
3
|
-
* Box2:二维轴对齐包围盒(AABB),不可变设计
|
|
4
|
-
*/
|
|
5
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
6
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
-
};
|
|
11
|
-
var Box2_1;
|
|
12
|
-
import { GeomBase } from './geom_base';
|
|
13
|
-
import { EN_GEO_TYPE } from '../constants/geom_type';
|
|
14
|
-
import { RegisterGeom } from '../serialize/geom_mgr';
|
|
15
|
-
import { Vec2 } from './vec2';
|
|
16
|
-
import { Precision } from '../utils/precision';
|
|
17
|
-
let Box2 = Box2_1 = class Box2 extends GeomBase {
|
|
18
|
-
constructor(a0, a1, a2, a3) {
|
|
19
|
-
super();
|
|
20
|
-
if (a0 instanceof Box2_1) {
|
|
21
|
-
this.minX = a0.minX;
|
|
22
|
-
this.minY = a0.minY;
|
|
23
|
-
this.maxX = a0.maxX;
|
|
24
|
-
this.maxY = a0.maxY;
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (a0 instanceof Vec2 && a1 instanceof Vec2) {
|
|
28
|
-
this.minX = a0.x;
|
|
29
|
-
this.minY = a0.y;
|
|
30
|
-
this.maxX = a1.x;
|
|
31
|
-
this.maxY = a1.y;
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (Array.isArray(a0)) {
|
|
35
|
-
const b = Box2_1.fromPoints(a0);
|
|
36
|
-
this.minX = b.minX;
|
|
37
|
-
this.minY = b.minY;
|
|
38
|
-
this.maxX = b.maxX;
|
|
39
|
-
this.maxY = b.maxY;
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const minX = typeof a0 === 'number' ? a0 : Infinity;
|
|
43
|
-
const minY = typeof a1 === 'number' ? a1 : Infinity;
|
|
44
|
-
const maxX = typeof a2 === 'number' ? a2 : -Infinity;
|
|
45
|
-
const maxY = typeof a3 === 'number' ? a3 : -Infinity;
|
|
46
|
-
this.minX = minX;
|
|
47
|
-
this.minY = minY;
|
|
48
|
-
this.maxX = maxX;
|
|
49
|
-
this.maxY = maxY;
|
|
50
|
-
}
|
|
51
|
-
/** 空盒 */
|
|
52
|
-
static empty() {
|
|
53
|
-
return new Box2_1();
|
|
54
|
-
}
|
|
55
|
-
/** 由最小/最大点创建 */
|
|
56
|
-
static fromMinMax(min, max) {
|
|
57
|
-
return new Box2_1(min.x, min.y, max.x, max.y);
|
|
58
|
-
}
|
|
59
|
-
/** 由点集创建 */
|
|
60
|
-
static fromPoints(points) {
|
|
61
|
-
if (points.length === 0)
|
|
62
|
-
return Box2_1.empty();
|
|
63
|
-
let minX = Infinity;
|
|
64
|
-
let minY = Infinity;
|
|
65
|
-
let maxX = -Infinity;
|
|
66
|
-
let maxY = -Infinity;
|
|
67
|
-
for (const p of points) {
|
|
68
|
-
if (p.x < minX)
|
|
69
|
-
minX = p.x;
|
|
70
|
-
if (p.y < minY)
|
|
71
|
-
minY = p.y;
|
|
72
|
-
if (p.x > maxX)
|
|
73
|
-
maxX = p.x;
|
|
74
|
-
if (p.y > maxY)
|
|
75
|
-
maxY = p.y;
|
|
76
|
-
}
|
|
77
|
-
return new Box2_1(minX, minY, maxX, maxY);
|
|
78
|
-
}
|
|
79
|
-
/** 克隆 */
|
|
80
|
-
clone() {
|
|
81
|
-
return new Box2_1(this.minX, this.minY, this.maxX, this.maxY);
|
|
82
|
-
}
|
|
83
|
-
/** 是否为空盒 */
|
|
84
|
-
isEmpty() {
|
|
85
|
-
return this.minX > this.maxX || this.minY > this.maxY;
|
|
86
|
-
}
|
|
87
|
-
/** 是否为有限数 */
|
|
88
|
-
isFinite() {
|
|
89
|
-
return (Number.isFinite(this.minX) &&
|
|
90
|
-
Number.isFinite(this.minY) &&
|
|
91
|
-
Number.isFinite(this.maxX) &&
|
|
92
|
-
Number.isFinite(this.maxY));
|
|
93
|
-
}
|
|
94
|
-
/** 宽度 */
|
|
95
|
-
width() {
|
|
96
|
-
return this.isEmpty() ? 0 : this.maxX - this.minX;
|
|
97
|
-
}
|
|
98
|
-
/** 高度 */
|
|
99
|
-
height() {
|
|
100
|
-
return this.isEmpty() ? 0 : this.maxY - this.minY;
|
|
101
|
-
}
|
|
102
|
-
/** 尺寸 */
|
|
103
|
-
size() {
|
|
104
|
-
return new Vec2(this.width(), this.height());
|
|
105
|
-
}
|
|
106
|
-
/** 中心点 */
|
|
107
|
-
center() {
|
|
108
|
-
if (this.isEmpty())
|
|
109
|
-
return Vec2.zero();
|
|
110
|
-
return new Vec2((this.minX + this.maxX) / 2, (this.minY + this.maxY) / 2);
|
|
111
|
-
}
|
|
112
|
-
/** 是否包含点 */
|
|
113
|
-
containsPoint(v) {
|
|
114
|
-
if (this.isEmpty())
|
|
115
|
-
return false;
|
|
116
|
-
return (v.x >= this.minX &&
|
|
117
|
-
v.x <= this.maxX &&
|
|
118
|
-
v.y >= this.minY &&
|
|
119
|
-
v.y <= this.maxY);
|
|
120
|
-
}
|
|
121
|
-
/** 是否包含盒 */
|
|
122
|
-
containsBox(b) {
|
|
123
|
-
if (this.isEmpty() || b.isEmpty())
|
|
124
|
-
return false;
|
|
125
|
-
return (b.minX >= this.minX &&
|
|
126
|
-
b.maxX <= this.maxX &&
|
|
127
|
-
b.minY >= this.minY &&
|
|
128
|
-
b.maxY <= this.maxY);
|
|
129
|
-
}
|
|
130
|
-
/** 是否相交 */
|
|
131
|
-
intersects(b) {
|
|
132
|
-
if (this.isEmpty() || b.isEmpty())
|
|
133
|
-
return false;
|
|
134
|
-
return (b.maxX >= this.minX &&
|
|
135
|
-
b.minX <= this.maxX &&
|
|
136
|
-
b.maxY >= this.minY &&
|
|
137
|
-
b.minY <= this.maxY);
|
|
138
|
-
}
|
|
139
|
-
/** 扩展以包含点 */
|
|
140
|
-
expandByPoint(v) {
|
|
141
|
-
if (this.isEmpty()) {
|
|
142
|
-
return new Box2_1(v.x, v.y, v.x, v.y);
|
|
143
|
-
}
|
|
144
|
-
return new Box2_1(Math.min(this.minX, v.x), Math.min(this.minY, v.y), Math.max(this.maxX, v.x), Math.max(this.maxY, v.y));
|
|
145
|
-
}
|
|
146
|
-
/** 按标量扩展 */
|
|
147
|
-
expandByScalar(s) {
|
|
148
|
-
if (this.isEmpty())
|
|
149
|
-
return this.clone();
|
|
150
|
-
return new Box2_1(this.minX - s, this.minY - s, this.maxX + s, this.maxY + s);
|
|
151
|
-
}
|
|
152
|
-
/** 合并盒 */
|
|
153
|
-
union(b) {
|
|
154
|
-
if (this.isEmpty())
|
|
155
|
-
return b.clone();
|
|
156
|
-
if (b.isEmpty())
|
|
157
|
-
return this.clone();
|
|
158
|
-
return new Box2_1(Math.min(this.minX, b.minX), Math.min(this.minY, b.minY), Math.max(this.maxX, b.maxX), Math.max(this.maxY, b.maxY));
|
|
159
|
-
}
|
|
160
|
-
/** 平移 */
|
|
161
|
-
translate(dx, dy) {
|
|
162
|
-
if (this.isEmpty())
|
|
163
|
-
return this.clone();
|
|
164
|
-
return new Box2_1(this.minX + dx, this.minY + dy, this.maxX + dx, this.maxY + dy);
|
|
165
|
-
}
|
|
166
|
-
/** 变换(返回新对象) */
|
|
167
|
-
transform(m) {
|
|
168
|
-
if (this.isEmpty())
|
|
169
|
-
return this.clone();
|
|
170
|
-
const p1 = m.transformedPoint(new Vec2(this.minX, this.minY));
|
|
171
|
-
const p2 = m.transformedPoint(new Vec2(this.minX, this.maxY));
|
|
172
|
-
const p3 = m.transformedPoint(new Vec2(this.maxX, this.minY));
|
|
173
|
-
const p4 = m.transformedPoint(new Vec2(this.maxX, this.maxY));
|
|
174
|
-
const minX = Math.min(p1.x, p2.x, p3.x, p4.x);
|
|
175
|
-
const minY = Math.min(p1.y, p2.y, p3.y, p4.y);
|
|
176
|
-
const maxX = Math.max(p1.x, p2.x, p3.x, p4.x);
|
|
177
|
-
const maxY = Math.max(p1.y, p2.y, p3.y, p4.y);
|
|
178
|
-
return new Box2_1(minX, minY, maxX, maxY);
|
|
179
|
-
}
|
|
180
|
-
/** 变换(返回新对象) */
|
|
181
|
-
transformed(m) {
|
|
182
|
-
return this.transform(m);
|
|
183
|
-
}
|
|
184
|
-
/** 点到盒子的最短距离 */
|
|
185
|
-
distanceToPoint(p) {
|
|
186
|
-
if (this.isEmpty())
|
|
187
|
-
return Infinity;
|
|
188
|
-
const dx = p.x < this.minX ? this.minX - p.x :
|
|
189
|
-
p.x > this.maxX ? p.x - this.maxX : 0;
|
|
190
|
-
const dy = p.y < this.minY ? this.minY - p.y :
|
|
191
|
-
p.y > this.maxY ? p.y - this.maxY : 0;
|
|
192
|
-
return Math.hypot(dx, dy);
|
|
193
|
-
}
|
|
194
|
-
/** 将点限制在盒子范围内 */
|
|
195
|
-
clampPoint(p) {
|
|
196
|
-
if (this.isEmpty())
|
|
197
|
-
return p.clone();
|
|
198
|
-
const x = Math.min(this.maxX, Math.max(this.minX, p.x));
|
|
199
|
-
const y = Math.min(this.maxY, Math.max(this.minY, p.y));
|
|
200
|
-
return new Vec2(x, y);
|
|
201
|
-
}
|
|
202
|
-
/** 交集盒 */
|
|
203
|
-
intersect(b) {
|
|
204
|
-
if (this.isEmpty() || b.isEmpty())
|
|
205
|
-
return Box2_1.empty();
|
|
206
|
-
const minX = Math.max(this.minX, b.minX);
|
|
207
|
-
const minY = Math.max(this.minY, b.minY);
|
|
208
|
-
const maxX = Math.min(this.maxX, b.maxX);
|
|
209
|
-
const maxY = Math.min(this.maxY, b.maxY);
|
|
210
|
-
return minX > maxX || minY > maxY ? Box2_1.empty() : new Box2_1(minX, minY, maxX, maxY);
|
|
211
|
-
}
|
|
212
|
-
/** 近似相等 */
|
|
213
|
-
equals(b, eps = Precision.EPS) {
|
|
214
|
-
if (this.isEmpty() && b.isEmpty())
|
|
215
|
-
return true;
|
|
216
|
-
if (this.isEmpty() || b.isEmpty())
|
|
217
|
-
return false;
|
|
218
|
-
return (Precision.equal(this.minX, b.minX, eps) &&
|
|
219
|
-
Precision.equal(this.minY, b.minY, eps) &&
|
|
220
|
-
Precision.equal(this.maxX, b.maxX, eps) &&
|
|
221
|
-
Precision.equal(this.maxY, b.maxY, eps));
|
|
222
|
-
}
|
|
223
|
-
/** 序列化为结构对象 */
|
|
224
|
-
dump() {
|
|
225
|
-
return {
|
|
226
|
-
type: Box2_1.type,
|
|
227
|
-
minX: this.minX,
|
|
228
|
-
minY: this.minY,
|
|
229
|
-
maxX: this.maxX,
|
|
230
|
-
maxY: this.maxY,
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
/** 从结构对象反序列化 */
|
|
234
|
-
static load(data) {
|
|
235
|
-
return new Box2_1(data.minX, data.minY, data.maxX, data.maxY);
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
/** 序列化类型标识 */
|
|
239
|
-
Box2.type = EN_GEO_TYPE.Box2;
|
|
240
|
-
Box2 = Box2_1 = __decorate([
|
|
241
|
-
RegisterGeom
|
|
242
|
-
], Box2);
|
|
243
|
-
export { Box2 };
|
package/dist/core/coord2d.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { GeomBase } from './geom_base';
|
|
2
|
-
import { EN_GEO_TYPE } from '../constants/geom_type';
|
|
3
|
-
import type { IDBCoord2D } from '../serialize/dump_types';
|
|
4
|
-
import { Vec2 } from './vec2';
|
|
5
|
-
import { Mat3 } from './mat3';
|
|
6
|
-
export declare class Coord2D extends GeomBase {
|
|
7
|
-
/** 序列化类型标识 */
|
|
8
|
-
static readonly type = EN_GEO_TYPE.Coord2D;
|
|
9
|
-
/** 原点 */
|
|
10
|
-
private _origin;
|
|
11
|
-
/** X 轴基向量(世界坐标) */
|
|
12
|
-
private _xAxis;
|
|
13
|
-
/** Y 轴基向量(世界坐标) */
|
|
14
|
-
private _yAxis;
|
|
15
|
-
/** 创建坐标系 */
|
|
16
|
-
constructor();
|
|
17
|
-
constructor(c: Coord2D);
|
|
18
|
-
constructor(m: Mat3);
|
|
19
|
-
constructor(origin: Vec2, xAxis?: Vec2, yAxis?: Vec2);
|
|
20
|
-
/** 克隆 */
|
|
21
|
-
clone(): Coord2D;
|
|
22
|
-
/** 获取原点 */
|
|
23
|
-
getOrigin(): Vec2;
|
|
24
|
-
/** 获取 X 轴方向 */
|
|
25
|
-
getDx(): Vec2;
|
|
26
|
-
/** 获取 Y 轴方向 */
|
|
27
|
-
getDy(): Vec2;
|
|
28
|
-
/** 是否为可用基(不退化) */
|
|
29
|
-
isValid(eps?: number): boolean;
|
|
30
|
-
/** 坐标系近似相等 */
|
|
31
|
-
equals(c: Coord2D, eps?: number): boolean;
|
|
32
|
-
/** 局部坐标 -> 世界坐标 */
|
|
33
|
-
toWorld(p: Vec2): Vec2;
|
|
34
|
-
/** 世界坐标 -> 局部坐标 */
|
|
35
|
-
toLocal(p: Vec2, eps?: number): Vec2;
|
|
36
|
-
/** 转为变换矩阵(列向量 + 右乘约定) */
|
|
37
|
-
toMat3(): Mat3;
|
|
38
|
-
/** 变换坐标系(就地修改) */
|
|
39
|
-
transform(m: Mat3): this;
|
|
40
|
-
/** 变换坐标系(返回新对象) */
|
|
41
|
-
transformed(m: Mat3): Coord2D;
|
|
42
|
-
/**
|
|
43
|
-
* 逆坐标系(世界 <-> 局部)
|
|
44
|
-
* - 用于把世界坐标转换为该坐标系的局部坐标
|
|
45
|
-
*/
|
|
46
|
-
inverse(eps?: number): Coord2D;
|
|
47
|
-
/** 设置原点(就地修改) */
|
|
48
|
-
setOrigin(origin: Vec2): this;
|
|
49
|
-
/** 设置 X 轴(就地修改) */
|
|
50
|
-
setXAxis(xAxis: Vec2): this;
|
|
51
|
-
/** 设置 Y 轴(就地修改) */
|
|
52
|
-
setYAxis(yAxis: Vec2): this;
|
|
53
|
-
/** 获取缩放(轴长度) */
|
|
54
|
-
getScale(): Vec2;
|
|
55
|
-
/** 设置缩放(保持轴方向不变) */
|
|
56
|
-
setScale(sx: number, sy: number, eps?: number): this;
|
|
57
|
-
/** 序列化为结构对象 */
|
|
58
|
-
dump(): IDBCoord2D;
|
|
59
|
-
/** 从结构对象反序列化 */
|
|
60
|
-
static load(data: IDBCoord2D): Coord2D;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=coord2d.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coord2d.d.ts","sourceRoot":"","sources":["../../src/core/coord2d.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAI7B,qBACa,OAAQ,SAAQ,QAAQ;IACjC,cAAc;IACd,gBAAuB,IAAI,uBAAsB;IAEjD,SAAS;IACT,OAAO,CAAC,OAAO,CAAM;IAErB,mBAAmB;IACnB,OAAO,CAAC,MAAM,CAAM;IAEpB,mBAAmB;IACnB,OAAO,CAAC,MAAM,CAAM;IAEpB,YAAY;;gBAEA,CAAC,EAAE,OAAO;gBACV,CAAC,EAAE,IAAI;gBACP,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,IAAI;IA6BpD,SAAS;IACF,KAAK;IAIZ,WAAW;IACJ,SAAS;IAIhB,eAAe;IACR,KAAK;IAIZ,eAAe;IACR,KAAK;IAIZ,kBAAkB;IACX,OAAO,CAAC,GAAG,SAAoB;IAKtC,cAAc;IACP,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,SAAgB;IAQ7C,mBAAmB;IACZ,OAAO,CAAC,CAAC,EAAE,IAAI;IAMtB,mBAAmB;IACZ,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,SAAoB;IAa/C,yBAAyB;IAClB,MAAM;IAQb,kBAAkB;IACX,SAAS,CAAC,CAAC,EAAE,IAAI;IAOxB,mBAAmB;IACZ,WAAW,CAAC,CAAC,EAAE,IAAI;IAI1B;;;OAGG;IACI,OAAO,CAAC,GAAG,SAAoB;IAKtC,iBAAiB;IACV,SAAS,CAAC,MAAM,EAAE,IAAI;IAK7B,mBAAmB;IACZ,QAAQ,CAAC,KAAK,EAAE,IAAI;IAK3B,mBAAmB;IACZ,QAAQ,CAAC,KAAK,EAAE,IAAI;IAK3B,gBAAgB;IACT,QAAQ;IAIf,oBAAoB;IACb,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,SAAoB;IAM/D,eAAe;IACR,IAAI,IAAI,UAAU;IASzB,gBAAgB;WACF,IAAI,CAAC,IAAI,EAAE,UAAU;CAOtC"}
|
package/dist/core/coord2d.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Linea Math - Core
|
|
3
|
-
* Coord2D: 2D 坐标系(原点 + 基向量),不可变
|
|
4
|
-
*/
|
|
5
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
6
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
-
};
|
|
11
|
-
var Coord2D_1;
|
|
12
|
-
import { GeomBase } from './geom_base';
|
|
13
|
-
import { EN_GEO_TYPE } from '../constants/geom_type';
|
|
14
|
-
import { RegisterGeom } from '../serialize/geom_mgr';
|
|
15
|
-
import { Vec2 } from './vec2';
|
|
16
|
-
import { Mat3 } from './mat3';
|
|
17
|
-
import { Precision } from '../utils/precision';
|
|
18
|
-
import { MathError } from '../utils/math_error';
|
|
19
|
-
let Coord2D = Coord2D_1 = class Coord2D extends GeomBase {
|
|
20
|
-
constructor(a0, a1, a2) {
|
|
21
|
-
super();
|
|
22
|
-
if (a0 instanceof Coord2D_1) {
|
|
23
|
-
this._origin = a0._origin;
|
|
24
|
-
this._xAxis = a0._xAxis;
|
|
25
|
-
this._yAxis = a0._yAxis;
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (a0 instanceof Mat3) {
|
|
29
|
-
const e = a0.toArray();
|
|
30
|
-
this._origin = new Vec2(e[2], e[5]);
|
|
31
|
-
this._xAxis = new Vec2(e[0], e[3]);
|
|
32
|
-
this._yAxis = new Vec2(e[1], e[4]);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const origin = a0 ?? Vec2.zero();
|
|
36
|
-
const xAxis = a1 ?? Vec2.unitX();
|
|
37
|
-
const yAxis = a2 ?? xAxis.perped();
|
|
38
|
-
this._origin = origin;
|
|
39
|
-
this._xAxis = xAxis;
|
|
40
|
-
this._yAxis = yAxis;
|
|
41
|
-
}
|
|
42
|
-
/** 克隆 */
|
|
43
|
-
clone() {
|
|
44
|
-
return new Coord2D_1(this._origin, this._xAxis, this._yAxis);
|
|
45
|
-
}
|
|
46
|
-
/** 获取原点 */
|
|
47
|
-
getOrigin() {
|
|
48
|
-
return this._origin;
|
|
49
|
-
}
|
|
50
|
-
/** 获取 X 轴方向 */
|
|
51
|
-
getDx() {
|
|
52
|
-
return this._xAxis;
|
|
53
|
-
}
|
|
54
|
-
/** 获取 Y 轴方向 */
|
|
55
|
-
getDy() {
|
|
56
|
-
return this._yAxis;
|
|
57
|
-
}
|
|
58
|
-
/** 是否为可用基(不退化) */
|
|
59
|
-
isValid(eps = Precision.LEN_EPS) {
|
|
60
|
-
const det = this._xAxis.cross(this._yAxis);
|
|
61
|
-
return Math.abs(det) > eps;
|
|
62
|
-
}
|
|
63
|
-
/** 坐标系近似相等 */
|
|
64
|
-
equals(c, eps = Precision.EPS) {
|
|
65
|
-
return (this._origin.equals(c._origin, eps) &&
|
|
66
|
-
this._xAxis.equals(c._xAxis, eps) &&
|
|
67
|
-
this._yAxis.equals(c._yAxis, eps));
|
|
68
|
-
}
|
|
69
|
-
/** 局部坐标 -> 世界坐标 */
|
|
70
|
-
toWorld(p) {
|
|
71
|
-
return this._origin
|
|
72
|
-
.added(this._xAxis.scaled(p.x))
|
|
73
|
-
.added(this._yAxis.scaled(p.y));
|
|
74
|
-
}
|
|
75
|
-
/** 世界坐标 -> 局部坐标 */
|
|
76
|
-
toLocal(p, eps = Precision.LEN_EPS) {
|
|
77
|
-
const dx = p.x - this._origin.x;
|
|
78
|
-
const dy = p.y - this._origin.y;
|
|
79
|
-
const det = this._xAxis.cross(this._yAxis);
|
|
80
|
-
if (Math.abs(det) <= eps) {
|
|
81
|
-
MathError.throw('Coord2D.toLocal: basis is degenerate');
|
|
82
|
-
}
|
|
83
|
-
const invDet = 1 / det;
|
|
84
|
-
const x = (dx * this._yAxis.y - dy * this._yAxis.x) * invDet;
|
|
85
|
-
const y = (dy * this._xAxis.x - dx * this._xAxis.y) * invDet;
|
|
86
|
-
return new Vec2(x, y);
|
|
87
|
-
}
|
|
88
|
-
/** 转为变换矩阵(列向量 + 右乘约定) */
|
|
89
|
-
toMat3() {
|
|
90
|
-
return new Mat3(this._xAxis.x, this._yAxis.x, this._origin.x, this._xAxis.y, this._yAxis.y, this._origin.y, 0, 0, 1);
|
|
91
|
-
}
|
|
92
|
-
/** 变换坐标系(就地修改) */
|
|
93
|
-
transform(m) {
|
|
94
|
-
this._origin = this._origin.clone().applyMat3(m);
|
|
95
|
-
this._xAxis = m.transformedVector(this._xAxis);
|
|
96
|
-
this._yAxis = m.transformedVector(this._yAxis);
|
|
97
|
-
return this;
|
|
98
|
-
}
|
|
99
|
-
/** 变换坐标系(返回新对象) */
|
|
100
|
-
transformed(m) {
|
|
101
|
-
return this.clone().transform(m);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* 逆坐标系(世界 <-> 局部)
|
|
105
|
-
* - 用于把世界坐标转换为该坐标系的局部坐标
|
|
106
|
-
*/
|
|
107
|
-
inverse(eps = Precision.LEN_EPS) {
|
|
108
|
-
const inv = this.toMat3().inverted(eps);
|
|
109
|
-
return new Coord2D_1(inv);
|
|
110
|
-
}
|
|
111
|
-
/** 设置原点(就地修改) */
|
|
112
|
-
setOrigin(origin) {
|
|
113
|
-
this._origin = origin;
|
|
114
|
-
return this;
|
|
115
|
-
}
|
|
116
|
-
/** 设置 X 轴(就地修改) */
|
|
117
|
-
setXAxis(xAxis) {
|
|
118
|
-
this._xAxis = xAxis;
|
|
119
|
-
return this;
|
|
120
|
-
}
|
|
121
|
-
/** 设置 Y 轴(就地修改) */
|
|
122
|
-
setYAxis(yAxis) {
|
|
123
|
-
this._yAxis = yAxis;
|
|
124
|
-
return this;
|
|
125
|
-
}
|
|
126
|
-
/** 获取缩放(轴长度) */
|
|
127
|
-
getScale() {
|
|
128
|
-
return new Vec2(this._xAxis.len(), this._yAxis.len());
|
|
129
|
-
}
|
|
130
|
-
/** 设置缩放(保持轴方向不变) */
|
|
131
|
-
setScale(sx, sy, eps = Precision.LEN_EPS) {
|
|
132
|
-
this._xAxis = this._xAxis.clone().setLength(sx, eps);
|
|
133
|
-
this._yAxis = this._yAxis.clone().setLength(sy, eps);
|
|
134
|
-
return this;
|
|
135
|
-
}
|
|
136
|
-
/** 序列化为结构对象 */
|
|
137
|
-
dump() {
|
|
138
|
-
return {
|
|
139
|
-
type: Coord2D_1.type,
|
|
140
|
-
origin: { x: this._origin.x, y: this._origin.y },
|
|
141
|
-
xAxis: { x: this._xAxis.x, y: this._xAxis.y },
|
|
142
|
-
yAxis: { x: this._yAxis.x, y: this._yAxis.y },
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
/** 从结构对象反序列化 */
|
|
146
|
-
static load(data) {
|
|
147
|
-
return new Coord2D_1(new Vec2(data.origin.x, data.origin.y), new Vec2(data.xAxis.x, data.xAxis.y), new Vec2(data.yAxis.x, data.yAxis.y));
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
/** 序列化类型标识 */
|
|
151
|
-
Coord2D.type = EN_GEO_TYPE.Coord2D;
|
|
152
|
-
Coord2D = Coord2D_1 = __decorate([
|
|
153
|
-
RegisterGeom
|
|
154
|
-
], Coord2D);
|
|
155
|
-
export { Coord2D };
|
package/dist/core/geom_base.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { IDB } from '../serialize/dump_types';
|
|
2
|
-
import type { IDumpable } from '../serialize/geom_mgr';
|
|
3
|
-
import type { Ctor } from '../types/type_guard';
|
|
4
|
-
export interface IGeom extends IDumpable {
|
|
5
|
-
getType(): string;
|
|
6
|
-
clone(): IGeom;
|
|
7
|
-
}
|
|
8
|
-
export declare abstract class GeomBase implements IGeom {
|
|
9
|
-
abstract dump(): IDB;
|
|
10
|
-
abstract clone(): IGeom;
|
|
11
|
-
/** 获取实例类型标识 */
|
|
12
|
-
getType(): string;
|
|
13
|
-
/**
|
|
14
|
-
* 运行时类型守卫:判断当前实例是否为目标构造器类型。
|
|
15
|
-
* 使用后可触发 TypeScript 类型收窄。
|
|
16
|
-
*/
|
|
17
|
-
isType<T extends GeomBase>(ctor: Ctor<T>): this is T;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=geom_base.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"geom_base.d.ts","sourceRoot":"","sources":["../../src/core/geom_base.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,uBAAuB,CAAA;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAE/C,MAAM,WAAW,KAAM,SAAQ,SAAS;IACpC,OAAO,IAAI,MAAM,CAAA;IACjB,KAAK,IAAI,KAAK,CAAA;CACjB;AAED,8BAAsB,QAAS,YAAW,KAAK;aAC3B,IAAI,IAAI,GAAG;aACX,KAAK,IAAI,KAAK;IAE9B,eAAe;IACR,OAAO;IAKd;;;OAGG;IACI,MAAM,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC;CAG9D"}
|
package/dist/core/geom_base.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Linea Math - Core
|
|
3
|
-
* 几何基类:统一序列化协议
|
|
4
|
-
*/
|
|
5
|
-
export class GeomBase {
|
|
6
|
-
/** 获取实例类型标识 */
|
|
7
|
-
getType() {
|
|
8
|
-
const ctor = this.constructor;
|
|
9
|
-
return ctor.type;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* 运行时类型守卫:判断当前实例是否为目标构造器类型。
|
|
13
|
-
* 使用后可触发 TypeScript 类型收窄。
|
|
14
|
-
*/
|
|
15
|
-
isType(ctor) {
|
|
16
|
-
return this instanceof ctor;
|
|
17
|
-
}
|
|
18
|
-
}
|