|test| |coverage| |documentation| |pypi| |python_vers| |license| |codacy|
.. |test| image:: https://github.com/NOhs/mgen/actions/workflows/test.yml/badge.svg
:target: https://github.com/NOhs/mgen/actions/workflows/test.yml
.. |coverage| image:: https://codecov.io/github/NOhs/mgen/branch/master/graph/badge.svg?token=FC0NS4nchO
:target: https://codecov.io/github/NOhs/mgen
.. |documentation| image:: https://readthedocs.org/projects/mgen/badge/?version=latest
:target: http://mgen.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. |pypi| image:: https://badge.fury.io/py/mgen.svg
:target: https://badge.fury.io/py/mgen
.. |python_vers| image:: https://img.shields.io/pypi/pyversions/mgen
:alt: PyPI - Python Version
.. |license| image:: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg
:target: https://opensource.org/licenses/BSD-3-Clause
.. |codacy| image:: https://app.codacy.com/project/badge/Grade/ab622cde22a24af4b9bcb62a49002936
:target: https://app.codacy.com/gh/NOhs/mgen/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade
MGen: Convenient matrix generation functions
============================================
Python and its most popular packages do not offer out-of-the-box convenient
functions to generate rotation matrices. While there are other projects
that offer rotation and vector classes, or offer rotations via the use of quaternions,
if you simply want a rotation matrix, for example if other packages require them
as an input, or you do not wish to change your current data structure to use
special rotation classes, the common suggestion is to implement them yourself
(see for example this discussion on SE:
https://stackoverflow.com/questions/6802577/rotation-of-3d-vector). However,
everybody implementing their own version of the same thing can hardly be seen as
ideal.
Therefore, this package provides simple functions to generate rotation matrices
in 2d for a given angle or in 3d for a given axis and angle, or for three given
angles (proper Euler angles or Tait-Bryan angles).
Additionally, n-dimensional rotations can be generated using an angle and two
orthogonal vectors that span the plane of rotation.
Trivial example usage
----------------------
Below you see examples of how to use mgen to generate rotation matrices. For further
documentation please have a look here: https://mgen.readthedocs.io
.. code:: python
import numpy as np
np.set_printoptions(suppress=True)
from mgen import rotation_around_axis
from mgen import rotation_from_angles
from mgen import rotation_around_x
from mgen import rotation_from_angle_and_plane
from mgen import rotation_from_angle
from mgen import random_matrix
# 2D example
matrix = rotation_from_angle(np.pi/2)
matrix.dot([1, 0])
# array([0., 1.])
#3D examples
matrix = rotation_from_angles([np.pi/2, 0, 0], 'XYX')
matrix.dot([0, 1, 0])
# array([0., 0., 1.])
matrix = rotation_around_axis([1, 0, 0], np.pi/2)
matrix.dot([0, 1, 0])
# array([0., 0., 1.])
matrix = rotation_around_x(np.pi/2)
matrix.dot([0, 1, 0])
# array([0., 0., 1.])
# n-dimensional example
matrix = rotation_from_angle_and_plane(np.pi/2, (0, 1, 0, 0), (0, 0, 1, 0))
matrix.dot([0, 1, 0, 0])
# array([0., 0., 1., 0.])
# n-dimensional random matrix O(n), e.g. n=27
matrix = random_matrix(27)
Raw data
{
"_id": null,
"home_page": "https://github.com/NOhs/mgen",
"name": "mgen",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "matrix, rotations, Euler angles",
"author": "NOhs",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/70/fc/bfc86ce96aab74cb61ed26b8242897a2b87c88dddca673e75c229d2511a6/mgen-1.2.1.tar.gz",
"platform": null,
"description": "|test| |coverage| |documentation| |pypi| |python_vers| |license| |codacy|\n\n.. |test| image:: https://github.com/NOhs/mgen/actions/workflows/test.yml/badge.svg\n :target: https://github.com/NOhs/mgen/actions/workflows/test.yml\n\n.. |coverage| image:: https://codecov.io/github/NOhs/mgen/branch/master/graph/badge.svg?token=FC0NS4nchO\n :target: https://codecov.io/github/NOhs/mgen\n\n.. |documentation| image:: https://readthedocs.org/projects/mgen/badge/?version=latest\n :target: http://mgen.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n.. |pypi| image:: https://badge.fury.io/py/mgen.svg\n :target: https://badge.fury.io/py/mgen\n\n.. |python_vers| image:: https://img.shields.io/pypi/pyversions/mgen\n :alt: PyPI - Python Version\n\n.. |license| image:: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg\n :target: https://opensource.org/licenses/BSD-3-Clause\n\n.. |codacy| image:: https://app.codacy.com/project/badge/Grade/ab622cde22a24af4b9bcb62a49002936\n :target: https://app.codacy.com/gh/NOhs/mgen/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade\n\n\nMGen: Convenient matrix generation functions\n============================================\n\nPython and its most popular packages do not offer out-of-the-box convenient\nfunctions to generate rotation matrices. While there are other projects\nthat offer rotation and vector classes, or offer rotations via the use of quaternions,\nif you simply want a rotation matrix, for example if other packages require them\nas an input, or you do not wish to change your current data structure to use\nspecial rotation classes, the common suggestion is to implement them yourself\n(see for example this discussion on SE:\nhttps://stackoverflow.com/questions/6802577/rotation-of-3d-vector). However,\neverybody implementing their own version of the same thing can hardly be seen as\nideal.\n\nTherefore, this package provides simple functions to generate rotation matrices\nin 2d for a given angle or in 3d for a given axis and angle, or for three given\nangles (proper Euler angles or Tait-Bryan angles).\n\nAdditionally, n-dimensional rotations can be generated using an angle and two\northogonal vectors that span the plane of rotation.\n\nTrivial example usage\n----------------------\n\nBelow you see examples of how to use mgen to generate rotation matrices. For further\ndocumentation please have a look here: https://mgen.readthedocs.io\n\n.. code:: python\n\n import numpy as np\n np.set_printoptions(suppress=True)\n\n from mgen import rotation_around_axis\n from mgen import rotation_from_angles\n from mgen import rotation_around_x\n from mgen import rotation_from_angle_and_plane\n from mgen import rotation_from_angle\n from mgen import random_matrix\n\n # 2D example\n matrix = rotation_from_angle(np.pi/2)\n matrix.dot([1, 0])\n # array([0., 1.])\n\n #3D examples\n matrix = rotation_from_angles([np.pi/2, 0, 0], 'XYX')\n matrix.dot([0, 1, 0])\n # array([0., 0., 1.])\n\n matrix = rotation_around_axis([1, 0, 0], np.pi/2)\n matrix.dot([0, 1, 0])\n # array([0., 0., 1.])\n\n matrix = rotation_around_x(np.pi/2)\n matrix.dot([0, 1, 0])\n # array([0., 0., 1.])\n\n # n-dimensional example\n matrix = rotation_from_angle_and_plane(np.pi/2, (0, 1, 0, 0), (0, 0, 1, 0))\n matrix.dot([0, 1, 0, 0])\n # array([0., 0., 1., 0.])\n\n # n-dimensional random matrix O(n), e.g. n=27\n matrix = random_matrix(27)\n\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "Package to generate rotation matrices",
"version": "1.2.1",
"split_keywords": [
"matrix",
" rotations",
" euler angles"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "02986c4071d3589dcdf0d70c884b66b806ce7d24b57fddfe46a488660e8a35c8",
"md5": "3cc836bbf0cb3ba9b6425202a22d7581",
"sha256": "3aff2ae91c2317b94fd9ea3993078f20593414fce80e56d68497b039d9555823"
},
"downloads": -1,
"filename": "mgen-1.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3cc836bbf0cb3ba9b6425202a22d7581",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8086,
"upload_time": "2023-04-21T20:26:13",
"upload_time_iso_8601": "2023-04-21T20:26:13.537850Z",
"url": "https://files.pythonhosted.org/packages/02/98/6c4071d3589dcdf0d70c884b66b806ce7d24b57fddfe46a488660e8a35c8/mgen-1.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "70fcbfc86ce96aab74cb61ed26b8242897a2b87c88dddca673e75c229d2511a6",
"md5": "321e7562d1765203a780f6a959faf54e",
"sha256": "3caa56fc85ee71250cc55f484832af52d48c0cb84c945e1a32859b458a85ab39"
},
"downloads": -1,
"filename": "mgen-1.2.1.tar.gz",
"has_sig": false,
"md5_digest": "321e7562d1765203a780f6a959faf54e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14350,
"upload_time": "2023-04-21T20:26:15",
"upload_time_iso_8601": "2023-04-21T20:26:15.385382Z",
"url": "https://files.pythonhosted.org/packages/70/fc/bfc86ce96aab74cb61ed26b8242897a2b87c88dddca673e75c229d2511a6/mgen-1.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-21 20:26:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "NOhs",
"github_project": "mgen",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "mgen"
}