#[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: f32Implementations§
Source§impl CgaVector5D
impl CgaVector5D
Sourcepub fn point(x: f32, y: f32, z: f32) -> Self
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.
Sourcepub fn sphere(cx: f32, cy: f32, cz: f32, radius: f32) -> Self
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.
Sourcepub fn plane(nx: f32, ny: f32, nz: f32, d: f32) -> Self
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).
Sourcepub fn inner_product(&self, other: &Self) -> f32
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).
Sourcepub fn to_euclidean(&self) -> [f32; 3]
pub fn to_euclidean(&self) -> [f32; 3]
Extracts Euclidean coordinates [x/no, y/no, z/no].
Sourcepub fn squared_distance(&self, other: &Self) -> f32
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).
Sourcepub fn sphere_radius(&self) -> Option<f32>
pub fn sphere_radius(&self) -> Option<f32>
If this vector represents a sphere, extracts its radius: r = sqrt(S . S).
Sourcepub fn invert_in_sphere(&self, sphere: &Self) -> Self
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!