pub struct RtTriangle {
pub v0: Vec3A,
pub e1: Vec3A,
pub e2: Vec3A,
pub ng: Vec3A,
}Expand description
A 3D triangle optimized for CPU ray intersection performance.
Fields§
§v0: Vec3ABase vertex
e1: Vec3AEdge 1 v0 - v1
e2: Vec3AEdge 2 v2 - v0
ng: Vec3AGeometric normal e1.cross(e2).
Optimized for intersection.
Needs to be inverted for typical normal.
Implementations§
Source§impl RtTriangle
impl RtTriangle
pub fn new(v0: Vec3A, v1: Vec3A, v2: Vec3A) -> Self
pub fn aabb(&self) -> Aabb
pub fn compute_normal(&self) -> Vec3A
Sourcepub fn intersect(&self, ray: &Ray) -> f32
pub fn intersect(&self, ray: &Ray) -> f32
Find the distance (t) of the intersection of the Ray and this Triangle.
Returns f32::INFINITY for miss.
pub fn intersect_embree(&self, ray: &Ray) -> f32
pub fn compute_barycentric(&self, ray: &Ray) -> Vec2
Trait Implementations§
Source§impl Clone for RtTriangle
impl Clone for RtTriangle
Source§fn clone(&self) -> RtTriangle
fn clone(&self) -> RtTriangle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for RtTriangle
impl Default for RtTriangle
Source§fn default() -> RtTriangle
fn default() -> RtTriangle
Returns the “default value” for a type. Read more
Source§impl From<&Triangle> for RtTriangle
impl From<&Triangle> for RtTriangle
Source§impl PartialEq for RtTriangle
impl PartialEq for RtTriangle
impl Copy for RtTriangle
impl StructuralPartialEq for RtTriangle
Auto Trait Implementations§
impl Freeze for RtTriangle
impl RefUnwindSafe for RtTriangle
impl Send for RtTriangle
impl Sync for RtTriangle
impl Unpin for RtTriangle
impl UnwindSafe for RtTriangle
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
Mutably borrows from an owned value. Read more