wp-math3d


Namewp-math3d JSON
Version 0.6.16 PyPI version JSON
download
home_pagehttps://github.com/wpumacay/loco-math
SummaryA basic math library for spatial algebra
upload_time2024-09-30 22:40:40
maintainerNone
docs_urlNone
authorWilbert Santos Pumacay Huallpa
requires_python>=3.7
licenseMIT License
keywords math
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Math3d

A small header-only math library for vectors and matrices.

## Build Status

| Build   | Status
| ------- | ------------------------------
| Ubuntu  | [![ci-linux][0]][1]       |
| Windows | [![ci-windows][2]][3]     |

## 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:

```bash
# 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:

```CMake
# 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:

```bash
python setup.py install
```

And import the types from the `math3d` package:

```python
import math3d as m3d
```

## Usage

### C++

```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

```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()))
```

---

[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)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/wpumacay/loco-math",
    "name": "wp-math3d",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "math",
    "author": "Wilbert Santos Pumacay Huallpa",
    "author_email": "wpumacay@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/48/54/c9267bd87258fefae6cf28db46ce1dce2a7e1ab0503eb804c9eddbe33f3c/wp_math3d-0.6.16.tar.gz",
    "platform": null,
    "description": "# Math3d\n\nA small header-only math library for vectors and matrices.\n\n## Build Status\n\n| Build   | Status\n| ------- | ------------------------------\n| Ubuntu  | [![ci-linux][0]][1]       |\n| Windows | [![ci-windows][2]][3]     |\n\n## Yet another math library\n\nThis library is designed to be a potential replacement to various other great\nlibraries like `Eigen` and `glm`, but with a narrow focus on 2, 3, and 4\ndimensional vectors and matrices. These appear commonly when using spatial\nalgebra in robotics, which is the main application area this library was\ninitially developed for.\n\n## Setup\n\n### C++ setup\n\nClone this package into your `third_party` dependencies:\n\n```bash\n# Replace \"third_party\" with your own dependencies-folder name\ngit clone https://github.com/wpumacay/math3d.git third_party/math3d\n```\n\nThere's a `CMake` target called `math::math`. Just add the source directory in\nyour `CMake` workflow, and use the given target as follows:\n\n```CMake\n# Add the Math3d subdirectory\nadd(third_party/math3d)\n\n# Link against the exposed math::math target\ntarget_link_library(MY_LIBRARY PRIVATE math::math)\n```\n\n### Python setup\n\nUse the provided `setup.py` file:\n\n```bash\npython setup.py install\n```\n\nAnd import the types from the `math3d` package:\n\n```python\nimport math3d as m3d\n```\n\n## Usage\n\n### C++\n\n```c++\n\n#include <vec3_t.h>\n#include <mat3_t.h>\n\nint main()\n{\n    // Create a vec3-float32 and show it on the console\n    ::math::Vector3f vec = { 1.0f, 2.0f, 3.0f };\n    std::cout << \"vec: \" << vec << std::endl;\n\n    // Create a mat3 float32, show its entries and its inverse\n    auto mat = ::math::Matrix3f( 3.0f, 9.0f, 3.0f,\n                                 9.0f, 0.0f, 3.0f,\n                                 2.0f, 3.0f, 8.0f );\n\n    std::cout << \"mat:\" << std::endl;\n    std::cout << mat << std::endl;\n    std::cout << \"mat.inverse():\" << std::endl;\n    std::cout << ::math::inverse( mat ) << std::endl;\n\n    return 0;\n}\n```\n\n### Python\n\n```python\nimport numpy as np\nfrom math3d import Vector3f, Matrix3f\n\n# Create a vec3-float32 and show it on the console\nvec = Vector3f(np.array([1.0, 2.0, 3.0], dtype=np.float32))\nprint(vec)\n\n# Create a mat3 float32, show its entries and its inverse\nmat = Matrix3f(np.array([[ 3.0, 9.0, 3.0 ],\n                         [ 9.0, 0.0, 3.0 ],\n                         [ 2.0, 3.0, 8.0 ]], dtype=np.float32))\n\nprint(mat)\nprint(\"inverse(): \\n\\r{}\".format(mat.inverse()))\n```\n\n---\n\n[0]: <https://github.com/wpumacay/math3d/actions/workflows/ci-linux.yml/badge.svg> (ci-linux-badge)\n[1]: <https://github.com/wpumacay/math3d/actions/workflows/ci-linux.yml> (ci-linux-status)\n[2]: <https://github.com/wpumacay/math3d/actions/workflows/ci-windows.yml/badge.svg> (ci-windows-badge)\n[3]: <https://github.com/wpumacay/math3d/actions/workflows/ci-windows.yml> (ci-windows-status)\n[4]: <https://github.com/wpumacay/math3d/actions/workflows/ci-macos.yml/badge.svg> (ci-macos-badge)\n[5]: <https://github.com/wpumacay/math3d/actions/workflows/ci-macos.yml> (ci-macos-status)\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "A basic math library for spatial algebra",
    "version": "0.6.16",
    "project_urls": {
        "Homepage": "https://github.com/wpumacay/loco-math"
    },
    "split_keywords": [
        "math"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "33e998e09be3b7160702cf379c25320e1931c38a2c7bc8247bd5c24e4890c877",
                "md5": "ec13dab6a0a5bd0896f45f9a239ec8e0",
                "sha256": "cc7bff40973b8d363d5023dd6a143b48c269636c1a0404879c67725f9d7f08a5"
            },
            "downloads": -1,
            "filename": "wp_math3d-0.6.16-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "ec13dab6a0a5bd0896f45f9a239ec8e0",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 350526,
            "upload_time": "2024-09-30T22:42:07",
            "upload_time_iso_8601": "2024-09-30T22:42:07.769041Z",
            "url": "https://files.pythonhosted.org/packages/33/e9/98e09be3b7160702cf379c25320e1931c38a2c7bc8247bd5c24e4890c877/wp_math3d-0.6.16-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3958a7332e8d370d060b648791d7341e4e915ba19f195c8cd3bee54d83879bba",
                "md5": "41539ecf336499705185d5a8407781a0",
                "sha256": "2d331093115c668c83a3eb2f02646bec785f3bc2bd8b32fe35441b69ed4a83c8"
            },
            "downloads": -1,
            "filename": "wp_math3d-0.6.16-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "41539ecf336499705185d5a8407781a0",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.7",
            "size": 350181,
            "upload_time": "2024-09-30T22:42:28",
            "upload_time_iso_8601": "2024-09-30T22:42:28.629946Z",
            "url": "https://files.pythonhosted.org/packages/39/58/a7332e8d370d060b648791d7341e4e915ba19f195c8cd3bee54d83879bba/wp_math3d-0.6.16-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "59d08ec3be77e50dfa7b50eadda121ecf0f91d82850b276557850fa16e1f8fd7",
                "md5": "b09cef1eb5f7398868dfe38ba9832eec",
                "sha256": "472eb6d6ebe5ff36bd174af87a70d3c9325557c3217de3dae29e9595cf1dcf89"
            },
            "downloads": -1,
            "filename": "wp_math3d-0.6.16-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "b09cef1eb5f7398868dfe38ba9832eec",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 352914,
            "upload_time": "2024-09-30T22:42:32",
            "upload_time_iso_8601": "2024-09-30T22:42:32.260429Z",
            "url": "https://files.pythonhosted.org/packages/59/d0/8ec3be77e50dfa7b50eadda121ecf0f91d82850b276557850fa16e1f8fd7/wp_math3d-0.6.16-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ce464361f8020814cba185c47dafd7146142172c262bf5c6eb99150b432b2623",
                "md5": "7292b998eb65ddf5e29a429fdf845698",
                "sha256": "173ef44ef51c6c985c9480b74b776fbfef832cc297a4a6cb1debbbd7d5141f73"
            },
            "downloads": -1,
            "filename": "wp_math3d-0.6.16-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "7292b998eb65ddf5e29a429fdf845698",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.7",
            "size": 349905,
            "upload_time": "2024-09-30T22:41:57",
            "upload_time_iso_8601": "2024-09-30T22:41:57.377320Z",
            "url": "https://files.pythonhosted.org/packages/ce/46/4361f8020814cba185c47dafd7146142172c262bf5c6eb99150b432b2623/wp_math3d-0.6.16-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f95de46b319718b9eff8a28d0056a31c5b34ceb9d8a8b47ee8eefc6109bda1ca",
                "md5": "15e4ea1602c48b2b817eb148e71aeeb7",
                "sha256": "6f73f5cc7831086cc32b9ab9979a78e1e188cac7e43f65e6fc769eaaa18ea4ec"
            },
            "downloads": -1,
            "filename": "wp_math3d-0.6.16-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "15e4ea1602c48b2b817eb148e71aeeb7",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.7",
            "size": 350752,
            "upload_time": "2024-09-30T22:42:05",
            "upload_time_iso_8601": "2024-09-30T22:42:05.529077Z",
            "url": "https://files.pythonhosted.org/packages/f9/5d/e46b319718b9eff8a28d0056a31c5b34ceb9d8a8b47ee8eefc6109bda1ca/wp_math3d-0.6.16-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4854c9267bd87258fefae6cf28db46ce1dce2a7e1ab0503eb804c9eddbe33f3c",
                "md5": "0347dcb9c7d9da190fbd41a5a0c4a5a1",
                "sha256": "d0f0fd48144dc0ff61264d5e492cc73e4138c569ec087c1ff80b8a125190a8fd"
            },
            "downloads": -1,
            "filename": "wp_math3d-0.6.16.tar.gz",
            "has_sig": false,
            "md5_digest": "0347dcb9c7d9da190fbd41a5a0c4a5a1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 94226,
            "upload_time": "2024-09-30T22:40:40",
            "upload_time_iso_8601": "2024-09-30T22:40:40.994346Z",
            "url": "https://files.pythonhosted.org/packages/48/54/c9267bd87258fefae6cf28db46ce1dce2a7e1ab0503eb804c9eddbe33f3c/wp_math3d-0.6.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-30 22:40:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wpumacay",
    "github_project": "loco-math",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "wp-math3d"
}
        
Elapsed time: 0.54005s