pub struct Frustum {
pub planes: [Plane; 6],
}Expand description
A view frustum defined by 6 planes (near, far, left, right, top, bottom).
Fields§
§planes: [Plane; 6]The six bounding planes of the frustum.
Implementations§
Source§impl Frustum
impl Frustum
Sourcepub fn from_view_projection(vp: &Mat4) -> Self
pub fn from_view_projection(vp: &Mat4) -> Self
Extract frustum planes from a combined view-projection matrix.
The resulting planes have inward-facing normals.
Sourcepub fn contains_point(&self, point: &Vec3) -> bool
pub fn contains_point(&self, point: &Vec3) -> bool
Test whether a point lies inside (or on) the frustum.
Sourcepub fn intersects_sphere(&self, center: &Vec3, radius: Real) -> bool
pub fn intersects_sphere(&self, center: &Vec3, radius: Real) -> bool
Test whether a sphere intersects the frustum.
Source§impl Frustum
impl Frustum
Sourcepub fn contains_sphere(&self, center: &Vec3, radius: Real) -> bool
pub fn contains_sphere(&self, center: &Vec3, radius: Real) -> bool
Test whether a sphere is fully contained inside the frustum.
Returns true if every plane’s signed distance to center is ≥ radius.
Sourcepub fn intersects_aabb(&self, aabb: &Aabb) -> bool
pub fn intersects_aabb(&self, aabb: &Aabb) -> bool
Test whether an axis-aligned bounding box (AABB) intersects the frustum.
Uses the separating-axis theorem: for each frustum plane, if all 8 corners of the AABB are on the outside half-space, the AABB is rejected.
Sourcepub fn extract_from_view_proj(vp: &Mat4) -> Self
pub fn extract_from_view_proj(vp: &Mat4) -> Self
Build a frustum directly from a combined view-projection matrix.
Alias for Frustum::from_view_projection with a more explicit name.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Frustum
impl RefUnwindSafe for Frustum
impl Send for Frustum
impl Sync for Frustum
impl Unpin for Frustum
impl UnsafeUnpin for Frustum
impl UnwindSafe for Frustum
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.