axiolid_surface/elementary.rs
1//! Elementary analytic surfaces.
2
3use axiolid_core::{Frame3, Scalar};
4
5/// Infinite plane.
6#[derive(Debug, Clone, Copy, PartialEq)]
7pub struct Plane {
8 /// Local frame; `z` is the normal.
9 pub frame: Frame3,
10}
11
12/// Infinite circular cylinder.
13#[derive(Debug, Clone, Copy, PartialEq)]
14pub struct Cylinder {
15 /// Local frame; `z` is the axis.
16 pub frame: Frame3,
17 /// Radius.
18 pub radius: Scalar,
19}
20
21/// Infinite elliptical cylinder.
22///
23/// Distinct from [`Cylinder`] rather than a special case of it: a circular
24/// cylinder's outward normal is its radial direction, and for an ellipse that
25/// is only true at the four axis points -- elsewhere the two disagree by up to
26/// 53 degrees for a 3:1 ellipse. Anything that assumes radial normals is wrong
27/// here, so the type is separate and forces the question.
28#[derive(Debug, Clone, Copy, PartialEq)]
29pub struct EllipticalCylinder {
30 /// Local frame; `z` is the axis, `x` and `y` the semi-axis directions.
31 pub frame: Frame3,
32 /// Semi-axis along local `x`.
33 pub semi_axis_x: Scalar,
34 /// Semi-axis along local `y`.
35 pub semi_axis_y: Scalar,
36}
37
38/// Infinite right circular cone.
39#[derive(Debug, Clone, Copy, PartialEq)]
40pub struct Cone {
41 /// Local frame; `z` is the axis.
42 pub frame: Frame3,
43 /// Radius at the local origin plane.
44 pub radius: Scalar,
45 /// Semi-angle in radians.
46 pub semi_angle: Scalar,
47}
48
49/// Sphere.
50#[derive(Debug, Clone, Copy, PartialEq)]
51pub struct Sphere {
52 /// Local frame.
53 pub frame: Frame3,
54 /// Radius.
55 pub radius: Scalar,
56}
57
58/// Torus.
59#[derive(Debug, Clone, Copy, PartialEq)]
60pub struct Torus {
61 /// Local frame; `z` is the revolution axis.
62 pub frame: Frame3,
63 /// Radius from frame origin to tube center.
64 pub major_radius: Scalar,
65 /// Tube radius.
66 pub minor_radius: Scalar,
67}