1use serde::{Deserialize, Serialize};
57use wasm_bindgen::prelude::*;
58
59macro_rules! env_read {
64 ($name:literal) => {{
65 static CELL: std::sync::OnceLock<Option<String>> = std::sync::OnceLock::new();
66 $crate::env_read::read($name, &CELL)
67 }};
68}
69#[macro_export]
77macro_rules! switch {
78 (live $name:expr, $default:expr) => {
79 $crate::env_read::switch_live($name, $default, $crate::env_read::Grammar::Switch)
80 };
81 ($name:expr, $default:expr) => {{
82 static CELL: std::sync::OnceLock<Option<bool>> = std::sync::OnceLock::new();
83 $crate::env_read::switch($name, &CELL, $default, $crate::env_read::Grammar::Switch)
84 }};
85}
86
87#[macro_export]
91macro_rules! debug_flag {
92 (live $name:expr) => {
93 $crate::env_read::switch_live($name, false, $crate::env_read::Grammar::Flag)
94 };
95 ($name:expr) => {{
96 static CELL: std::sync::OnceLock<Option<bool>> = std::sync::OnceLock::new();
97 $crate::env_read::switch($name, &CELL, false, $crate::env_read::Grammar::Flag)
98 }};
99}
100
101#[macro_export]
105macro_rules! mode_switch {
106 (live $name:expr, $default_on:expr) => {
107 $crate::env_read::mode_live($name, $default_on)
108 };
109 ($name:expr, $default_on:expr) => {{
110 static CELL: std::sync::OnceLock<Option<$crate::env_read::Mode>> = std::sync::OnceLock::new();
111 $crate::env_read::mode($name, &CELL, $default_on)
112 }};
113}
114
115macro_rules! profile_line {
118 ($($arg:tt)*) => { $crate::profile::profile_emit(format_args!($($arg)*)) };
119}
120
121#[cfg(all(feature = "wasm-talc", target_family = "wasm", not(target_feature = "atomics")))]
123#[global_allocator]
124static TALC: talc::wasm::WasmDynamicTalc = talc::wasm::new_wasm_dynamic_allocator();
125
126#[cfg(all(feature = "native-rusty-alloc", not(target_family = "wasm")))]
128#[cfg(not(feature = "profile-wall"))]
129#[global_allocator]
130static RUSTY_ALLOC: rusty_alloc_api::RustyAlloc = rusty_alloc_api::RustyAlloc;
131
132#[cfg(all(feature = "native-rusty-alloc", not(target_family = "wasm"), feature = "profile-wall"))]
133#[global_allocator]
134static RUSTY_ALLOC: wall_profile::Allocator<rusty_alloc_api::RustyAlloc> = wall_profile::Allocator(rusty_alloc_api::RustyAlloc);
135
136mod profile;
137mod claim_slots;
138#[cfg(feature = "profile-wall")]
139mod wall_profile;
140#[cfg(not(feature = "profile-wall"))]
141#[path = "wall_profile_off.rs"]
142mod wall_profile;
143#[cfg(feature = "profile-wall")]
144mod reader_profile;
145#[cfg(not(feature = "profile-wall"))]
146#[path = "reader_profile_off.rs"]
147mod reader_profile;
148
149
150#[doc(hidden)]
153pub mod env_read;
154
155pub mod panic_hook;
160
161pub mod text;
164
165#[path = "geometry/tolerance.rs"]
166mod tolerance;
167pub use tolerance::{
168 curve_model_scale, model_scale, report_scale_migration, solid_model_scale, solid_scale,
169 offset_construction_band, vertex_tolerance_from_edges, KernelTolerances,
170 MeasuredTolerance, OFFSET_CONSTRUCTION_FLOOR, OFFSET_CONSTRUCTION_REL,
171 VERTEX_MATCH_FLOOR, VOLUME_DRIFT_ABS, VOLUME_DRIFT_REL,
172};
173#[path = "geometry/entity_tolerance.rs"]
178mod entity_tolerance;
179pub use entity_tolerance::{EntityTolerances, EDGE_CAP_FRACTION, VERTEX_CAP_FRACTION};
180#[path = "props/diagnostics.rs"]
181mod diagnostics;
182pub use diagnostics::{
183 Approximation, ApproximationBudget, Backing, BudgetMechanism, BudgetReason, MeasuredComponent, DiagnosticEvent, DiagnosticSeverity, EdgeOrigin, KernelDiagnostics,
184 KernelOutcome, KernelRefusal, OffCarrierEdge,
185 KernelStage, OrRefuse, RefusalClass, SoundnessDefect, UndecidedCause,
186};
187#[path = "geometry/polygon.rs"]
188pub mod polygon;
189#[path = "geometry/curve.rs"]
190mod curve;
191pub use curve::{
192 make_arc, make_circle, make_hyperbola, make_line, make_parabola, uniform_clamped_knots,
193 KnotVector, NurbsCurve, Vec4, KNOT_DEDUP_EPS, KNOT_IDENTITY_TOL,
194};
195#[path = "blending/blend/mod.rs"]
196mod blend;
197pub use blend::{
198 take_blend_approximations, take_blend_notes,
199 blend_timing_capture, take_blend_timings, BlendTiming,
200 blend_closed_edge, blend_edge_variable, blend_open_edge, blend_smooth_chain,
201 round_convex_corner,
202};
203#[path = "blending/fillet.rs"]
204mod fillet;
205pub use fillet::{
206 chamfer_edge, chamfer_edge_angle, chamfer_edge_asymmetric, chamfer_edges_angle,
207 chamfer_edges_asymmetric, fillet_edge, fillet_edge_conic, fillet_edges, fillet_edges_conic, fillet_edges_reported, fillet_edges_reported_at_offset,
208 fillet_edges_variable, fillet_edges_variable_law, fillet_edges_variable_vertex_radii,
209 BlendSelection,
210};
211#[path = "blending/law.rs"]
212mod law;
213pub use law::{LawSegment, RadiusLaw};
214#[path = "geometry/fit.rs"]
215mod fit;
216pub use fit::{
217 fit_polyline, fit_polyline_at, fit_polyline_of_degree, interpolate_curve, interpolate_curve_closed,
218 interpolate_curve_local, interpolate_curve_thinned, interpolate_curve_with_end_tangents,
219 simplify_polyline, simplify_polyline_indices, solve_banded, solve_dense, PolylineFit,
220 PolylineFitExit, PolylineFitLedger, PolylineFitReport, PolylineFitScope, MAX_FIT_STATIONS,
221};
222#[path = "geometry/image_curve.rs"]
223mod image_curve;
224pub use image_curve::{affine_image_curve, image_curve, image_curve_pair, ImageCurve, ImageCurveTier};
225#[path = "geometry/surface.rs"]
226mod surface;
227pub use surface::{
228 carrier_preview_patch, make_cone_surface, make_cylinder_surface, make_extrusion, make_plane,
229 make_revolution, make_sphere_surface, make_sphere_surface_framed, make_torus_surface,
230 ExtendRefusal, NurbsSurface, SurfaceSide, WeightSite, MAXIMUM_FOLD_ANGLE,
231 MAXIMUM_GROWTH_RATIO,
232};
233#[path = "geometry/control_cage.rs"]
234mod control_cage;
235pub use control_cage::{
236 CagePoint, CagePrimitive, ControlCage, CAGE_DEGREE, MAX_RINGS, MAX_SEGMENTS, MIN_RINGS,
237 MIN_SEGMENTS,
238};
239#[path = "geometry/coons.rs"]
240mod coons;
241pub use coons::{
242 coons_bilinear, coons_bilinear_reported, coons_with_ribbons, CompatWork, CoonsRefusal,
243 CoonsReport, RibbonReport,
244};
245#[path = "geometry/gordon.rs"]
246mod gordon;
247pub use gordon::{gordon_surface, gordon_surface_reported, GordonRefusal, GordonReport};
248#[path = "geometry/analytic_surface.rs"]
249mod analytic_surface;
250pub use analytic_surface::{
251 circle_angle_to_parameter, intersect_analytic_pair, plane_ruled_section_arc,
252 revolution_structure, AnalyticSurface, RevolutionFrame, RevolutionStructure,
253};
254pub(crate) use analytic_surface::{
255 canonical_carriers_enabled, canonicalise_carriers, intersect_analytic_pair_with, ruled_gate,
256 ruled_gate_census, RuledGate,
257};
258#[path = "geometry/sphere_chart.rs"]
259mod sphere_chart;
260pub use sphere_chart::{
261 canonicalize_points, chart_grid_divisions, chart_grid_parameters, corner_index,
262 cube_edge_corner, cube_edge_divisions, cube_edge_index, cube_edge_parameters,
263 cube_edge_parts, Chart, ChartSegment, ChartSide, SphereAtlas,
264 SphericalRegion, CHART_COUNT, CUBE_CORNER_COUNT, CUBE_EDGE_COUNT,
265};
266#[path = "brep/solid_codec.rs"]
267mod solid_codec;
268pub use solid_codec::{decode_solid, encode_solid, SolidNames, SOLID_CODEC_VERSION, SOLID_CODEC_VERSION_KIND};
269#[path = "brep/topology.rs"]
270mod topology;
271pub use topology::{
272 make_box_brep, make_cylinder_brep, make_pyramid_brep, topology_kind, BodyKind, BrepSolid, CellRecord, CoedgeRecord,
273 FaceRecord, IssueKind, KindReport, LoopRecord, TopologyKind, ValidationReport,
274};
275#[path = "brep/soundness.rs"]
276mod soundness;
277pub use soundness::{
278 face_self_intersections, loop_self_crossings, shell_vector_areas, solid_connectivity,
279 solid_euler, solid_self_intersections, ConnectivityReport, CrossingConfirmation, EulerReport,
280 CertificateScope, CertifiedFacePair, FaceCrossing, FaceFold, FaceVectorArea,
281 LoopCrossing, LoopCrossingReport, SelfIntersectionOptions, SelfIntersectionReport,
282 ClosureReading, ShellConnectivity, ShellVectorArea, VectorAreaReport, CrossingUndecidedCause, UndecidedCrossing,
283 MAX_LISTED_UNDECIDED,
284};
285#[path = "brep/topology_arena.rs"]
286mod topology_arena;
287pub use topology_arena::{
288 ArenaCoedge, ArenaEdge, ArenaFace, ArenaLoop, ArenaShell, ArenaVertex, CoedgeId, EdgeId,
289 FaceId, LoopId, ShellId, TopologyArena, VertexId,
290};
291#[path = "brep/analytic_topology.rs"]
292mod analytic_topology;
293pub use analytic_topology::{
294 make_cone_brep, make_sphere_brep, make_sphere_brep_framed, make_torus_brep,
295};
296#[path = "construction/solid_sweep.rs"]
297mod solid_sweep;
298pub use solid_sweep::{
299 sweep_solid_within, OutlinePiece, ScrewStep, SolidMotion, SweepClip, SweptTool, SOLID_SWEEP_REFUSAL,
300};
301#[path = "construction/solid_sweep_caps.rs"]
302mod solid_sweep_caps;
303pub use solid_sweep_caps::{sweep_solid, sweep_prism_along, sweep_solid_along, sweep_solid_clipped, sweep_solid_parts, sweep_solid_rising, sweep_solid_tumbled, FrameCurve, RisingTurn, TwoTurns, SolidTool, SOLID_SWEEP_WHOLE_REFUSAL};
304#[path = "geometry/curve_chain.rs"]
305mod curve_chain;
306pub use curve_chain::{join_curve_chain, split_surface};
307#[path = "geometry/closed_curves.rs"]
308mod closed_curves;
309pub use closed_curves::{make_ellipse, make_ellipse_arc, make_ellipsoid_brep, make_periodic_bspline};
310#[path = "construction/surface_faces.rs"]
311mod surface_faces;
312pub use surface_faces::{face_from_surface, face_from_surface_trimmed, solid_from_sheets, SURFACE_FACE_REFUSAL};
313#[path = "construction/polygon_solids.rs"]
314mod polygon_solids;
315pub use polygon_solids::{make_pyramid_on_polygon, solid_from_polygons};
316#[path = "construction/loft_guide_chain.rs"]
317mod loft_guide_chain;
318pub use loft_guide_chain::loft_profile_brep_guided_chain;
319#[path = "construction/loft_guides.rs"]
320mod loft_guides;
321pub use loft_guides::{loft_profile_brep_on_guide_chains, loft_profile_brep_on_guides, loft_profile_brep_on_loose_guide_chains, GuideLoftWall, LOFT_ON_GUIDES_REFUSAL};
322#[path = "construction/extrude_up_to.rs"]
323mod extrude_up_to;
324pub use extrude_up_to::{extrude_profile_up_to_face, solid_pieces, EXTRUDE_UP_TO_REFUSAL};
325#[path = "offset/thicken_faces.rs"]
326mod thicken_faces;
327pub use thicken_faces::{extrude_curves_to_sheet, thicken_sheet_faces, THICKEN_FACES_REFUSAL};
328#[path = "offset/shell_rounded.rs"]
329mod shell_rounded;
330pub use shell_rounded::{offset_shell_rounded, SHELL_ROUNDED_REFUSAL};
331#[path = "construction/sweep_round_corners.rs"]
332mod sweep_round_corners;
333pub use sweep_round_corners::{sweep_profile_round_corners, SWEEP_ROUND_CORNERS_REFUSAL};
334#[path = "construction/sweep_ellipsoid.rs"]
335mod sweep_ellipsoid;
336pub use sweep_ellipsoid::sweep_ellipsoid_along_line;
337#[path = "construction/sweep_topology.rs"]
338mod sweep_topology;
339pub(crate) use sweep_topology::is_sweep_tight_bend;
340pub use sweep_topology::{
341 extrude_profile_brep, extrude_profile_brep_draft, fit_helix_curve, helix_sample_points,
342 profile_anchor, rib_from_profile, sweep_bend_profile, sweep_closure, BendStation,
343 JointContinuity, PathJoint, SweepClosure,
344 RibExtrusion, RibNames, SweepPath, MAX_JOINT_TANGENT_BREAK, SWEEP_TIGHT_BEND_REFUSAL,
345 SWEEP_TWIST_CLOSURE_REFUSAL,
346 build_swept_envelope, recognize_swept_envelope, swept_envelope_volume, SweptEnvelope,
347 SWEEP_ENVELOPE_REFUSAL, sweep_envelope_bodies,
348 sweep_profile_along_chain, sweep_profile_along_chain_reported,
349 sweep_profile_along_chain_with_stations, sweep_profile_along_chain_with_stations_reported,
350 sweep_profile_along_path,
351 sweep_profile_along_path_anchored,
352 sweep_profile_helix,
353 sweep_profile_twisted, sweep_profile_twisted_anchored, sweep_profile_twisted_scaled,
354 ProfileAnchor, SectionPlacement,
355 StationBudget, SweepStationReport, SweptChain, SWEEP_DEFAULT_TOLERANCE, SWEEP_MAX_STATIONS,
356 SWEEP_REFINEMENT_ROUNDS,
357};
358#[path = "construction/revolve_topology.rs"]
359mod revolve_topology;
360pub use revolve_topology::{revolve_profile_brep, revolve_profile_brep_named};
361#[path = "construction/loft_topology.rs"]
362mod loft_topology;
363pub use loft_topology::{
364 loft_profile_brep, loft_profile_brep_closed, loft_profile_brep_guided,
365 loft_profile_brep_guided_frame, loft_profile_brep_tangent,
366};
367pub(crate) use loft_topology::loft_profile_brep_closed_shifted;
368#[path = "brep/transform_topology.rs"]
369mod transform_topology;
370#[path = "brep/recentre.rs"]
371mod recentre;
372#[path = "brep/rescale.rs"]
373mod rescale;
374pub use transform_topology::{mirror_brep, transform_brep, AffineTransform};
375#[path = "edit/split.rs"]
376mod split;
377pub use split::{
378 split_solid_by_face_surface, split_solid_by_plane, split_solid_by_surface, SplitSurface,
379};
380#[path = "props/mass_properties.rs"]
381mod mass_properties;
382pub use mass_properties::{
383 curve_arc_length, edge_arc_length, face_area, face_boundary_length, face_volume_contribution,
384 face_set_identity, mass_caller, parameter_space_area, solid_edge_length_total,
385 solid_mass_properties,
386 solid_mass_properties_full, signed_volume_against, solid_signed_volume, solid_signed_volume_for_sign, trim_polygons,
387 DensityMassProperties,
388 FaceSetIdentity, FullMassProperties, MassCaller, MassProperties, MassPropertiesCache,
389};
390#[path = "props/carrier_dimensions.rs"]
391mod carrier_dimensions;
392pub use carrier_dimensions::{curve_carrier_dimensions, surface_carrier_dimensions, CarrierDimensions};
393#[path = "meshing/tessellation.rs"]
394mod tessellation;
395pub use tessellation::{tessellate_brep, tessellate_face, TessellationOptions};
396#[path = "meshing/watertight_tessellation/mod.rs"]
397mod watertight_tessellation;
398pub use watertight_tessellation::{
399 sample_edge_polyline_checked, EdgeChordError, EdgeChordFailure, TessellationError,
400 tessellate_brep_watertight_checked,
401 sample_edge_polylines, sample_edges_encoded, tessellate_brep_watertight,
402 tessellate_brep_watertight_face_stride, tessellate_brep_watertight_face_stride_with_samples,
403};
404#[path = "feature_pipeline/mod.rs"]
409pub mod feature_pipeline;
410pub use feature_pipeline::execute_history_json;
411pub use feature_pipeline::{first_reference_name, imported_solid_names, reference_names};
412pub use feature_pipeline::face_transform_pivot;
416pub use feature_pipeline::{
419 clear_history_cache, execute_history, execute_history_observed, AddedSolid, Axis,
420 ComponentRecord, FeatureDescriptor, FeatureRefusal, FeatureResult, Frame, Fulfilment,
421 HistoryProgress, HistoryRequest, Rejected, RejectedKind,
422 HistoryResult, PortKind, PortRecord, ProfileLoop, ScenePoint, SketchProfile,
423};
424pub use feature_pipeline::wire_harness::{
428 bundle_diameter, Attachment as SplineAttachment, BundleStatus, PortSide, RouteResult,
429 RouteStatus,
430 WireHarnessBundle, WireHarnessConnection,
431 WireHarnessEndpoint, WireHarnessReport, WireHarnessState, BUNDLE_SOLID_PREFIX,
432 WIRE_HARNESS_FEATURE_ID, WIRE_HARNESS_FEATURE_TYPE,
433};
434pub use feature_pipeline::part_pins::{
439 declarations as declared_ports, declared_endpoints as declared_point_endpoints,
440 declared_points, endpoint_occurrence, follow_pin_edit, follow_point_edit, pin_labels,
441 pin_point_report, pins,
442 point_renames, port_group_for_unit, resolve_component_pin, resolve_part_pin,
443 unit_count as symbol_unit_count, unit_groups, DeclaredPin, DeclaredPoint, PinPoint,
444 PinPointChange, PinPointProblem, PinPointReport, PointRenames, DEFAULT_PORT_NAME,
445 DEFAULT_PORT_PURPOSE, PADS_BLOCK, SYMBOL_BLOCK,
446};
447pub use feature_pipeline::ports::{
452 address as port_address, document_is_boundary, seat_of as port_seat_of, seat_point,
453 seat_vector, seated_direction, split_address, unit_map, unseat_point, unseat_vector,
454 world_seat, PortDeclaration, PortPoint, PortPointRow, PortSeat, PortsReport, UnitProblem,
455 BOUNDARY_KEY, PORTS_BLOCK, PORTS_FEATURE_ID, PORTS_FEATURE_TYPE,
456};
457pub use feature_pipeline::pmi::{
461 balloon_head as pmi_balloon_head, clamp_text_size, format_dimension, format_number,
462 nearest_point_on_edge, nearest_point_on_solid, pmi_schema_catalogue, pmi_type,
463 nearest_displayed_point, nearest_displayed_point_on_edge, pose_apply as pmi_pose_apply, pose_unapply as pmi_pose_unapply,
464 resolve_state as pmi_resolve_state, entry_names_solid, baseline_hide_id, BalloonAnchor, BalloonAnchorMode, CenterCircle, FcfFrame, HalfSpace as PmiHalfSpace, HeadScope as PmiHeadScope, PmiAnnotation,
465 PmiAnnotationReport, PmiCamera, PmiDisplay, PmiGeometry, PmiPlane, PmiPose, PmiProjection, PmiReport,
466 PmiState, PmiStatus, PmiTypeDef, PmiView, PmiViewReport, SolidPoses as PmiSolidPoses, ToleranceBlock, ToleranceMode, PMI_TYPES,
467};
468pub use feature_pipeline::pmi::layout::{present as pmi_present, LayoutStyle as PmiLayoutStyle, Presentation as PmiPresentation};
469pub use feature_pipeline::pmi::annotations::fcf::{characteristic as pmi_characteristic, Characteristic as PmiCharacteristic, CHARACTERISTICS as PMI_CHARACTERISTICS};
470pub use feature_pipeline::assign_sketch_loop_ids;
474pub use feature_pipeline::features::sketch3d::{
478 reference_record as sketch3d_reference_record, resolve_reference as resolve_sketch3d_reference,
479 ResolvedReference as Sketch3dResolvedReference, REFERENCE_TIP_LENGTH as SKETCH3D_REFERENCE_TIP_LENGTH,
480 common_edge_end as sketch3d_common_edge_end, curve_reference_controls as sketch3d_curve_reference_controls, REFERENCE_ANCHOR_EDGES_KEY as SKETCH3D_ANCHOR_EDGES_KEY,
481 SKETCH3D_DOC_KEY, SKETCH3D_EDIT_BUTTON, SKETCH3D_FEATURE_TYPE, SKETCH3D_REFERENCES_PARAM,
482 SKETCH3D_REFS_KEY,
483};
484pub use feature_pipeline::{flat_pattern_dxf, flat_pattern_svg, is_sheet_metal_handle};
486pub use feature_pipeline::{pattern_component_instance, pattern_parse_suppressed};
488pub use feature_pipeline::{native_import_payload, native_import_payload_with_appearance};
492pub use feature_pipeline::IsolatedSceneMetadata;
495pub use feature_pipeline::scene_metadata_colors_json;
498pub use feature_pipeline::family;
501pub use feature_pipeline::{
504 add_part_to_library, add_part_to_library_impl, install_parts_library, missing_library_parts,
505 parts_library_json, parts_library_map, parts_library_revision, refresh_library_entry,
506 refresh_library_entry_impl, same_build, follow_saved_rows, follow_saved_rows_known, kernel_source_stamp, stable_json_hash, PartsLibraryEntry, PartsLibraryMap,
507};
508pub use feature_pipeline::assembly::{
511 assembly_add_constraint_json, assembly_apply_document_json,
512 assembly_apply_inferred_constraints_json, assembly_component_entities_json, assembly_dof_json,
513 assembly_infer_constraints_json, assembly_inferable_types_json,
514 assembly_move_constraint_json, assembly_overlay_json, assembly_pose_updates_json,
515 assembly_drag_solve_json, assembly_frame_solve_json, assembly_remove_constraint_json, assembly_resolve_refs_json,
516 assembly_run_solve_json,
517 assembly_set_constraint_enabled_json, assembly_set_constraint_open_json,
518 assembly_state_json, assembly_statuses_json, assembly_update_constraint_json,
519 constraint_hidden_params, constraint_schema_catalogue,
520 assembly_add_constraint_impl, assembly_apply_document_impl, assembly_move_constraint_impl,
523 assembly_drag_solve_impl, assembly_frame_solve_impl, assembly_flip_plan_json, assembly_rebase_mechanical_impl, assembly_remove_constraint_impl, assembly_run_solve_impl,
524 assembly_set_constraint_enabled_impl, assembly_set_constraint_open_impl,
525 assembly_update_constraint_impl,
526 assembly_session_export, assembly_session_import, assembly_session_serial, RetiredSession, SessionTransfer,
527};
528pub use feature_pipeline::{AssemblyState, ConstraintEntry};
529pub use feature_pipeline::assembly::transform_to_pose_params;
532pub use feature_pipeline::feature_schema_catalogue;
535pub use feature_pipeline::feature_hidden_params;
538pub use feature_pipeline::assembly::{constraint_type, ConstraintTypeDef, CONSTRAINT_TYPES, FIXED_IS_NOT_A_CONSTRAINT};
541pub use feature_pipeline::{feature_context_applicable, SelectionProbe};
542pub use feature_pipeline::Env;
548
549pub fn eval_expression(
554 expressions: &str,
555 configurator_json: &serde_json::Value,
556 source: &str,
557) -> Result<f64, String> {
558 Env::build(expressions, configurator_json).and_then(|env| env.eval(source))
559}
560
561#[cfg(feature = "wasm-threads")]
568pub use wasm_bindgen_rayon::init_thread_pool;
569#[path = "geometry/projection.rs"]
570mod projection;
571#[path = "geometry/projection_profile.rs"]
572mod projection_profile;
573#[doc(hidden)]
574pub use projection_profile::report as projection_profile_report;
575#[path = "geometry/affine_sphere.rs"]
576mod affine_sphere;
577pub use projection::{
578 project_point_to_curve, project_point_to_surface, project_point_to_surface_seeded,
579 CurveProjection, SurfaceProjection,
580};
581#[doc(hidden)]
582pub use projection::{
583 project_point_to_surface_basin_census, project_point_to_surface_general_lanes, BasinCensus,
584 GlobalStats,
585};
586#[path = "intersect/curve_surface_intersection.rs"]
587mod curve_surface_intersection;
588pub use curve_surface_intersection::{intersect_curve_surface, CurveSurfaceIntersection};
589#[path = "intersect/exact_line_surface.rs"]
590mod exact_line_surface;
591#[path = "intersect/curve_curve_intersection.rs"]
592mod curve_curve_intersection;
593pub use curve_curve_intersection::{intersect_curves, CurveCurveIntersection};
594#[path = "intersect/surface_surface_intersection.rs"]
595mod surface_surface_intersection;
596pub use surface_surface_intersection::{
597 intersect_surfaces, intersect_surfaces_supplemental, SurfaceIntersectionCurve,
598 SurfaceIntersectionOptions,
599};
600pub(crate) use surface_surface_intersection::TRANSVERSE_SEED_CROSS;
601#[path = "intersect/tangent_curve.rs"]
602mod tangent_curve;
603#[path = "intersect/crossing_node.rs"]
604mod crossing_node;
605pub use crossing_node::{crossing_node_split_enabled, split_at_crossing_nodes};
606pub use tangent_curve::{
607 classify_tangent_contact_at, find_tangent_contact, trace_tangent_curve, TangentContact,
608 EXTENDED_RANK_FLOOR,
609};
610#[path = "brep/classification.rs"]
611mod classification;
612pub use classification::{
613 classify_point, containment_lane, horizon_cross_frame, parameter_point_in_face,
614 trim_sample_count, trim_station, ContainmentLane, PointClass, PointClassification,
615 PolygonClass, SolidClassifier, COVERING_RIM_STRIP_SWITCH, HORIZON_CONTAINMENT_SWITCH,
616 HORIZON_CROSS_FRAME_SWITCH, HORIZON_SINGLE_LOOP_SWITCH, NO_SPHERE_CHART_TRIM_SWITCH,
617 SEAM_BAND_MERGED_SWITCH,
618};
619#[doc(hidden)]
620pub use classification::parameter_point_in_face_scan;
621#[path = "geometry/spatial.rs"]
622mod spatial;
623pub use spatial::{Aabb, Bvh};
624#[path = "brep/pair_classification.rs"]
625mod pair_classification;
626pub use pair_classification::{
627 classify_surface_pair, classify_surface_pair_cached, SurfaceClassifyData,
628 SurfacePairClassification, SurfacePairRelation,
629};
630#[path = "intersect/arrangement.rs"]
631mod arrangement;
632pub use arrangement::{
633 arrange_segments, point_in_polygon, segment_intersection, ArrangementPiece, ArrangementRegion,
634 CycleUse, Segment2, Vec2,
635};
636#[path = "geometry/pcurve.rs"]
637mod pcurve;
638pub use pcurve::{
639 build_pcurve_on_surface, build_pcurve_on_surface_marched, build_pcurve_on_surface_range,
640 build_pcurve_on_surface_range_dense, build_pcurve_on_surface_stations, fit_pcurve_on_surface,
641 fit_pcurve_on_surface_marched, fit_pcurve_on_surface_range, fit_pcurve_on_surface_range_dense,
642 fit_pcurve_on_surface_stations, PcurveFit, PcurveFitExit, PcurveFitLedger, PcurveFitReport,
643 PcurveFitScope, PCURVE_OFF_BAR, PCURVE_REFINEMENT_TOLERANCE,
644};
645#[path = "csg/imprint.rs"]
646mod imprint;
647pub use imprint::{
648 build_imprints, EdgeSplitRecord, FaceImprints, FaceKey, FacePcurve, ImprintOptions,
649 ImprintPieceRecord, ImprintResultRecord, ImprintVertex, TangentSectionRecord,
650};
651#[path = "csg/feature_scale.rs"]
652mod feature_scale;
653#[path = "csg/edge_split.rs"]
654mod edge_split;
655pub use edge_split::{apply_edge_splits, apply_edge_splits_with_map};
656#[path = "csg/fragment.rs"]
657mod fragment;
658pub use fragment::{
659 fragment_face, fragment_solid, FaceFragmentRecord, FragmentCoedge, FragmentEdgeSource,
660 FragmentLoop, FragmentOrder,
661};
662#[path = "csg/boolean/mod.rs"]
663mod boolean;
664pub use boolean::{
665 boolean_operation, boolean_operation_nary, boolean_operation_nary_with_options, boolean_operation_with_diagnostics, boolean_operation_with_diagnostics_at_offset, boolean_split_operands,
666 BooleanOperation, BooleanOptions,
667};
668#[path = "csg/oracle.rs"]
669mod oracle;
670pub use oracle::{
671 boolean_residual_fusables, boolean_semantic_disagreement, boolean_semantic_disagreement_nary,
672 OracleReport, ResidualFusable, ResidualKind, SemanticDisagreement, DISAGREEMENT_THRESHOLD,
673};
674#[path = "healing/heal.rs"]
675mod heal;
676#[path = "healing/reading_memo.rs"]
679mod reading_memo;
680#[path = "healing/accept.rs"]
686mod accept;
687pub use accept::{
688 accept_sound, accept_sound_against, accept_sound_against_scoped, resolve_face_crossing, resolve_face_crossing_between,
689 take_crossing_repairs,
690 CrossingRepairRecord,
691};
692#[path = "offset/point.rs"]
697mod offset_point;
698pub use offset_point::{OffsetEvaluator, OffsetNormal, OffsetSample};
699#[path = "offset/analytic_pair.rs"]
706mod offset_analytic_pair;
707#[path = "offset/retrim.rs"]
714mod offset_retrim;
715#[path = "offset/reintersect.rs"]
723mod offset_reintersect;
724#[path = "offset/measure.rs"]
734mod offset_measure;
735pub use offset_measure::{
736 measure_edge_against_pcurve_image, measure_surface_fit_against_pointwise_offset,
737 span_midpoint_error, vertex_endpoint_gap,
738};
739#[path = "offset/offset.rs"]
740mod offset;
741pub use offset::{
742 offset_face_carrier, offset_face_carrier_measured, offset_face_carrier_sided, offset_surface,
743 offset_surface_measured, offset_surface_measured_sided, CarrierDeviation, CarrierExtension,
744 MeasuredOffsetSurface, OffsetFaceCarrier, OffsetSurfaceLane,
745};
746#[path = "offset/regularity.rs"]
752mod offset_regularity;
753#[path = "offset/fold_locus.rs"]
759mod offset_fold_locus;
760#[path = "offset/carve.rs"]
766mod offset_carve;
767#[path = "offset/thicken.rs"]
768mod thicken;
769pub use thicken::{thicken_face_sheet, thicken_trimmed_sheet};
770#[path = "healing/coalesce.rs"]
771mod coalesce;
772pub use coalesce::{concatenate_exact_curve_pieces, merge_curve_continuation_edges};
773#[path = "healing/face_merge.rs"]
774mod face_merge;
775#[allow(dead_code)]
778#[path = "healing/faceted_repair.rs"]
779mod faceted_repair;
780pub use face_merge::{merge_faces_within, merge_same_surface_faces, merge_same_surface_faces_excluding, merge_same_surface_faces_scoped};
781pub use faceted_repair::{mesh_to_faceted_brep, repair_triangle_soup, MeshRepairReport};
782#[path = "offset/offset_shell.rs"]
783mod offset_shell;
784pub use offset_shell::{
785 offset_shell, offset_shell_by_boolean, offset_shell_closed, offset_shell_with_diagnostics, offset_solid, OffsetCorners,
786 OffsetFaceRole, OffsetShellFaceImageRecord, OffsetShellResultRecord,
787};
788pub(crate) use offset_shell::{is_offset_shell_no_retained_face, is_offset_shell_open_curved_rim};
789#[path = "io/step_matrix.rs"]
790mod step_matrix;
791#[path = "io/step.rs"]
792mod step;
793pub use step::{
794 assembly_export_tree, audit_step_manifold, audit_step_pcurves, export_step,
795 export_step_assembly, export_step_assembly_report, export_step_report,
796 export_step_report_named, Mat4, StepAssemblyExport, StepColors, StepExportOccurrence,
797 StepExportProduct, StepExportReport, StepPmi, PART_ATTRIBUTES, PART_NUMBER,
798};
799#[path = "io/appearance.rs"]
803mod appearance;
804pub use appearance::{BodyAppearance, ImportedColor, COLOR_METADATA_KEY};
805#[path = "io/step_import/mod.rs"]
806mod step_import;
807pub use step_import::{
808 import_step, import_step_bodies, import_step_report, import_step_trim_readings, import_step_with_appearance,
809 occurrence_ref_parts, read_step_assembly, read_step_pmi, rewrite_occurrence_refs,
810 ImportedStep, StepAssembly, StepBodyError, StepBodyTrimReadings, StepEdgeReading, StepFaceReading, StepImportReport,
811 StepOccurrence, StepProduct, StepSuppliedTrim, StepTrimReadings, OCCURRENCE_REF_PREFIX,
812 STATED_PRECISION_INCONSISTENCY_RATIO,
813};
814#[doc(hidden)]
816pub fn io_step_text_for_tests(value: &str) -> String {
817 step::pmi::step_text(value)
818}
819#[doc(hidden)]
820pub fn io_step_decode_text_for_tests(value: &str) -> String {
821 step_import::decode_step_text_for_tests(value)
822}
823#[path = "io/iges/mod.rs"]
824mod iges;
825pub use iges::{
826 export_iges, export_iges_assembly, export_iges_bodies, import_iges, import_iges_report,
827 read_iges_assembly, IgesBody, IgesImportReport,
828};
829#[path = "io/mesh_io.rs"]
830mod mesh_io;
831pub use mesh_io::{
832 parse_stl_triangles, read_obj, read_stl, write_ascii_stl, write_binary_stl, write_obj,
833 ObjReadResult, StlError, StlFormat, StlReadResult, StlTriangles,
834};
835#[path = "io/three_mf/mod.rs"]
841mod three_mf;
842pub use three_mf::{
843 read_3mf, write_3mf, write_3mf_meshes, ThreeMfBeam, ThreeMfBeamLattice, ThreeMfAppearance, ThreeMfTexture, ThreeMfError, ThreeMfInstance, ThreeMfMesh, ThreeMfReadResult,
844 ThreeMfSolid, ThreeMfUnit, ThreeMfWriteReport,
845};
846#[path = "io/glb.rs"]
850mod glb;
851pub use glb::{write_glb, GlbReport, GlbSolid, GlbUpAxis, GLB_MAGIC};
852#[path = "io/snapshot.rs"]
856mod snapshot;
857pub use snapshot::{
858 restore_solids, snapshot_resident_solids, snapshot_solids, RestoredSnapshot, RestoredSolid,
859 SNAPSHOT_FORMAT_VERSION,
860};
861#[path = "solvers/linear_algebra.rs"]
862mod solver_linear_algebra;
863#[path = "solvers/sketch_solver.rs"]
864mod sketch_solver;
865pub use sketch_solver::{
866 is_sketch_origin_point_id, sketch_id_key, mint_sketch_id, solve_sketch, solve_sketch_from_json,
867 SketchSolverSettings, SolveSketchRequest, SKETCH_ORIGIN_POINT_ID,
868};
869#[path = "solvers/assembly_solver.rs"]
870mod assembly_solver;
871pub use assembly_solver::{
872 solve_assembly, AssemblyBody, AssemblyMate, AssemblySolution, AssemblySolveOptions, BodyFreedom, BodyPose,
873 LinearAlgebra, MateAlign, MateAxis, MateCurve, MateKind, MatePlane, MateResidualReport,
874 SolveStrategy, SymmetricElement,
875};
876#[path = "solvers/sketch3d_solver.rs"]
880mod sketch3d_solver;
881pub use sketch3d_solver::{
882 sketch3d_constraint_type, solve_sketch3d, solve_sketch3d_doc, solve_sketch3d_from_json,
883 Sketch3dConstraint, Sketch3dConstraintType, Sketch3dDiagnostics, Sketch3dDoc,
884 Sketch3dGeometry, Sketch3dPoint, Sketch3dSolveOptions, SolveSketch3dRequest,
885 SKETCH3D_CONSTRAINT_TYPES,
886};
887#[path = "solvers/assembly_resolve.rs"]
888mod assembly_resolve;
889pub use assembly_resolve::{
890 is_component_reference, resolve_component_point, resolve_edge_selection,
891 resolve_face_selection, resolve_named_selection, resolve_vertex_selection,
892 split_component_namespace, ResolveError, SelectionGeometry,
893};
894#[path = "edit/direct_edit.rs"]
895mod direct_edit;
896pub use direct_edit::{
897 delete_face_and_heal, delete_faces_and_heal, draft_faces, draft_faces_parted, move_faces, move_faces_unchecked,
898 offset_freeform_face,
899 offset_revolution_face, offset_ruled_face, offset_ruled_face_unchecked, offset_sphere_face, offset_torus_face,
900 rebuild_displaced_blends, with_blend_rebuild_decline,
901 recut_moved_planes, recut_moved_planes_rigid, reblend_lost_fillets, resolve_face_by_point, rotate_faces, rotate_faces_unchecked,
902 route_reading, RouteReading,
903};
904pub use direct_edit::{face_refusal_slugs, face_transform_reason, FaceTransformReason};
905pub use direct_edit::{
906 refit_faces_as_one, refit_refusal_phrases, RefitCarrier, RefitReport, RefitSurfaceKind,
907};
908#[path = "healing/sew.rs"]
909mod sew;
910pub use sew::{sew_solid, split_pinched_vertices, SewReport};
911#[path = "meshing/mesh_weld.rs"]
912mod mesh_weld;
913pub use mesh_weld::{canonical_bits, VertexWeld};
914#[path = "meshing/mesh_segment.rs"]
915mod mesh_segment;
916pub use mesh_segment::{
917 mesh_regions_to_brep, segment_mesh_faces, MeshRegion, MeshSegmentation, RegionCarrier,
918 SegmentOptions, UNASSIGNED_REGION,
919};
920
921#[path = "meshing/spherical_union.rs"]
922mod spherical_union;
923pub use spherical_union::reconstruct_spherical_mesh_union;
924
925#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize)]
926pub struct Vec3 {
927 pub x: f64,
928 pub y: f64,
929 pub z: f64,
930}
931
932impl Vec3 {
933 pub const ZERO: Self = Self { x: 0.0, y: 0.0, z: 0.0 };
934 pub const X: Self = Self { x: 1.0, y: 0.0, z: 0.0 };
935 pub const Y: Self = Self { x: 0.0, y: 1.0, z: 0.0 };
936 pub const Z: Self = Self { x: 0.0, y: 0.0, z: 1.0 };
937
938 pub fn normalized_or(self, fallback: Self) -> Self {
940 self.normalized().unwrap_or(fallback)
941 }
942
943 #[inline]
945 pub fn rotate_about(self, axis: Self, angle: f64) -> Self {
946 let (sin, cos) = angle.sin_cos();
947 self.scale(cos)
948 .add(axis.cross(self).scale(sin))
949 .add(axis.scale(axis.dot(self) * (1.0 - cos)))
950 }
951
952 #[inline]
954 pub fn distance_to_segment(self, start: Self, end: Self, guard: f64) -> f64 {
955 let segment = end.sub(start);
956 let length_squared = segment.dot(segment);
957 if length_squared <= guard {
958 return self.sub(start).length();
959 }
960 let parameter = (self.sub(start).dot(segment) / length_squared).clamp(0.0, 1.0);
961 self.sub(start.add(segment.scale(parameter))).length()
962 }
963
964 #[inline]
966 pub fn distance_to_segment_squared(self, start: Self, end: Self) -> f64 {
967 let segment = end.sub(start);
968 let length_squared = segment.dot(segment);
969 let parameter = if length_squared > 0.0 {
970 (self.sub(start).dot(segment) / length_squared).clamp(0.0, 1.0)
971 } else {
972 0.0
973 };
974 let residual = self.sub(start.add(segment.scale(parameter)));
975 residual.dot(residual)
976 }
977
978 pub fn new(x: f64, y: f64, z: f64) -> Self {
979 Self { x, y, z }
980 }
981 pub fn sub(self, rhs: Self) -> Self {
982 Self::new(self.x - rhs.x, self.y - rhs.y, self.z - rhs.z)
983 }
984 pub fn add(self, rhs: Self) -> Self {
985 Self::new(self.x + rhs.x, self.y + rhs.y, self.z + rhs.z)
986 }
987 pub fn scale(self, factor: f64) -> Self {
988 Self::new(self.x * factor, self.y * factor, self.z * factor)
989 }
990 pub fn cross(self, rhs: Self) -> Self {
991 Self::new(
992 self.y * rhs.z - self.z * rhs.y,
993 self.z * rhs.x - self.x * rhs.z,
994 self.x * rhs.y - self.y * rhs.x,
995 )
996 }
997 pub fn dot(self, rhs: Self) -> f64 {
998 self.x * rhs.x + self.y * rhs.y + self.z * rhs.z
999 }
1000 pub fn length(self) -> f64 {
1001 self.dot(self).sqrt()
1002 }
1003 pub fn length_squared(self) -> f64 {
1004 self.dot(self)
1005 }
1006 pub fn normalized(self) -> Result<Self, String> {
1007 let length = self.length();
1008 if length <= 1e-12 {
1009 return Err("Vec3.normalized: zero-length vector".into());
1010 }
1011 Ok(self.scale(1.0 / length))
1012 }
1013 pub fn perpendicular(self) -> Result<Self, String> {
1014 let x = self.x.abs();
1015 let y = self.y.abs();
1016 let z = self.z.abs();
1017 let axis = if x <= y && x <= z {
1018 Self::new(1.0, 0.0, 0.0)
1019 } else if y <= z {
1020 Self::new(0.0, 1.0, 0.0)
1021 } else {
1022 Self::new(0.0, 0.0, 1.0)
1023 };
1024 self.cross(axis).normalized()
1025 }
1026}
1027
1028#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1029pub struct Mesh {
1030 pub positions: Vec<f64>,
1031 pub normals: Vec<f64>,
1032 pub indices: Vec<u32>,
1033 pub face_ids: Vec<u32>,
1034}
1035
1036impl Mesh {
1037 fn push_vertex(&mut self, point: Vec3, normal: Vec3) -> u32 {
1038 self.positions.extend([point.x, point.y, point.z]);
1039 self.normals.extend([normal.x, normal.y, normal.z]);
1040 (self.positions.len() / 3 - 1) as u32
1041 }
1042
1043 fn quad(&mut self, points: [Vec3; 4], normal: Vec3, face_id: u32) {
1044 let base = self.push_vertex(points[0], normal);
1045 for point in points.iter().skip(1) {
1046 self.push_vertex(*point, normal);
1047 }
1048 self.indices
1049 .extend([base, base + 1, base + 2, base, base + 2, base + 3]);
1050 self.face_ids.extend([face_id, face_id]);
1051 }
1052
1053 pub fn signed_volume(&self) -> f64 {
1054 self.indices
1055 .chunks_exact(3)
1056 .map(|tri| {
1057 let point = |index: u32| {
1058 let i = index as usize * 3;
1059 Vec3::new(
1060 self.positions[i],
1061 self.positions[i + 1],
1062 self.positions[i + 2],
1063 )
1064 };
1065 point(tri[0]).dot(point(tri[1]).cross(point(tri[2]))) / 6.0
1066 })
1067 .sum()
1068 }
1069
1070 pub fn validate(&self) -> Result<(), String> {
1071 if self.positions.len() % 3 != 0 || self.normals.len() != self.positions.len() {
1072 return Err("invalid vertex or normal buffer".into());
1073 }
1074 self.validate_geometry()
1075 }
1076
1077 pub fn validate_geometry(&self) -> Result<(), String> {
1082 if self.positions.len() % 3 != 0 {
1083 return Err("invalid vertex buffer".into());
1084 }
1085 if self.indices.len() % 3 != 0 {
1086 return Err("index buffer is not triangular".into());
1087 }
1088 let count = self.positions.len() / 3;
1089 if self.indices.iter().any(|index| *index as usize >= count) {
1090 return Err("index outside vertex buffer".into());
1091 }
1092 if !self.positions.iter().all(|value| value.is_finite()) {
1093 return Err("non-finite vertex".into());
1094 }
1095 Ok(())
1096 }
1097}
1098
1099pub fn make_box(size_x: f64, size_y: f64, size_z: f64) -> Mesh {
1100 let x = size_x.abs();
1101 let y = size_y.abs();
1102 let z = size_z.abs();
1103 let p = [
1104 Vec3::new(0.0, 0.0, 0.0),
1105 Vec3::new(x, 0.0, 0.0),
1106 Vec3::new(x, y, 0.0),
1107 Vec3::new(0.0, y, 0.0),
1108 Vec3::new(0.0, 0.0, z),
1109 Vec3::new(x, 0.0, z),
1110 Vec3::new(x, y, z),
1111 Vec3::new(0.0, y, z),
1112 ];
1113 let mut mesh = Mesh::default();
1114 mesh.quad([p[0], p[3], p[2], p[1]], Vec3::new(0.0, 0.0, -1.0), 0);
1115 mesh.quad([p[4], p[5], p[6], p[7]], Vec3::new(0.0, 0.0, 1.0), 1);
1116 mesh.quad([p[0], p[1], p[5], p[4]], Vec3::new(0.0, -1.0, 0.0), 2);
1117 mesh.quad([p[3], p[7], p[6], p[2]], Vec3::new(0.0, 1.0, 0.0), 3);
1118 mesh.quad([p[0], p[4], p[7], p[3]], Vec3::new(-1.0, 0.0, 0.0), 4);
1119 mesh.quad([p[1], p[2], p[6], p[5]], Vec3::new(1.0, 0.0, 0.0), 5);
1120 mesh
1121}
1122
1123pub fn make_cylinder(radius: f64, height: f64, segments: usize) -> Mesh {
1124 let radius = radius.abs();
1125 let height = height.abs();
1126 let segments = segments.max(3);
1127 let mut mesh = Mesh::default();
1128 for i in 0..segments {
1129 let a = std::f64::consts::TAU * i as f64 / segments as f64;
1130 let b = std::f64::consts::TAU * (i + 1) as f64 / segments as f64;
1131 let (sa, ca) = a.sin_cos();
1132 let (sb, cb) = b.sin_cos();
1133 let pa = Vec3::new(radius * ca, 0.0, -radius * sa);
1134 let pb = Vec3::new(radius * cb, 0.0, -radius * sb);
1135 let ta = Vec3::new(pa.x, height, pa.z);
1136 let tb = Vec3::new(pb.x, height, pb.z);
1137 mesh.quad(
1138 [pa, pb, tb, ta],
1139 Vec3::new((ca + cb) * 0.5, 0.0, -(sa + sb) * 0.5),
1140 0,
1141 );
1142 let bottom = mesh.push_vertex(Vec3::default(), Vec3::new(0.0, -1.0, 0.0));
1143 let bi = mesh.push_vertex(pb, Vec3::new(0.0, -1.0, 0.0));
1144 let bj = mesh.push_vertex(pa, Vec3::new(0.0, -1.0, 0.0));
1145 mesh.indices.extend([bottom, bi, bj]);
1146 mesh.face_ids.push(1);
1147 let top = mesh.push_vertex(Vec3::new(0.0, height, 0.0), Vec3::new(0.0, 1.0, 0.0));
1148 let ti = mesh.push_vertex(ta, Vec3::new(0.0, 1.0, 0.0));
1149 let tj = mesh.push_vertex(tb, Vec3::new(0.0, 1.0, 0.0));
1150 mesh.indices.extend([top, ti, tj]);
1151 mesh.face_ids.push(2);
1152 }
1153 mesh
1154}
1155
1156
1157mod abi;
1158pub use abi::*;
1159
1160
1161#[path = "healing/curve_helpers.rs"]
1162mod curve_helpers;
1163
1164#[path = "geometry/eigen2.rs"]
1165mod eigen2;
1166
1167#[path = "geometry/union_find.rs"]
1168pub mod union_find;
1169pub use union_find::UnionFind;
1170
1171#[path = "geometry/poly.rs"]
1172pub mod poly;
1173
1174pub use analytic_surface::{circumcenter, circumcenter_2d, recognize_circle, RecognizedCircle};
1175
1176#[path = "geometry/triangle.rs"]
1177mod triangle;
1178pub use triangle::closest_point_on_triangle;
1179
1180pub use tolerance::RIGID_TOL;
1181
1182impl std::ops::Index<usize> for Vec3 {
1183 type Output = f64;
1184 fn index(&self, index: usize) -> &Self::Output {
1185 match index { 0 => &self.x, 1 => &self.y, 2 => &self.z, _ => panic!("Vec3 index out of bounds: {index}") }
1186 }
1187}
1188impl std::ops::IndexMut<usize> for Vec3 {
1189 fn index_mut(&mut self, index: usize) -> &mut Self::Output {
1190 match index { 0 => &mut self.x, 1 => &mut self.y, 2 => &mut self.z, _ => panic!("Vec3 index out of bounds: {index}") }
1191 }
1192}