Neat 3D math and graphics library

Related tags

Math g3
Overview

g3

Rust crate for plane-based projective geometric-algebra for 3D aka the Clifford Algebra with signature P(R*3,0,1).

API

  • Invariants:
    • Point
    • Line, Branch and IdealLine
    • Plane
  • Variants:
    • Direction
    • Translator
    • Rotor
    • Motor

Meet Operation ^

Join Operator &

Inner Product |

Geometric Product *

a*b = a|b + a^b

Sandwich Product a(b)

Dual Operator !

Get Started

This software uses some of Rust experimental feautures like std_simd and fn_traits so make sure to compile using the nightly release.

rustup update -- nightly
cargo +nightly build

Run example

cargo +nightly run --example elements --features="mirror"

Awesome Links

Status

This software is very much still a work in progress.

You might also like...
A CLI tool to aid Dungeons and Dragons players with math(tm).

calcdnd A CLI tool to aid Dungeons and Dragons players with math(tm). Character Joe imported sucessfully. +--------------------------+----------------

Powerful math lib for Vector, Matrix and Quaternion operations

An opinionated, powerful math lib for Vector2, Vector3, Matrix and Quaternion operations Vector2 Add, Sub, Div, Mul, Eq Distance Move towards target a

Powerful math lib for Vector, Matrix and Quaternion operations
Powerful math lib for Vector, Matrix and Quaternion operations

An opinionated, powerful math lib for Vector2, Vector3, Matrix and Quaternion operations Vector2 Add, Sub, Div, Mul, Eq Distance Move towards target a

zine/book about bitmap drawing algorithms and math with code examples in Rust
zine/book about bitmap drawing algorithms and math with code examples in Rust

A Bitmapper's Companion - zine/book about bitmap drawing algorithms and math with code examples in Rust A small zine/book written in LaTeX. In progres

A Rust port of the
A Rust port of the "Heroes of Math & Mech" game. Currently macOS, Windows, Linux and iOS app. WIP.

[WIP] Герои Мата и Меха Попытка переписать известный в узких кругах текстовый квест «Герои Мата и Меха» на Rust. Ещё не закончено! Оригинальная версия

A small, basical and unoptimized version of RWKV in Rust written by someone with no math or ML knowledge.

Smol Rust RWKV What is it? A simple example of the RWKV approach to language models written in Rust by someone that knows basically nothing about math

DSP algorithms for embedded. Often integer math.

This crate contains some tuned DSP algorithms for general and especially embedded use.

A simple and fast linear algebra library for games and graphics

glam A simple and fast 3D math library for games and graphics. Development status glam is in beta stage. Base functionality has been implemented and t

Ember is a minimalistic Rust library for creating 2D graphics, games, and interactive visualizations with ease and simplicity.
Ember is a minimalistic Rust library for creating 2D graphics, games, and interactive visualizations with ease and simplicity.

Ember Ember is a simple and fun 2D rendering library for Rust, allowing you to quickly create graphics and interactive applications with ease. It uses

An opinionated, practical color management library for games and graphics.

colstodian An opinionated color management library built on top of kolor. Introduction colstodian is a practical color management library for games an

A linear algebra and mathematics library for computer graphics.

cgmath-rs A linear algebra and mathematics library for computer graphics. The library provides: vectors: Vector2, Vector3, Vector4 square matrices: Ma

A 2D vector graphics library optimized for GUIs, written in Rust and wgpu
A 2D vector graphics library optimized for GUIs, written in Rust and wgpu

RootVG A 2D vector graphics library optimized for GUIs, written in Rust and wgpu How it Works Unlike other 2D vector graphics libraries which have a s

A TinyVG vector graphics format parsing library.

tinyvg-rs A TinyVG vector graphics format parsing library. Testing This library uses the example files from the TinyVG/examples repo for integration t

Generic framebuffer implementation in Rust for use with embedded-graphics library

Fraramebuffer implementation for Rust's Embedded-graphics Framebuffer approach helps to deal with display flickering when you update multiple parts of

A no_std GIF library for embedded applications(embedded-graphics)

tinygif A tiny gif decoder written in no_std Rust. This crate requires about 20kB of memory to decode a gif. basic decoding frame iterator interlace s

Super-lightweight Immediate-mode Embedded GUI framework, based on the awesome embedded-graphics library. Written in Rust.

Kolibri - A GUI framework made to be as lightweight as its namesake What is Kolibri? Kolibri is an embedded Immediate Mode GUI mini-framework very str

Example of a Baremetal program written for the Rasperry Pi 1 (BCM2845). Both the UART and the Framebuffer graphics working

This repository is aimed to provide a starting point to whoever is trying to build a BCM2835 program from scratch. This repository contains linker scr

Rust WebGL2 wrapper with a focus on making high-performance WebAssembly graphics code easier to write and maintain
Rust WebGL2 wrapper with a focus on making high-performance WebAssembly graphics code easier to write and maintain

Limelight Limelight is a WebGL2 wrapper with a focus on making high-performance WebAssembly graphics code easier to write and maintain. demo.mov live

Revolutionize handheld gaming with adaptive game settings. Optimize graphics and gameplay experience based on real-time system metrics. Open-source project empowering developers to enhance games on portable devices
Revolutionize handheld gaming with adaptive game settings. Optimize graphics and gameplay experience based on real-time system metrics. Open-source project empowering developers to enhance games on portable devices

