Skip to content

Commit

Permalink
update(docs): updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wpumacay committed Apr 19, 2023
1 parent 1e00ac7 commit 1998486
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TinyMath
# Math3d

A small header-only math library for vectors and matrices

Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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;
}
Expand All @@ -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))
Expand All @@ -102,9 +104,9 @@ print("inverse(): \n\r{}".format(mat.inverse()))

---

[0]: <https://github.com/wpumacay/loco_math/actions/workflows/ci-linux.yml/badge.svg> (ci-linux-badge)
[1]: <https://github.com/wpumacay/loco_math/actions/workflows/ci-linux.yml> (ci-linux-status)
[2]: <https://github.com/wpumacay/loco_math/actions/workflows/ci-windows.yml/badge.svg> (ci-windows-badge)
[3]: <https://github.com/wpumacay/loco_math/actions/workflows/ci-windows.yml> (ci-windows-status)
[4]: <https://github.com/wpumacay/loco_math/actions/workflows/ci-macos.yml/badge.svg> (ci-macos-badge)
[5]: <https://github.com/wpumacay/loco_math/actions/workflows/ci-macos.yml> (ci-macos-status)
[0]: <https://github.com/wpumacay/math3d/actions/workflows/ci-linux.yml/badge.svg> (ci-linux-badge)
[1]: <https://github.com/wpumacay/math3d/actions/workflows/ci-linux.yml> (ci-linux-status)
[2]: <https://github.com/wpumacay/math3d/actions/workflows/ci-windows.yml/badge.svg> (ci-windows-badge)
[3]: <https://github.com/wpumacay/math3d/actions/workflows/ci-windows.yml> (ci-windows-status)
[4]: <https://github.com/wpumacay/math3d/actions/workflows/ci-macos.yml/badge.svg> (ci-macos-badge)
[5]: <https://github.com/wpumacay/math3d/actions/workflows/ci-macos.yml> (ci-macos-status)

0 comments on commit 1998486

Please sign in to comment.