1//! This module defines primitive shapes.
2//! The origin is (0, 0) for 2D primitives and (0, 0, 0) for 3D primitives,
3//! unless stated otherwise.
45mod dim2;
6pub use dim2::*;
7mod dim3;
8pub use dim3::*;
9mod inset;
10pub use inset::*;
11mod half_space;
12mod polygon;
13pub use half_space::*;
14mod view_frustum;
15pub use view_frustum::*;
1617/// A marker trait for 2D primitives
18pub trait Primitive2d {}
1920/// A marker trait for 3D primitives
21pub trait Primitive3d {}
2223/// The winding order for a set of points
24#[derive(#[automatically_derived]
impl ::core::clone::Clone for WindingOrder {
#[inline]
fn clone(&self) -> WindingOrder { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for WindingOrder { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for WindingOrder {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
WindingOrder::Clockwise => "Clockwise",
WindingOrder::CounterClockwise => "CounterClockwise",
WindingOrder::Invalid => "Invalid",
})
}
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for WindingOrder {
#[inline]
fn eq(&self, other: &WindingOrder) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for WindingOrder {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq)]
25#[doc(alias = "Orientation")]
26pub enum WindingOrder {
27/// A clockwise winding order
28Clockwise,
29/// A counterclockwise winding order
30#[doc(alias = "AntiClockwise")]
31CounterClockwise,
32/// An invalid winding order indicating that it could not be computed reliably.
33 /// This often happens in *degenerate cases* where the points lie on the same line
34#[doc(alias("Degenerate", "Collinear"))]
35Invalid,
36}
3738/// A trait for getting measurements of 2D shapes
39pub trait Measured2d {
40/// Get the perimeter of the shape
41fn perimeter(&self) -> f32;
4243/// Get the area of the shape
44fn area(&self) -> f32;
45}
4647/// A trait for getting measurements of 3D shapes
48pub trait Measured3d {
49/// Get the surface area of the shape
50fn area(&self) -> f32;
5152/// Get the volume of the shape
53fn volume(&self) -> f32;
54}