shape_core/elements/rectangles/
mod.rs

1use super::*;
2mod traits;
3
4mod parallelogram;
5pub mod rectangle_2d;
6pub mod rectangle_3d;
7pub mod square_2d;
8
9/// A parallelogram is a quadrilateral with two pairs of parallel sides.
10///
11/// # Notice
12///
13/// The constructor will not check the legality of the parameters, call [`is_valid`] to ensure that the rectangle_2d is legal.
14///
15/// # Examples
16///
17/// ```
18/// # use shape_core::Square;
19/// let rect = Square::new(0.0, 0.0, 1.0);
20/// ```
21#[cfg_attr(feature = "serde", repr(C), derive(Serialize, Deserialize))]
22#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
23pub struct Parallelogram<T> {
24    /// The origin points of the parallelogram.
25    pub anchor: Point<T>,
26    /// The side length of the parallelogram.
27    pub side: (Point<T>, Point<T>),
28}