brepkit_offset/error.rs
1//! Error types for the offset engine.
2
3use brepkit_topology::edge::EdgeId;
4use brepkit_topology::face::FaceId;
5
6/// Errors from solid offset operations.
7#[derive(Debug, thiserror::Error)]
8pub enum OffsetError {
9 /// A topology operation failed.
10 #[error("topology error: {0}")]
11 Topology(#[from] brepkit_topology::TopologyError),
12
13 /// A math operation failed.
14 #[error("math error: {0}")]
15 Math(#[from] brepkit_math::MathError),
16
17 /// The input parameters are invalid.
18 #[error("invalid input: {reason}")]
19 InvalidInput {
20 /// Description of why the input is invalid.
21 reason: String,
22 },
23
24 /// Edge analysis could not determine convexity.
25 #[error("analysis failed for edge {edge:?}: {reason}")]
26 AnalysisFailed {
27 /// The edge that could not be classified.
28 edge: EdgeId,
29 /// Description of the failure.
30 reason: String,
31 },
32
33 /// Intersection of two offset faces failed.
34 #[error("intersection failed between faces {face_a:?} and {face_b:?}: {reason}")]
35 IntersectionFailed {
36 /// First face in the intersection pair.
37 face_a: FaceId,
38 /// Second face in the intersection pair.
39 face_b: FaceId,
40 /// Description of the failure.
41 reason: String,
42 },
43
44 /// A self-intersection was detected in the offset shell.
45 #[error("self-intersection: {reason}")]
46 SelfIntersection {
47 /// Description of the self-intersection.
48 reason: String,
49 },
50
51 /// Final shell assembly failed.
52 #[error("assembly failed: {reason}")]
53 AssemblyFailed {
54 /// Description of the assembly failure.
55 reason: String,
56 },
57
58 /// The offset distance exceeds the local curvature, collapsing the solid.
59 #[error("offset distance collapses the solid")]
60 CollapsedSolid,
61}