From f1a82fcea16d5836e3381304af0d91e451f0a7a5 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Sun, 20 Feb 2022 12:33:17 +0100 Subject: [PATCH] Add types to represent coordinates These will be used to improve the usability of `Point` and `Vector`. --- src/math/coordinates.rs | 24 ++++++++++++++++++++++++ src/math/mod.rs | 1 + 2 files changed, 25 insertions(+) create mode 100644 src/math/coordinates.rs diff --git a/src/math/coordinates.rs b/src/math/coordinates.rs new file mode 100644 index 000000000..c9201a865 --- /dev/null +++ b/src/math/coordinates.rs @@ -0,0 +1,24 @@ +#![allow(unused)] + +use super::Scalar; + +/// 1-dimensional curve coordinates +#[repr(C)] +pub struct T { + pub t: Scalar, +} + +/// 2-dimensional surface coordinates +#[repr(C)] +pub struct Uv { + pub u: Scalar, + pub v: Scalar, +} + +/// 3-dimensional model coordinates +#[repr(C)] +pub struct Xyz { + pub x: Scalar, + pub y: Scalar, + pub z: Scalar, +} diff --git a/src/math/mod.rs b/src/math/mod.rs index 2cb6afa01..ff312f9cc 100644 --- a/src/math/mod.rs +++ b/src/math/mod.rs @@ -1,4 +1,5 @@ pub mod aabb; +pub mod coordinates; pub mod point; pub mod scalar; pub mod segment;