All Projects → YclepticStudios → gmath

YclepticStudios / gmath

Licence: MIT license
Lightweight C++ geometry math library (Vectors, Quaternions and Matrices)

Programming Languages

C++
36643 projects - #6 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to gmath

graphmath
An Elixir library for performing 2D and 3D mathematics.
Stars: ✭ 72 (+118.18%)
Mutual labels:  vector, matrices
glm
OpenGL Mathematics (GLM)
Stars: ✭ 6,667 (+20103.03%)
Mutual labels:  vector, quaternion
abacus
📐 C# cross precision 3D maths library.
Stars: ✭ 35 (+6.06%)
Mutual labels:  quaternion, matrices
Sharpmath
A small .NET math library.
Stars: ✭ 36 (+9.09%)
Mutual labels:  vector, matrices
sparse
Sparse matrix formats for linear algebra supporting scientific and machine learning applications
Stars: ✭ 136 (+312.12%)
Mutual labels:  vector, matrices
ad-lens
Automatic Differentiation using Pseudo Lenses. Neat.
Stars: ✭ 16 (-51.52%)
Mutual labels:  vector, matrices
SCNMathExtensions
Math extensions for SCNVector3, SCNQuaternion, SCNMatrix4
Stars: ✭ 32 (-3.03%)
Mutual labels:  vector, quaternion
crystaledge
A pure Crystal Vector Math library
Stars: ✭ 25 (-24.24%)
Mutual labels:  vector, quaternion
Fmatvec
A fast vector/matrix library
Stars: ✭ 5 (-84.85%)
Mutual labels:  vector, matrices
PyGLM
Fast OpenGL Mathematics (GLM) for Python
Stars: ✭ 167 (+406.06%)
Mutual labels:  vector, quaternion
numeric
numeric facilities for C++ 14; dual numbers, dual quaternions, constrained numbers, intervals
Stars: ✭ 21 (-36.36%)
Mutual labels:  quaternion
vector-math
Shader-math in haxe: library for GLSL vector operations, complete with swizzles and all
Stars: ✭ 30 (-9.09%)
Mutual labels:  vector
executor-hnsw-postgres
A production-ready, scalable Indexer for the Jina neural search framework, based on HNSW and PSQL
Stars: ✭ 25 (-24.24%)
Mutual labels:  vector
cpp-code-snippets
Some useful C++ code snippets
Stars: ✭ 35 (+6.06%)
Mutual labels:  vector
vector
A high-performance observability data pipeline.
Stars: ✭ 12,138 (+36681.82%)
Mutual labels:  vector
TransformUtils.jl
Lie groups and algebra with some quaternions
Stars: ✭ 18 (-45.45%)
Mutual labels:  quaternion
BottomNavigation-RichPath-Sample
BottomNavigation RichPath Sample
Stars: ✭ 76 (+130.3%)
Mutual labels:  vector
Mathematics for Machine Learning
Learn mathematics behind machine learning and explore different mathematics in machine learning.
Stars: ✭ 28 (-15.15%)
Mutual labels:  vector
LinAlg
实现一个线性代数库,为Python写扩展。《程序猿的数学3 线性代数》读后笔记
Stars: ✭ 17 (-48.48%)
Mutual labels:  vector
helm-charts
Helm charts for Vector.
Stars: ✭ 50 (+51.52%)
Mutual labels:  vector

GMath

This is a lightweight C++ math library aimed at geometry math problems (Vectors, Quaternions and Matrices). It contains implementations of nearly every geometry math function found in the Unity game engine as well as many others. Additionally, it is a header only library and is written so that any of the files (Vector3, Quaternion, etc.) can be used individually without the need for the rest of the library.

Code Examples

This example takes a vector and rotates it by a quaternion. The quaternion is created by spherical-linear interpolation between two other quaternions. Note that these are just examples, and there are simpler ways to achieve the same result.

#include "Vector3.hpp"
#include "Quaternion.hpp"

Vector3 vec = Vector3(1, 2, 3);
Quaternion quat1 = Quaternion::Identity();
Quaternion quat2 = Quaternion::FromAngleAxis(3.141592, Vector3::Up());
Quaternion quat = Quaternion::Slerp(quat1, quat2, 0.3);
Vector3 newVec = quat * vec;

This example takes the Euler angle representation of a rotation, converts it to a quaternion, then converts it to a rotation matrix, and finally rotates a vector using that matrix.

#include "Vector3.hpp"
#include "Quaternion.hpp"
#include "Matrix3x3.hpp"

Vector3 eulerRot = Vector3(12, -3.4, 7);
Quaternion quatRot = Quaternion::FromEuler(eulerRot);
Matrix3x3 matRot = Matrix3x3::FromQuaternion(quatRot);
Vector3 newVec = matRot * Vector3::Forward();

Getting Started

Using GMath is super simple! Since it is a header only library, there is no extra setup, and the "hpp" files are all that's needed.

  1. Clone the repo or download a zip of it.
  2. Copy the "hpp" files you want to use from src/ into your project.

Tests

GMath includes a full set of test cases for every function. You must have Make and a command line C++ compiler to build and run the tests. Once these are installed, simply use the following commands to build, run, and clean the unit tests.

# Build the unit tests
make
# Run the unit tests
bin/GMathTest.app
# Clean the project
make clean

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].