mirror of
https://github.com/hannobraun/Fornjot
synced 2025-07-21 09:26:10 +00:00
Make Vector
generic over dimensionality
This commit is contained in:
parent
a2393d7325
commit
24ab6c42a2
@ -4,12 +4,12 @@ use super::Vector;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
||||
pub struct Point {
|
||||
pub coords: Vector,
|
||||
pub coords: Vector<3>,
|
||||
}
|
||||
|
||||
impl<T> From<T> for Point
|
||||
where
|
||||
T: Into<Vector>,
|
||||
T: Into<Vector<3>>,
|
||||
{
|
||||
fn from(coords: T) -> Self {
|
||||
Self {
|
||||
@ -20,7 +20,7 @@ where
|
||||
|
||||
impl<T> ops::Add<T> for Point
|
||||
where
|
||||
T: Into<Vector>,
|
||||
T: Into<Vector<3>>,
|
||||
{
|
||||
type Output = Self;
|
||||
|
||||
|
@ -5,11 +5,11 @@ use iter_fixed::IntoIteratorFixed;
|
||||
use super::Scalar;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
||||
pub struct Vector {
|
||||
pub components: [Scalar; 3],
|
||||
pub struct Vector<const D: usize> {
|
||||
pub components: [Scalar; D],
|
||||
}
|
||||
|
||||
impl<S> From<[S; 3]> for Vector
|
||||
impl<S> From<[S; 3]> for Vector<3>
|
||||
where
|
||||
S: Into<Scalar>,
|
||||
{
|
||||
@ -20,9 +20,9 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> ops::Add<T> for Vector
|
||||
impl<T> ops::Add<T> for Vector<3>
|
||||
where
|
||||
T: Into<Vector>,
|
||||
T: Into<Vector<3>>,
|
||||
{
|
||||
type Output = Self;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user