wahn / rs_pbrt

Rust crate to implement a counterpart to the PBRT book's (3rd edition) C++ code. See also https://www.rs-pbrt.org/about ...

Home Page:https://www.rs-pbrt.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Replace nrm_normalize() and vec3_normalize() calls

wahn opened this issue · comments

We could probably search & replace those functions:

https://www.rs-pbrt.org/doc/crates/pbrt/core/geometry/fn.vec3_normalize.html
https://www.rs-pbrt.org/doc/crates/pbrt/core/geometry/fn.nrm_normalize.html

By versions for Vector3:

impl Vector3<Float> {                                                                                                                       
    /// Compute a new vector pointing in the same direction but with unit                                                                   
    /// length.                                                                                                                             
    pub fn normalize(&self) -> Vector3<Float> {                                                                                             
        *self / self.length()                                                                                                               
    }                                                                                                                                       
}                                                                                                                                           

Same for Normal3 ...

Done via commit f271737 and baada18 ...