1mod brep;
27mod connection;
28mod csg;
29mod curve;
30mod grid;
31mod placement;
32mod profile;
33mod profile2;
34mod release;
35mod solid;
36mod spiral;
37mod std_profile;
38mod surface;
39mod surface_curve;
40mod swept;
41mod swept_in;
42mod tessellation;
43mod transform;
44
45pub use brep::{
46 bare_topology, edge, edge_curve, edge_loop, face, face_based_surface_model, face_bound,
47 face_outer_bound, face_surface, manifold_solid_brep, oriented_edge, poly_loop, shell,
48 shell_based_surface_model, subedge, vertex_loop, vertex_point, BareTopology, BrepKind,
49 ShellKind,
50};
51pub use connection::{
52 boolean_clipping_result, connection_geometry, connection_point_eccentricity, geometric_set,
53 grid_axis, grid_placement, local_placement, path, point_on_curve, point_on_surface,
54 sectioned_spine, virtual_grid_intersection, ConnectionKind,
55};
56pub use csg::{
57 block, bounding_box, boxed_half_space, cone, csg_solid, cylinder, half_space,
58 polygonal_bounded_half_space, rectangular_pyramid, sphere,
59};
60pub use curve::{
61 bspline_curve_with_knots, circle, composite_curve, composite_curve_segment, ellipse,
62 indexed_poly_curve, line, offset_curve_2d, offset_curve_3d, offset_curve_by_distances,
63 polynomial_curve, rational_bspline_curve_with_knots, segmented_reference_curve, trimmed_curve,
64 vector, KnotVector, PolyCurveSegment, PolynomialCoefficients,
65};
66pub use grid::{grid, grid_with_owner_history};
67pub use placement::{axis2_placement_2d, axis2_placement_3d, cartesian_point, direction};
68pub use profile::{
69 arbitrary_closed_profile, circle_profile, polyline, rectangle_profile, ProfileType,
70};
71pub use profile2::{
72 arbitrary_open_profile, arbitrary_profile_with_voids, center_line_profile, composite_profile,
73 derived_profile, mirrored_profile, open_cross_profile, profile_def, rounded_rectangle_profile,
74};
75pub use solid::{boolean_result, extruded_area_solid, revolved_area_solid};
76pub use spiral::{spiral, SpiralKind};
77pub use std_profile::{
78 asymmetric_i_shape, c_shape, circle_hollow_profile, ellipse_profile, i_shape, l_shape,
79 rectangle_hollow_profile, t_shape, trapezium_profile, u_shape, z_shape, AsymmetricIDims,
80 AsymmetricIExtras, CShapeDims, FlangedDims, IShapeDims, IShapeExtras, LShapeExtras,
81 ProfileHeader, RectangleHollowDims, RectangleHollowFillets, TShapeExtras, TrapeziumDims,
82 UShapeExtras, ZShapeExtras,
83};
84pub use surface::{
85 bspline_surface_with_knots, curve_bounded_plane, curve_bounded_surface,
86 rational_bspline_surface_with_knots, rectangular_trimmed_surface, spherical_surface,
87 toroidal_surface, SurfaceBasis, SurfaceKnots,
88};
89pub use surface_curve::{
90 composite_curve_on_surface, curve_segment, gradient_curve, pcurve,
91 reparametrised_composite_curve_segment, surface_curve, CurveMeasure, OnSurfaceKind,
92 SurfaceCurveKind, SurfaceCurveRepresentation,
93};
94pub use swept::{
95 axis1_placement, cylindrical_surface, directrix_derived_reference_swept_area_solid,
96 extruded_area_solid_tapered, plane, revolved_area_solid_tapered, sectioned,
97 surface_of_linear_extrusion, surface_of_revolution, swept_disk_solid_polygonal, SectionedKind,
98 SweepTrim,
99};
100pub use swept_in::{
101 fixed_reference_swept_area_solid_in, surface_curve_swept_area_solid_in, swept_disk_solid_in,
102};
103pub use tessellation::{
104 cartesian_point_list_2d, cartesian_point_list_3d, indexed_polygonal_face,
105 indexed_polygonal_face_with_voids, polygonal_face_set, triangulated_face_set,
106 triangulated_irregular_network, TriangulatedExtras,
107};
108pub use transform::{
109 mapped_item, representation_map, shape_aspect, topology_representation,
110 transformation_operator_2d, transformation_operator_2d_non_uniform, transformation_operator_3d,
111 transformation_operator_3d_non_uniform, Transform,
112};
113
114use ifc_model::{EntityId, Value};
115
116use crate::error::GeometryError;
117
118fn invalid(
120 type_name: &'static str,
121 attribute: &'static str,
122 detail: impl Into<String>,
123) -> GeometryError {
124 GeometryError::InvalidAuthoredValue {
125 type_name,
126 attribute,
127 detail: detail.into(),
128 }
129}
130
131fn require_finite(
137 type_name: &'static str,
138 attribute: &'static str,
139 values: &[f64],
140) -> Result<(), GeometryError> {
141 if let Some(bad) = values.iter().position(|v| !v.is_finite()) {
142 return Err(invalid(
143 type_name,
144 attribute,
145 format!("value at index {bad} is not finite"),
146 ));
147 }
148 Ok(())
149}
150
151fn reals(values: &[f64]) -> Value {
153 Value::List(values.iter().copied().map(Value::Real).collect())
154}
155
156fn refs(ids: &[EntityId]) -> Value {
158 Value::List(ids.iter().copied().map(Value::Ref).collect())
159}