Struct bevy_math::primitives::Torus
source · pub struct Torus {
pub minor_radius: f32,
pub major_radius: f32,
}
Expand description
A torus primitive, often representing a ring or donut shape
Fields§
§minor_radius: f32
The radius of the tube of the torus
major_radius: f32
The distance from the center of the torus to the center of the tube
Implementations§
source§impl Torus
impl Torus
sourcepub fn new(inner_radius: f32, outer_radius: f32) -> Self
pub fn new(inner_radius: f32, outer_radius: f32) -> Self
Create a new Torus
from an inner and outer radius.
The inner radius is the radius of the hole, and the outer radius is the radius of the entire object
sourcepub fn inner_radius(&self) -> f32
pub fn inner_radius(&self) -> f32
Get the inner radius of the torus.
For a ring torus, this corresponds to the radius of the hole,
or major_radius - minor_radius
sourcepub fn outer_radius(&self) -> f32
pub fn outer_radius(&self) -> f32
Get the outer radius of the torus.
This corresponds to the overall radius of the entire object,
or major_radius + minor_radius
sourcepub fn kind(&self) -> TorusKind
pub fn kind(&self) -> TorusKind
Get the TorusKind
determined by the minor and major radii.
The torus can either be a ring torus that has a hole, a horn torus that doesn’t have a hole but also isn’t self-intersecting, or a spindle torus that is self-intersecting.
If the minor or major radius is non-positive, infinite, or NaN
,
TorusKind::Invalid
is returned