diff --git a/fj-math/src/aabb.rs b/fj-math/src/aabb.rs index 3040553ba..e3ea8a41a 100644 --- a/fj-math/src/aabb.rs +++ b/fj-math/src/aabb.rs @@ -4,6 +4,7 @@ use super::{Point, Vector}; /// An axis-aligned bounding box (AABB) #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] +#[repr(C)] pub struct Aabb { /// The minimum coordinates of the AABB pub min: Point, diff --git a/fj-math/src/point.rs b/fj-math/src/point.rs index 5d7ac9891..2f11080b9 100644 --- a/fj-math/src/point.rs +++ b/fj-math/src/point.rs @@ -10,6 +10,7 @@ use super::{ /// The dimensionality of the point is defined by the const generic `D` /// parameter. #[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd)] +#[repr(C)] pub struct Point { /// The coordinates of the point pub coords: Vector, diff --git a/fj-math/src/scalar.rs b/fj-math/src/scalar.rs index d673739e8..072d5d985 100644 --- a/fj-math/src/scalar.rs +++ b/fj-math/src/scalar.rs @@ -9,6 +9,7 @@ use decorum::R64; /// [`Ord`], and [`Hash`], enabling `Scalar` (and types built on top of it), to /// be used as keys in hash maps, hash sets, and similar types. #[derive(Clone, Copy)] +#[repr(C)] pub struct Scalar(f64); impl Scalar { diff --git a/fj-math/src/segment.rs b/fj-math/src/segment.rs index eb2d9e3ab..583e19fc8 100644 --- a/fj-math/src/segment.rs +++ b/fj-math/src/segment.rs @@ -7,6 +7,7 @@ use super::Point; /// The dimensionality of the segment is defined by the const generic `D` /// parameter. #[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd)] +#[repr(C)] pub struct Segment { points: [Point; 2], } diff --git a/fj-math/src/transform.rs b/fj-math/src/transform.rs index 2a2110f3f..d7497fd16 100644 --- a/fj-math/src/transform.rs +++ b/fj-math/src/transform.rs @@ -1,6 +1,7 @@ use super::{Aabb, Point, Segment, Triangle, Vector}; /// A transform +#[repr(C)] pub struct Transform(parry3d_f64::math::Isometry); impl Transform { diff --git a/fj-math/src/triangle.rs b/fj-math/src/triangle.rs index 8024c6b9d..c27bb13e4 100644 --- a/fj-math/src/triangle.rs +++ b/fj-math/src/triangle.rs @@ -5,6 +5,7 @@ use super::{Point, Scalar}; /// The dimensionality of the triangle is defined by the const generic `D` /// parameter. #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] +#[repr(C)] pub struct Triangle { points: [Point; 3], color: [u8; 4], diff --git a/fj-math/src/vector.rs b/fj-math/src/vector.rs index 88adcddc2..4075bc162 100644 --- a/fj-math/src/vector.rs +++ b/fj-math/src/vector.rs @@ -10,6 +10,7 @@ use super::{ /// The dimensionality of the vector is defined by the const generic `D` /// parameter. #[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd)] +#[repr(C)] pub struct Vector { /// The vector components pub components: [Scalar; D],