pub fn project_onto(self, ray: Vec2<T>) -> Vec2<T> {
        // A more readable version of the below would be:
        // ray.normalize() * dot(self, ray.normalize())

        let dot = self.x*ray.x + self.y*ray.y;
        let len = ray.x*ray.x + ray.y*ray.y;
        ray * (dot / len)
    }
/// Projects this vector onto the given other vector. The returned vector will lie on a line
/// going through the origin and `ray`. `ray` does not need to be normalized.
Projects this vector onto the given other vector. The returned vector will lie on a line
going through the origin and `ray`. `ray` does not need to be normalized.
Projects this vector onto the given other vector . The returned vector will lie on a line going through the origin and ` ray ` . ` ray ` does not need to be normalized .
pub fn project_onto(self, ray: Vec2<T>) -> Vec2<T> {
        // A more readable version of the below would be:
        // ray.normalize() * dot(self, ray.normalize())
        let dot = self.x*ray.x + self.y*ray.y;
        let len = ray.x*ray.x + ray.y*ray.y;
        ray * (dot / len)
    }
pub fn project_onto ( self , ray : Vec2 < T > ) -> Vec2 < T > { // A more readable version of the below would be: // ray.normalize() * dot(self, ray.normalize()) let dot = self . x * ray . x + self . y * ray . y ; let len = ray . x * ray . x + ray . y * ray . y ; ray * ( dot / len ) }
Projects this vector onto the given other vector.
Projects this vector onto the given other vector .
self
ray
Vec2<T>
self
ray
Vec2<T>