mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-05 10:28:27 +00:00
Make Point
generic over dimensionality
This commit is contained in:
parent
ca72d1e897
commit
b75389d622
@ -9,12 +9,12 @@ use super::{
|
|||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
||||||
pub struct Vertex {
|
pub struct Vertex {
|
||||||
pub point: Point,
|
pub point: Point<3>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<P> From<P> for Vertex
|
impl<P> From<P> for Vertex
|
||||||
where
|
where
|
||||||
P: Into<Point>,
|
P: Into<Point<3>>,
|
||||||
{
|
{
|
||||||
fn from(point: P) -> Self {
|
fn from(point: P) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -3,11 +3,11 @@ use std::ops;
|
|||||||
use super::Vector;
|
use super::Vector;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
||||||
pub struct Point {
|
pub struct Point<const D: usize> {
|
||||||
pub coords: Vector<3>,
|
pub coords: Vector<D>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> From<T> for Point
|
impl<T> From<T> for Point<3>
|
||||||
where
|
where
|
||||||
T: Into<Vector<3>>,
|
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
|
where
|
||||||
T: Into<Vector<3>>,
|
T: Into<Vector<3>>,
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user