shape_core/elements/ellipses/
mod.rs

1use super::*;
2
3mod circle;
4mod circle3d;
5mod convert;
6mod ellipse;
7
8/// A circle defined by center and radius.
9#[cfg_attr(feature = "serde", repr(C), derive(Serialize, Deserialize))]
10#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
11pub struct Circle<T> {
12    /// The center points of the circle.
13    pub center: Point<T>,
14    /// The radius of the circle.
15    pub radius: T,
16}
17
18/// A circle in 3D space defined by center and radius.
19#[cfg_attr(feature = "serde", repr(C), derive(Serialize, Deserialize))]
20#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
21pub struct Circle3D<T> {
22    /// The center points of the circle.
23    pub center: Point3D<T>,
24    pub radius: T,
25    pub rotate: (T, T, T),
26}
27
28/// An ellipse defined by center and axes.
29#[cfg_attr(feature = "serde", repr(C), derive(Serialize, Deserialize))]
30#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
31pub struct Ellipse<T> {
32    /// The center points of the ellipse.
33    pub center: Point<T>,
34    /// The axes of the ellipse.
35    pub radius: (T, T),
36    /// The rotation of the ellipse.
37    pub rotate: T,
38}
39
40/// A ellipse in 3D space defined by center and radius.
41#[cfg_attr(feature = "serde", repr(C), derive(Serialize, Deserialize))]
42#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
43pub struct Ellipse3D<T> {
44    /// The center points of the ellipse in 3D space.
45    pub center: Point3D<T>,
46    /// The axes of the ellipse.
47    pub radius: (T, T),
48    /// The rotation of the ellipse in 3D space.
49    pub rotate: (T, T, T),
50}
51
52/// A Ball in 3D space
53#[cfg_attr(feature = "serde", repr(C), derive(Serialize, Deserialize))]
54#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
55pub struct Ball<T> {
56    /// The coordinates of the center point of the ball
57    pub center: Point3D<T>,
58    /// The radius of the ball
59    pub radius: T,
60}
61
62#[cfg_attr(feature = "serde", repr(C), derive(Serialize, Deserialize))]
63#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
64pub struct Ellipsoid<T> {
65    /// The coordinates of the center point of the ellipsoid
66    pub center: Point3D<T>,
67    /// The radius from x, y, z axes
68    pub radius: (T, T, T),
69    /// The rotate from a, b, y corner
70    pub rotate: (T, T, T),
71}