procedural_modelling 0.4.2

A framework-agnostic Procedural Modelling crate.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::VecN;
use crate::math::{Scalar, Vector, Vector2D};

/// A 2D vector.
pub type Vec2<S> = VecN<S, 2>;

impl<S: Scalar> Vector2D for Vec2<S> {
    type S = S;

    #[inline(always)]
    fn new(x: S, y: S) -> Self {
        Self::from([x, y])
    }

    fn perp_dot(&self, other: &Self) -> S {
        (self.x() * other.y()) - (self.y() * other.x())
    }
}