fj_math/
coordinates.rs

1use super::Scalar;
2
3/// 1-dimensional curve coordinates
4///
5/// One-dimensional [`Point`]s and [`Vector`]s dereference to this type (via
6/// [`Deref`]). This allows you to access the `t` field, even though [`Point`]
7/// and [`Vector`] do not have such a field themselves.
8///
9/// [`Deref`]: std::ops::Deref
10/// [`Point`]: crate::Point
11/// [`Vector`]: crate::Vector
12#[repr(C)]
13pub struct T {
14    /// The single coordinate of the 1-dimensional curve coordinates
15    pub t: Scalar,
16}
17
18/// 2-dimensional surface coordinates
19///
20/// Two-dimensional [`Point`]s and [`Vector`]s dereference to this type (via
21/// [`Deref`]). This allows you to access the `u`/`v` fields, even though
22/// [`Point`] and [`Vector`] do not have such fields themselves.
23///
24/// [`Deref`]: std::ops::Deref
25/// [`Point`]: crate::Point
26/// [`Vector`]: crate::Vector
27#[repr(C)]
28pub struct Uv {
29    /// The first coordinate of the 2-dimensional surface coordinates
30    pub u: Scalar,
31
32    /// The second coordinate of the 2-dimensional surface coordinates
33    pub v: Scalar,
34}
35
36/// 3-dimensional model coordinates
37///
38/// Three-dimensional [`Point`]s and [`Vector`]s dereference to this type (via
39/// [`Deref`]). This allows you to access the `x`/`y`/`z` fields, even though
40/// [`Point`] and [`Vector`] do not have such fields themselves.
41///
42/// [`Deref`]: std::ops::Deref
43/// [`Point`]: crate::Point
44/// [`Vector`]: crate::Vector
45#[repr(C)]
46pub struct Xyz {
47    /// The first coordinate of the 3-dimensional model coordinates
48    pub x: Scalar,
49
50    /// The second coordinate of the 3-dimensional model coordinates
51    pub y: Scalar,
52
53    /// The third coordinate of the 3-dimensional model coordinates
54    pub z: Scalar,
55}