pub struct Ray {
pub origin: [f32; 3],
pub dir: [f32; 3],
}Expand description
A 3D ray with origin and (ideally normalized) direction.
Fields§
§origin: [f32; 3]Ray origin in world space.
dir: [f32; 3]Ray direction (should be normalized).
Implementations§
Source§impl Ray
impl Ray
Sourcepub fn new(origin: [f32; 3], dir: [f32; 3]) -> NerfResult<Self>
pub fn new(origin: [f32; 3], dir: [f32; 3]) -> NerfResult<Self>
Create a ray with the given origin and direction (not normalized).
§Errors
Returns ZeroRayDirection if |dir| < 1e-8.
Sourcepub fn normalized(origin: [f32; 3], dir: [f32; 3]) -> NerfResult<Self>
pub fn normalized(origin: [f32; 3], dir: [f32; 3]) -> NerfResult<Self>
Create a ray with automatically normalized direction.
§Errors
Returns ZeroRayDirection if |dir| < 1e-8.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ray
impl RefUnwindSafe for Ray
impl Send for Ray
impl Sync for Ray
impl Unpin for Ray
impl UnsafeUnpin for Ray
impl UnwindSafe for Ray
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