A basic math library for spatial algebra
Project description
Math3d
A small header-only math library for vectors and matrices.
Build Status
| Build | Status |
|---|---|
| Ubuntu | |
| Windows |
Yet another math library
This library is designed to be a potential replacement to various other great
libraries like Eigen and glm, but with a narrow focus on 2, 3, and 4
dimensional vectors and matrices. These appear commonly when using spatial
algebra in robotics, which is the main application area this library was
initially developed for.
Setup
C++ setup
Clone this package into your third_party dependencies:
# Replace "third_party" with your own dependencies-folder name
git clone https://github.com/wpumacay/math3d.git third_party/math3d
There's a CMake target called math::math. Just add the source directory in
your CMake workflow, and use the given target as follows:
# Add the Math3d subdirectory
add(third_party/math3d)
# Link against the exposed math::math target
target_link_library(MY_LIBRARY PRIVATE math::math)
Python setup
Use the provided setup.py file:
python setup.py install
And import the types from the math3d package:
import math3d as m3d
Usage
C++
#include <vec3_t.h>
#include <mat3_t.h>
int main()
{
// Create a vec3-float32 and show it on the console
::math::Vector3f vec = { 1.0f, 2.0f, 3.0f };
std::cout << "vec: " << vec << std::endl;
// Create a mat3 float32, show its entries and its inverse
auto mat = ::math::Matrix3f( 3.0f, 9.0f, 3.0f,
9.0f, 0.0f, 3.0f,
2.0f, 3.0f, 8.0f );
std::cout << "mat:" << std::endl;
std::cout << mat << std::endl;
std::cout << "mat.inverse():" << std::endl;
std::cout << ::math::inverse( mat ) << std::endl;
return 0;
}
Python
import numpy as np
from math3d import Vector3f, Matrix3f
# Create a vec3-float32 and show it on the console
vec = Vector3f(np.array([1.0, 2.0, 3.0], dtype=np.float32))
print(vec)
# Create a mat3 float32, show its entries and its inverse
mat = Matrix3f(np.array([[ 3.0, 9.0, 3.0 ],
[ 9.0, 0.0, 3.0 ],
[ 2.0, 3.0, 8.0 ]], dtype=np.float32))
print(mat)
print("inverse(): \n\r{}".format(mat.inverse()))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wp_math3d-0.6.16.tar.gz.
File metadata
- Download URL: wp_math3d-0.6.16.tar.gz
- Upload date:
- Size: 94.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0f0fd48144dc0ff61264d5e492cc73e4138c569ec087c1ff80b8a125190a8fd
|
|
| MD5 |
0347dcb9c7d9da190fbd41a5a0c4a5a1
|
|
| BLAKE2b-256 |
4854c9267bd87258fefae6cf28db46ce1dce2a7e1ab0503eb804c9eddbe33f3c
|
File details
Details for the file wp_math3d-0.6.16-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: wp_math3d-0.6.16-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 352.9 kB
- Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
472eb6d6ebe5ff36bd174af87a70d3c9325557c3217de3dae29e9595cf1dcf89
|
|
| MD5 |
b09cef1eb5f7398868dfe38ba9832eec
|
|
| BLAKE2b-256 |
59d08ec3be77e50dfa7b50eadda121ecf0f91d82850b276557850fa16e1f8fd7
|
File details
Details for the file wp_math3d-0.6.16-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: wp_math3d-0.6.16-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 350.2 kB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d331093115c668c83a3eb2f02646bec785f3bc2bd8b32fe35441b69ed4a83c8
|
|
| MD5 |
41539ecf336499705185d5a8407781a0
|
|
| BLAKE2b-256 |
3958a7332e8d370d060b648791d7341e4e915ba19f195c8cd3bee54d83879bba
|
File details
Details for the file wp_math3d-0.6.16-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: wp_math3d-0.6.16-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 350.5 kB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc7bff40973b8d363d5023dd6a143b48c269636c1a0404879c67725f9d7f08a5
|
|
| MD5 |
ec13dab6a0a5bd0896f45f9a239ec8e0
|
|
| BLAKE2b-256 |
33e998e09be3b7160702cf379c25320e1931c38a2c7bc8247bd5c24e4890c877
|
File details
Details for the file wp_math3d-0.6.16-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: wp_math3d-0.6.16-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 350.8 kB
- Tags: CPython 3.9, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f73f5cc7831086cc32b9ab9979a78e1e188cac7e43f65e6fc769eaaa18ea4ec
|
|
| MD5 |
15e4ea1602c48b2b817eb148e71aeeb7
|
|
| BLAKE2b-256 |
f95de46b319718b9eff8a28d0056a31c5b34ceb9d8a8b47ee8eefc6109bda1ca
|
File details
Details for the file wp_math3d-0.6.16-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: wp_math3d-0.6.16-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 349.9 kB
- Tags: CPython 3.8, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
173ef44ef51c6c985c9480b74b776fbfef832cc297a4a6cb1debbbd7d5141f73
|
|
| MD5 |
7292b998eb65ddf5e29a429fdf845698
|
|
| BLAKE2b-256 |
ce464361f8020814cba185c47dafd7146142172c262bf5c6eb99150b432b2623
|