Skip to content

Math library I wrote to help me with graphics, as well as learn some key concepts in linear algebra and math

License

Notifications You must be signed in to change notification settings

HighlyExistant/affogato

Repository files navigation

What is Affogato

Well it's 🍦 + ☕, which are all the things im going to need after writing all of this. Other than that though, it's a personal math project I use inspired by a variety of different math libraries. I'm most likely going to change this repositories name to something still pertaining to coffee, but maybe not just affogato.

History of the Project

The library is mainly filled with a bunch of things I needed at the time. As I made more projects, more math code was added. The majority of the things I code are graphics related, and even though there are various amazing libraries for linear algebra in rust crates, I felt the need to learn due to my philosophy of needing to understand how every bit of code works. Even though it's meant to be for math, I started adding features to help me with graphics related projects. After a while I also decided to add features like physics and collisions in their own features, and started adding compatibility with other rust crates, in case I ever need to use them in the future.

Features

  • alloc This feature is automatically activated, but can be deactivated using default-features = false. By deactivating this feature you are removing any code that uses allocators, such as Display trait implementations.
  • serde This is a compatibility feature so that you can use many of the types I've implemented in serde.
  • rand This is a compatibility feature that adds random functions to various types like vectors.
  • physics Adds inverse kinematics, rigidbodies and collisions
  • godot This is a compatibility feature for the godot crate which implements From and Into for various types.
  • glsl Although I don't reccomend using it, it adds padding for types like Vector3 and FMat3 so that they are more reliable to use inside of shaders in glsl.

Linear Algebra

The largest portion of this library is filled with code for vectors and matrices, in fact it's one of the first things I ever needed, and has been left relatively unchanged.

  • Vectors
    • Coordinate representation
    • Polar Coordinates
  • Matrices

Geometry

  • Segments
  • Rays
  • Hyperecubes
    • Rectangles
    • Cubes (Cuboid)
  • Spheres
  • Triangles
  • Segments
  • Planes

Spatial Curves

  • Z-curve (Morton codes)

Smoothing Functions

  • Smooth interpolation
  • Linear interpolation
  • Bilinear interpolation

Algebra

  • Complex numbers
  • Quaternions
  • Formulas
    • Quadratic Formula
    • Cubic Formula

Inverse Kinematics

  • KinematicSegmentList

Things I might add

  • I've been interested in geometric algebra, so I might look into ganja.js and add rotors. This might lead to an enire rework of Complex numbers and Quaternions, as well as the addition of hyperbolic numbers (Split complex numbers) and duel numbers, although I currently have no reason to, as it's not something im working on for a project.
  • Reworking KinematicSegmentList to use polar coordinates internally.

Inspirations

About

Math library I wrote to help me with graphics, as well as learn some key concepts in linear algebra and math

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages