Skip to main content

CgaVector5D

Struct CgaVector5D 

Source
#[repr(C, align(32))]
pub struct CgaVector5D { pub x: f32, pub y: f32, pub z: f32, pub no: f32, pub ni: f32, pub _pad0: f32, pub _pad1: f32, pub _pad2: f32, }
Expand description

5D Conformal Null-Basis Vector in Cl(4, 1). Basis: e1, e2, e3 (Euclidean, e_i^2 = +1), no (origin), ni (infinity). Metric properties:

  • no^2 = 0, ni^2 = 0
  • no . ni = -1 Alignment: 32 bytes (8 floats: x, y, z, no, ni, plus 3 padding floats).

Fields§

§x: f32§y: f32§z: f32§no: f32§ni: f32§_pad0: f32§_pad1: f32§_pad2: f32

Implementations§

Source§

impl CgaVector5D

Source

pub const fn zero() -> Self

Zero vector.

Source

pub const fn origin() -> Self

Origin point n_o (0, 0, 0, 1, 0).

Source

pub const fn infinity() -> Self

Infinity point n_\infty (0, 0, 0, 0, 1).

Source

pub fn point(x: f32, y: f32, z: f32) -> Self

Embeds a 3D Euclidean point x = (x, y, z) into CGA: P = x + 0.5 * ||x||^2 * n_\infty + n_o.

Source

pub fn sphere(cx: f32, cy: f32, cz: f32, radius: f32) -> Self

Embeds a 3D sphere with center c = (cx, cy, cz) and radius r: S = c + 0.5 * (||c||^2 - r^2) * n_\infty + n_o.

Source

pub fn plane(nx: f32, ny: f32, nz: f32, d: f32) -> Self

Embeds a 3D plane with unit normal n = (nx, ny, nz) and signed distance d: \pi = n + d * n_\infty (with no = 0).

Source

pub fn inner_product(&self, other: &Self) -> f32

Computes the Lorentzian inner product: U . V = (uxvx + uyvy + uz*vz) - (u_no * v_ni + u_ni * v_no).

Source

pub fn to_euclidean(&self) -> [f32; 3]

Extracts Euclidean coordinates [x/no, y/no, z/no].

Source

pub fn squared_distance(&self, other: &Self) -> f32

Computes squared Euclidean distance between two conformal points: ||p1 - p2||^2 = -2 * (P1 . P2) / (P1_no * P2_no).

Source

pub fn distance(&self, other: &Self) -> f32

Euclidean distance between two conformal points.

Source

pub fn sphere_radius(&self) -> Option<f32>

If this vector represents a sphere, extracts its radius: r = sqrt(S . S).

Source

pub fn invert_in_sphere(&self, sphere: &Self) -> Self

Reflects this conformal point across a sphere via 1-versor sandwich: P’ = S * P * S / ||S||^2. This is the classical spherical inversion!

Source

pub fn translate(&self, dx: f32, dy: f32, dz: f32) -> Self

Applies a conformal translation by vector d = (dx, dy, dz).

Source

pub fn dilate(&self, lambda: f32) -> Self

Applies a conformal dilation / uniform scale with factor lambda > 0.

Trait Implementations§

Source§

impl Add for CgaVector5D

Source§

type Output = CgaVector5D

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl Clone for CgaVector5D

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for CgaVector5D

Source§

impl Debug for CgaVector5D

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CgaVector5D

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Div<f32> for CgaVector5D

Source§

type Output = CgaVector5D

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f32) -> Self

Performs the / operation. Read more
Source§

impl Mul<f32> for CgaVector5D

Source§

type Output = CgaVector5D

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f32) -> Self

Performs the * operation. Read more
Source§

impl Neg for CgaVector5D

Source§

type Output = CgaVector5D

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl PartialEq for CgaVector5D

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CgaVector5D

Source§

impl Sub for CgaVector5D

Source§

type Output = CgaVector5D

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.