Add Vec2::dot

This commit is contained in:
Emil Ernerfeldt 2022-04-25 11:26:54 +02:00
parent 888cd9c3eb
commit 0862712595

View file

@ -253,6 +253,12 @@ impl Vec2 {
vec2(self.x.max(other.x), self.y.max(other.y))
}
/// The dot-product of two vectors.
#[inline]
pub fn dot(self, other: Self) -> f32 {
self.x * other.x + self.y * other.y
}
/// Returns the minimum of `self.x` and `self.y`.
#[must_use]
#[inline(always)]