Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/optimisticpeach/hypersphere
4D rotation and projection primitives.
https://github.com/optimisticpeach/hypersphere
Last synced: 3 months ago
JSON representation
4D rotation and projection primitives.
- Host: GitHub
- URL: https://github.com/optimisticpeach/hypersphere
- Owner: OptimisticPeach
- License: apache-2.0
- Created: 2023-08-26T04:09:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-27T05:51:03.000Z (over 1 year ago)
- Last Synced: 2024-10-06T13:17:51.562Z (3 months ago)
- Language: Rust
- Size: 29.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE-APACHE2
Awesome Lists containing this project
README
# Hypersphere
This crate implements some simple rotation and projection primitives for 4D geometry on top of `glam`.## Projection
Implements 4D to 3D projection on the surface of a sphere by way of stereographic projection.It allows you to project _both_ points and vectors tangent to the sphere at a point through a stereographic projection.
The latter is useful when embedding 3D geometry on the surface of a hypersphere and ensuring that normal vectors remain
normal vectors under projection (recall that stereographic projection is angle-preserving).## 4D Rotations
Implements a double-quaternion representation of 4D rotations.Includes:
- Rotation through basis planes (`XY`, `XZ`, etc.).
- Rotation through arbitrary pairs of planes specified by orthonormal vectors.
- Minimal rotations from one point to another.
- Cayley's decomposition of arbitrary 4D rotation matrices into this crate's representation.
- Slerp, inherited from quaternions.## Basis Utilities
Includes functions to:
- Construct an arbitrary orthogonal vector to another vector.
- Construct an arbitrary orthogonal vector to two vectors.
- Construct a scaled version of the orthogonal vector to three vectors.
- Construct an orthonormal basis given two vectors that span a plane.## Sample Data
Implements a simple algorithm to generate the 600-cell's vertices (not indices), as useful sample data.