From b75389d622db2afcdb9f4b069e0a07e2a9802a37 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 17 Dec 2024 20:31:55 +0100 Subject: [PATCH] Make `Point` generic over dimensionality --- experiments/2024-12-09/src/geometry/primitives.rs | 4 ++-- experiments/2024-12-09/src/math/point.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/experiments/2024-12-09/src/geometry/primitives.rs b/experiments/2024-12-09/src/geometry/primitives.rs index 554a569f4..c1e9d3ec5 100644 --- a/experiments/2024-12-09/src/geometry/primitives.rs +++ b/experiments/2024-12-09/src/geometry/primitives.rs @@ -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

From

for Vertex where - P: Into, + P: Into>, { fn from(point: P) -> Self { Self { diff --git a/experiments/2024-12-09/src/math/point.rs b/experiments/2024-12-09/src/math/point.rs index a111c507c..3fbc14d11 100644 --- a/experiments/2024-12-09/src/math/point.rs +++ b/experiments/2024-12-09/src/math/point.rs @@ -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 { + pub coords: Vector, } -impl From for Point +impl From for Point<3> where T: Into>, { @@ -18,7 +18,7 @@ where } } -impl ops::Add for Point +impl ops::Add for Point<3> where T: Into>, {