Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benches/vec3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ bench_func!(

#[inline(always)]
fn vec3_any_orthonormal_pair(v: Vec3) -> (Vec3, Vec3) {
v.any_orthonormal_pair()
v.any_orthonormal_pair_rh()
}

bench_func!(
Expand Down
33 changes: 31 additions & 2 deletions src/f32/coresimd/vec3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,15 +1020,28 @@ impl Vec3A {
Self::new(b, sign + self.y * self.y * a, -self.y)
}

/// Given a unit vector return two other vectors that together form an orthonormal
/// Given a unit vector return two other vectors that together form a left-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
pub fn any_orthonormal_pair_lh(&self) -> (Self, Self) {
let (a, b) = self.any_orthonormal_pair_rh();
(-a, b)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair_rh(&self) -> (Self, Self) {
glam_assert!(self.is_normalized());
// From https://graphics.pixar.com/library/OrthonormalB/paper.pdf
let sign = math::signum(self.z);
Expand All @@ -1040,6 +1053,22 @@ impl Vec3A {
)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
#[deprecated(
since = "0.30.4",
note = "Use any_orthonormal_pair_rh() instead to preserve identical functionality, or any_orthonormal_pair_lh if you a left-handed basis."
)]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
self.any_orthonormal_pair_rh()
}

/// Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`.
///
/// When `s` is `0.0`, the result will be equal to `self`. When `s` is `1.0`, the result
Expand Down
33 changes: 31 additions & 2 deletions src/f32/neon/vec3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,15 +1062,28 @@ impl Vec3A {
Self::new(b, sign + self.y * self.y * a, -self.y)
}

/// Given a unit vector return two other vectors that together form an orthonormal
/// Given a unit vector return two other vectors that together form a left-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
pub fn any_orthonormal_pair_lh(&self) -> (Self, Self) {
let (a, b) = self.any_orthonormal_pair_rh();
(-a, b)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair_rh(&self) -> (Self, Self) {
glam_assert!(self.is_normalized());
// From https://graphics.pixar.com/library/OrthonormalB/paper.pdf
let sign = math::signum(self.z);
Expand All @@ -1082,6 +1095,22 @@ impl Vec3A {
)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
#[deprecated(
since = "0.30.4",
note = "Use any_orthonormal_pair_rh() instead to preserve identical functionality, or any_orthonormal_pair_lh if you a left-handed basis."
)]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
self.any_orthonormal_pair_rh()
}

/// Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`.
///
/// When `s` is `0.0`, the result will be equal to `self`. When `s` is `1.0`, the result
Expand Down
33 changes: 31 additions & 2 deletions src/f32/scalar/vec3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1067,15 +1067,28 @@ impl Vec3A {
Self::new(b, sign + self.y * self.y * a, -self.y)
}

/// Given a unit vector return two other vectors that together form an orthonormal
/// Given a unit vector return two other vectors that together form a left-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
pub fn any_orthonormal_pair_lh(&self) -> (Self, Self) {
let (a, b) = self.any_orthonormal_pair_rh();
(-a, b)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair_rh(&self) -> (Self, Self) {
glam_assert!(self.is_normalized());
// From https://graphics.pixar.com/library/OrthonormalB/paper.pdf
let sign = math::signum(self.z);
Expand All @@ -1087,6 +1100,22 @@ impl Vec3A {
)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
#[deprecated(
since = "0.30.4",
note = "Use any_orthonormal_pair_rh() instead to preserve identical functionality, or any_orthonormal_pair_lh if you a left-handed basis."
)]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
self.any_orthonormal_pair_rh()
}

/// Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`.
///
/// When `s` is `0.0`, the result will be equal to `self`. When `s` is `1.0`, the result
Expand Down
33 changes: 31 additions & 2 deletions src/f32/sse2/vec3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,15 +1070,28 @@ impl Vec3A {
Self::new(b, sign + self.y * self.y * a, -self.y)
}

/// Given a unit vector return two other vectors that together form an orthonormal
/// Given a unit vector return two other vectors that together form a left-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
pub fn any_orthonormal_pair_lh(&self) -> (Self, Self) {
let (a, b) = self.any_orthonormal_pair_rh();
(-a, b)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair_rh(&self) -> (Self, Self) {
glam_assert!(self.is_normalized());
// From https://graphics.pixar.com/library/OrthonormalB/paper.pdf
let sign = math::signum(self.z);
Expand All @@ -1090,6 +1103,22 @@ impl Vec3A {
)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
#[deprecated(
since = "0.30.4",
note = "Use any_orthonormal_pair_rh() instead to preserve identical functionality, or any_orthonormal_pair_lh if you a left-handed basis."
)]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
self.any_orthonormal_pair_rh()
}

/// Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`.
///
/// When `s` is `0.0`, the result will be equal to `self`. When `s` is `1.0`, the result
Expand Down
33 changes: 31 additions & 2 deletions src/f32/vec3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,15 +1057,28 @@ impl Vec3 {
Self::new(b, sign + self.y * self.y * a, -self.y)
}

/// Given a unit vector return two other vectors that together form an orthonormal
/// Given a unit vector return two other vectors that together form a left-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
pub fn any_orthonormal_pair_lh(&self) -> (Self, Self) {
let (a, b) = self.any_orthonormal_pair_rh();
(-a, b)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair_rh(&self) -> (Self, Self) {
glam_assert!(self.is_normalized());
// From https://graphics.pixar.com/library/OrthonormalB/paper.pdf
let sign = math::signum(self.z);
Expand All @@ -1077,6 +1090,22 @@ impl Vec3 {
)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
#[deprecated(
since = "0.30.4",
note = "Use any_orthonormal_pair_rh() instead to preserve identical functionality, or any_orthonormal_pair_lh if you a left-handed basis."
)]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
self.any_orthonormal_pair_rh()
}

/// Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`.
///
/// When `s` is `0.0`, the result will be equal to `self`. When `s` is `1.0`, the result
Expand Down
33 changes: 31 additions & 2 deletions src/f32/wasm32/vec3a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1033,15 +1033,28 @@ impl Vec3A {
Self::new(b, sign + self.y * self.y * a, -self.y)
}

/// Given a unit vector return two other vectors that together form an orthonormal
/// Given a unit vector return two other vectors that together form a left-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
pub fn any_orthonormal_pair_lh(&self) -> (Self, Self) {
let (a, b) = self.any_orthonormal_pair_rh();
(-a, b)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair_rh(&self) -> (Self, Self) {
glam_assert!(self.is_normalized());
// From https://graphics.pixar.com/library/OrthonormalB/paper.pdf
let sign = math::signum(self.z);
Expand All @@ -1053,6 +1066,22 @@ impl Vec3A {
)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
#[deprecated(
since = "0.30.4",
note = "Use any_orthonormal_pair_rh() instead to preserve identical functionality, or any_orthonormal_pair_lh if you a left-handed basis."
)]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
self.any_orthonormal_pair_rh()
}

/// Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`.
///
/// When `s` is `0.0`, the result will be equal to `self`. When `s` is `1.0`, the result
Expand Down
33 changes: 31 additions & 2 deletions src/f64/dvec3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,15 +1057,28 @@ impl DVec3 {
Self::new(b, sign + self.y * self.y * a, -self.y)
}

/// Given a unit vector return two other vectors that together form an orthonormal
/// Given a unit vector return two other vectors that together form a left-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
pub fn any_orthonormal_pair_lh(&self) -> (Self, Self) {
let (a, b) = self.any_orthonormal_pair_rh();
(-a, b)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
pub fn any_orthonormal_pair_rh(&self) -> (Self, Self) {
glam_assert!(self.is_normalized());
// From https://graphics.pixar.com/library/OrthonormalB/paper.pdf
let sign = math::signum(self.z);
Expand All @@ -1077,6 +1090,22 @@ impl DVec3 {
)
}

/// Given a unit vector return two other vectors that together form a right-handed orthonormal
/// basis. That is, all three vectors are orthogonal to each other and are normalized.
///
/// # Panics
///
/// Will panic if `self` is not normalized when `glam_assert` is enabled.
#[inline]
#[must_use]
#[deprecated(
since = "0.30.4",
note = "Use any_orthonormal_pair_rh() instead to preserve identical functionality, or any_orthonormal_pair_lh if you a left-handed basis."
)]
pub fn any_orthonormal_pair(&self) -> (Self, Self) {
self.any_orthonormal_pair_rh()
}

/// Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`.
///
/// When `s` is `0.0`, the result will be equal to `self`. When `s` is `1.0`, the result
Expand Down
Loading
Loading