Make Point generic over dimensionality

This commit is contained in:
Hanno Braun 2024-12-17 20:31:55 +01:00
parent ca72d1e897
commit b75389d622
2 changed files with 6 additions and 6 deletions

View File

@ -9,12 +9,12 @@ use super::{
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct Vertex {
pub point: Point,
pub point: Point<3>,
}
impl<P> From<P> for Vertex
where
P: Into<Point>,
P: Into<Point<3>>,
{
fn from(point: P) -> Self {
Self {

View File

@ -3,11 +3,11 @@ use std::ops;
use super::Vector;
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct Point {
pub coords: Vector<3>,
pub struct Point<const D: usize> {
pub coords: Vector<D>,
}
impl<T> From<T> for Point
impl<T> From<T> for Point<3>
where
T: Into<Vector<3>>,
{
@ -18,7 +18,7 @@ where
}
}
impl<T> ops::Add<T> for Point
impl<T> ops::Add<T> for Point<3>
where
T: Into<Vector<3>>,
{