Welcome to the server-side application for the HarmonyLink project. This innovative software is developed with the Rust programming language and is ai

Comments
  • Nightly fix

    Nightly fix

    Found out that core_simd does work on latest nightly. Problem was that the Cargo.lock file pins it to an older commit, which I guess cargo clean didn't fix (or I forgot to run)

    opened by jamen 1
  • Suggestion, change order representation to match common GPU expectations

    Suggestion, change order representation to match common GPU expectations

    This is a simple suggestion that may clash with other requirements. It's merely in case this is a possible change.

    The definition of point in the library is as follows:

    pub struct Point (pub(crate) f32x4);
    
    impl Point {
      #[inline] pub fn w(&self)->f32 { self.0[0] }
      #[inline] pub fn e123(&self)->f32 { self.w() }
      #[inline] pub fn x(&self)->f32 { self.0[1] }
      #[inline] pub fn e032(&self)->f32 { self.x() }
      #[inline] pub fn y(&self)->f32 { self.0[2] }
      #[inline] pub fn e013(&self)->f32 { self.y() }
      #[inline] pub fn z(&self)->f32 { self.0[3] }
      #[inline] pub fn e021(&self)->f32 { self.z() }
    

    This makes perfect sense since multivectors are commonly written with the scalar term on the left most position.

    However most hardware designed for geometry, primarily GPUs actually fllow the convention xyzw.

    So if one serializes the points as is and send them to a shader, the results will be incorrect. w becomes x, x becomes y and so on, thus you have to write this:

    #version 450
    #extension GL_EXT_scalar_block_layout : enable
    
    layout(location = 0) in vec4 inPosition;
    
    layout(binding = 0) uniform MVPOnlyUbo
    {
      mat4 model;
      mat4 view;
      mat4 proj;
    };
    
    void main() {
      gl_Position = proj * view * model * vec4(inPosition.yzw, 1.0);
    }
    

    Note the strange recasting inPosition.yzw, this is necessary since the layout the GPU expects and the layout in the library are different. In order to support fast and efficient byte compatibility I would like to suggest moving the w term at the end of the array.

    Alternatively the compact point suggested in https://github.com/wrnrlr/g3/issues/4 could also solve this if I get around to implementing it.

    opened by Makogan 1
  • Add support for 3 component points

    Add support for 3 component points

    This project is really cool, I have been trying to get PGA working in a project of mine but there is a lot of minutia with numerical stability and I think this project's implementation is more robust than what I can make.

    It would be awesome if it could support points that are 3xf32 under the hood in addition to the 4xf32 point struct it has.

    For graphics and real time applications, not storing the last component and renormalizing between operations represents a memory foot print reduction on about 25%.

    Many operations in games are raw data operations, e.g. copying buffers from CPU to GPU or searching for an item in a list. That additional f32 is a non negligible penalty that the user should have the option not to incur.

    The only reason I was forced to make an inferior PGA library is that all available rust libs have no support for 3 component points.

    Would it be possible to add an additional ComapctPoint that uses 3 floats and not 4?

    opened by Makogan 4
Owner
Werner Laurensse
null
A STARK prover and verifier for arbitrary computations.

A STARK is a novel proof-of-computation scheme to create efficiently verifiable proofs of the correct execution of a computation. The scheme was developed by Eli Ben-Sasson, Michael Riabzev et al. at Technion - Israel Institute of Technology. STARKs do not require an initial trusted setup, and rely on very few cryptographic assumptions. See references for more info.

Novi 512 Jan 3, 2023
A rust crate for mathematics and science

Scilib A Rust crate for scientific processes Overview This crate is designed to help any mathematical or scientific processes for the Rust community.

H.G. Vivien 15 Oct 20, 2022
Comparing performance of Rust math libraries for common 3D game and graphics tasks

mathbench mathbench is a suite of unit tests and benchmarks comparing the output and performance of a number of different Rust linear algebra librarie

Cameron Hart 137 Dec 8, 2022
A tiny, neat C library that portably invokes native file open and save dialogs.

Native File Dialog A tiny, neat C library that portably invokes native file open, folder select and save dialogs. Write dialog code once and have it p

Michael Labbe 1.5k Dec 28, 2022
Standard Graphics is a command-line tool for printing 2D graphics from any language to any screen.

2D graphics in any programming language with just print statements!

Caleb Winston 123 Nov 20, 2022
A graphics engine that I made in rust for my high school graphics course.

A graphics engine that I made in rust for my high school graphics course.

Mohammad Khan 1 May 29, 2022
Neat gru rust

neat-gru-rust Documentation Crates.io doc Examples XOR Snake Right now this is the only working example.

null 12 Dec 22, 2022
TimeKnight is a neat little TUI-based timer app I use in conjunction with a task tracker

TimeKnight is a neat little TUI-based timer app I use in conjunction with a task tracker. It's kind of a secret sauce for productivity (particularly if you have ADHD or have a ridiculously overactive brain).

Monomadic 1 Feb 8, 2022
zero-dependency 3d math library in rust

dualquat A lightweight, zero-dependency 3d math library for use in Dual Quaternion based physics simulation. Capable of representing and transforming

null 4 Nov 11, 2022
Flexible secp256k1 curve math library.

secp A flexible and secure secp256k1 elliptic curve math library, with constant-time support, and superb ergonomics. secp takes full advantage of Rust

null 7 Nov 1, 2023