pub struct Projection {
pub p: Vec4,
pub local_x: Vec4,
pub local_y: Vec4,
pub local_z: Vec4,
pub matrix_inverse: Mat4,
}Expand description
A 4D -> 3D stereographic projection from S3 -> R3.
Fields§
§p: Vec4Center of projection
local_x: Vec4Three elements of the orthonormal basis for the tangent plane of a point – plane is centered at 0 rather than p.
local_y: Vec4§local_z: Vec4§matrix_inverse: Mat4Inverse matrix, used when projecting to strip a dimension out.
Implementations§
Source§impl Projection
impl Projection
Sourcepub const UNIT_PROJECTION: Projection
pub const UNIT_PROJECTION: Projection
The unit projection uses Vec4::W as the center of projection.
Sourcepub fn new(p: Vec4) -> Self
pub fn new(p: Vec4) -> Self
Creates a new projection with p as the center.
Picks an arbitrary orthonormal basis for local_x, local_y, and local_z.
Sourcepub fn from_orthonormal_basis(p: Vec4, q: Vec4, r: Vec4, s: Vec4) -> Self
pub fn from_orthonormal_basis(p: Vec4, q: Vec4, r: Vec4, s: Vec4) -> Self
Constructs a projection from an existing orthonormal basis.
Sourcepub fn project(self, point: Vec4) -> Vec3
pub fn project(self, point: Vec4) -> Vec3
Projects a point according to the stereographic projection described
by self.
Sourcepub fn project_normal(self, at: Vec4, normal: Vec4) -> Vec3
pub fn project_normal(self, at: Vec4, normal: Vec4) -> Vec3
Projects a tangent vector to a point in an angle-preserving way.
If:
normalis tangent to the hypersphere atat, ienormal.dot(at) == 0atis part of some shapeKwhich lives on the surface of the hypersphereK'is the projection ofKat'is the projection ofatx(t) = (at + t * normal).normalize()is a spherical line segment fort > 0x(t)intersectsKat an anglealphan'isself.project_normal(at, normal)
Then:
y(t) = at' + t * n'intersectsK'at an anglealpha.
This is meaningful because it means that normal vectors remain normal vectors.
Trait Implementations§
Source§impl Clone for Projection
impl Clone for Projection
Source§fn clone(&self) -> Projection
fn clone(&self) -> Projection
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Projection
impl Debug for Projection
impl Copy for Projection
Auto Trait Implementations§
impl Freeze for Projection
impl RefUnwindSafe for Projection
impl Send for Projection
impl Sync for Projection
impl Unpin for Projection
impl UnwindSafe for Projection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more