Makogan / g3

Neat 3D math and graphics library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

g3

This is a neat library for 3D computer graphics based on geometric algebra for the Rust programing language. Specifically it implements the plane-based projective geometric-algebra aka. the Clifford Algebra with signature P(R*3,0,1). At first this may sound like a strange and esoteric idea to use in contrast to the linear algebra you might already be familiar with. However, one will find it to be a more intuitive and powerful formalism to describe operations for three-dimensional euclidean/flat space.

Let's break down what we mean by plane-based, projective and geometric-algebra in reverse order.

Geometric algebra

Of the history of mathematics it is often said that it where the Arabs or Indians that discovered the number zero. It might be hard for today's people with all their modern technology to fully appreciate the difficulties of solving quadratic equations using roman numerals. Harder still to fathom that like the mathematicians of old, without the number zero, one is missing some numbers that can make life easier, and one is to take this quite literally.

Most know about Complex numbers as the non-real solution of equation x = √-1. Less known is the non-real solution for x = √1 called the Hyperbolic numbers and the non-real solution for x = √0 called the Dual numbers.

Together the complex numbers p, the hyperbolic numbers q and the dual numbers r describe a space Rp,q,r.

(Hyper)planes

Projections

The first thing to realise is that to represent all possible transformations of 3D space one needs an extra 4th dimension.

Elements

This library exports the following basic elements:

  • Plane: the basis vector from which all other elements are build
  • Line: the intersection of two planes
    There are two special cases for lines:
    • Branch, a line through the origin
    • Horizon, a line infinitely far away
  • Point: the intersection of three planes
  • Rotor: a rotation
  • Translator: a translation
  • Motor: a combination of a Rotor and a Translator

Geometric Operations

Meet Operation ^

Join Operator &

Inner Product |

Geometric Product *

a*b = a|b + a^b

Sandwich Product a(b)

a(b) = a*b*a⁻¹

Dual Operator !

Get Started

TODO

Awesome Links

https://enki.ws/ganja.js/examples/coffeeshop.html#ydDtaGu0a

About

Neat 3D math and graphics library

License:ISC License


Languages

Language:Rust 100.0%