ogeom_doc/construction.rs
1//! Construction geometry: named points, axes, curves and surfaces a product
2//! carries for reference.
3//!
4//! Construction geometry has no topology and encloses nothing: a datum point,
5//! a reference axis, a fitted section curve, a bounded reference plane. It is
6//! document data like notes and views: it takes part in undo, persists in the
7//! native document format, and goes through STEP as the geometric set it is
8//! there.
9
10use ogeom_geom::{Curve, SurfaceGeometry};
11use ogeom_math::{Frame, Point};
12
13/// The geometry of one construction item.
14#[derive(Debug, Clone, PartialEq)]
15pub enum ConstructionGeometry {
16 /// A point.
17 Point(Point),
18 /// An axis placement: an origin, its `z` axis and its `x` axis, with `y`
19 /// as `z × x`.
20 Axis(Frame),
21 /// A curve over a finite stretch of its parameter.
22 Curve {
23 /// The curve.
24 curve: Curve,
25 /// The stretch of its parameter the item is.
26 range: (f64, f64),
27 },
28 /// A surface over a finite window of its parameters.
29 Surface {
30 /// The surface.
31 surface: SurfaceGeometry,
32 /// The window's `u` stretch.
33 u: (f64, f64),
34 /// The window's `v` stretch.
35 v: (f64, f64),
36 },
37}
38
39/// A named construction item and the product it belongs to.
40#[derive(Debug, Clone, PartialEq)]
41pub struct Construction {
42 /// The item's name, as the author gave it.
43 pub name: String,
44 /// What it is.
45 pub geometry: ConstructionGeometry,
46 /// The product carrying it.
47 pub product: crate::structure::ProductId,
48}