From 1998486c494c30c228292afaa8b225c6950151f8 Mon Sep 17 00:00:00 2001 From: gregor Date: Wed, 19 Apr 2023 15:10:30 -0500 Subject: [PATCH] update(docs): updated README.md --- README.md | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index ac0659a..9b2fdfb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# TinyMath +# Math3d A small header-only math library for vectors and matrices @@ -14,7 +14,9 @@ A small header-only math library for vectors and matrices 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. +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 @@ -24,18 +26,18 @@ Clone this package into your `third_party` dependencies: ```bash # Replace "third_party" with your own dependencies-folder name -git clone https://github.com/wpumacay/tiny_math.git third_party/tiny_math +git clone https://github.com/wpumacay/math3d.git third_party/math3d ``` -There's a `CMake` target called `loco::math`. Just add the source directory in +There's a `CMake` target called `math::math`. Just add the source directory in your `CMake` workflow, and use the given target as follows: ```CMake -# Add TinyMath as a third-party dependency -add(PATH_TO_TINY_MATH) -# ... -# Link against the exposed loco::math target -target_link_library(MY_LIBRARY PRIVATE loco::math) +# 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 @@ -46,10 +48,10 @@ Use the provided `setup.py` file: python setup.py install ``` -And import the types from the `lmath` package: +And import the types from the `math3d` package: ```python -from lmath import Vector3f +import math3d as m3d ``` ## Usage @@ -64,18 +66,18 @@ from lmath import Vector3f int main() { // Create a vec3-float32 and show it on the console - math::Vector3f vec = { 1.0f, 2.0f, 3.0f }; + ::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 ); + 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; + std::cout << ::math::inverse( mat ) << std::endl; return 0; } @@ -85,7 +87,7 @@ int main() ```python import numpy as np -from lmath import Vector3f, Matrix3f +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)) @@ -102,9 +104,9 @@ print("inverse(): \n\r{}".format(mat.inverse())) --- -[0]: (ci-linux-badge) -[1]: (ci-linux-status) -[2]: (ci-windows-badge) -[3]: (ci-windows-status) -[4]: (ci-macos-badge) -[5]: (ci-macos-status) +[0]: (ci-linux-badge) +[1]: (ci-linux-status) +[2]: (ci-windows-badge) +[3]: (ci-windows-status) +[4]: (ci-macos-badge) +[5]: (ci-macos-status)