Skip to main content

A Python 3-dimensional Euclidean vector space.

Project description

PyEVSpace

PyEVSpace is a Python Euclidean vector space package containing types and methods for representing vector quantites and fasilitating rotating them between reference frames. PyEVSpace is designed for 3-dimensional space only, which allows for optimum speed since size checks do not occur.

Documentation

The full documentation of this project with both Python and C APIs can be found here.

Install

The python module can be installed with

pip install pyevspace

Alternatively the repository can be downloaded or cloned using:

git clone https://github.com/qbizzle68/pyevspace.git

It can be used as is within Visual Studio, or built inplace using the setup.py if needed.

Usage

To use the module simply import the pyevspace module into your project:

import pyevspace as evs
from math import pi

vec = evs.Vector(1, 2, 3)

rotatedVec = evs.rotateAxisTo(evs.X_AXIS, pi/2)

Matrices can be created from iterables, where each iterable represents a row of the matrix

import pyevspace as evs

mat = evs.Matrix((0, 0, 1), (0, -1, 0), (1, 0, 0))

rotatedVec = evs.rotateMatrixFrom(mat, Vector(1, 1, 1))

The Order and Angles types can be used to create an Euler rotation matrix. All twelve Euler rotations are already defined in the module, so you shouldn't need to instantiate an Order object. The Angles object holds the angles for each rotation in the Euler rotation, in the order of the axis rotations (in radians).

import pyevspace as evs

angs = Angles(1.1, 4.5, 3.14)
mat = getMatrixEuler(XYZ, angs)

rotatedVec = mat * Vector(1, 0, 2)

There are many methods that handle the rotations for you, check the official documentation to learn more about them.

Examples

Examples of numeric operators

v1 = Vector(1, 2, 3)
v2 = Vector(4, 5, 6)

print(v1 * 2)
# prints [2, 4, 6]

print(v1 + v2)
# prints [5, 7, 9]

print(v1 - v2)
# prints [-3, -3, -3]

Examples of vector and matrix operators

v1 = Vector(1, 2, 3)
v2 = Vector(4, 5, 6)
m1 = Matrix(Vector(4, 2, 3), Vector(8, 5, 2), Vector(4, 2, 1))

print(dot(v1, v2))
# prints 32.0

print(cross(v1, v2))
# prints [ -3.00000, 6.00000, -3.00000 ]

print(det(m1))
# prints -8.0

print(transpose(m1))
# prints 
# ([4, 2, 3],
# [8, 5, 2],
# [4, 2, 1])

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyevspace-0.0.12.4.tar.gz (40.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyevspace-0.0.12.4-py3.11-win-amd64.egg (92.0 kB view details)

Uploaded Egg

pyevspace-0.0.12.4-cp310-cp310-win_amd64.whl (45.7 kB view details)

Uploaded CPython 3.10Windows x86-64

File details

Details for the file pyevspace-0.0.12.4.tar.gz.

File metadata

  • Download URL: pyevspace-0.0.12.4.tar.gz
  • Upload date:
  • Size: 40.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for pyevspace-0.0.12.4.tar.gz
Algorithm Hash digest
SHA256 ba6bc4b565f983ea156af34e58e66d569bdb81e69d7b93d75083e5d9625e8ab7
MD5 22bd3600bf556966743463833b37883e
BLAKE2b-256 c9a11001d7b0e4b77e52a6b1bdea16e843d9af3567bec5e02b36c8801c01a11f

See more details on using hashes here.

File details

Details for the file pyevspace-0.0.12.4-py3.11-win-amd64.egg.

File metadata

File hashes

Hashes for pyevspace-0.0.12.4-py3.11-win-amd64.egg
Algorithm Hash digest
SHA256 dbd5d2431533e0804aae2d026d490099d6cc1cb2e04f067e0e405252c1c2e064
MD5 b868b49bd944985f51b3995eb6a5d058
BLAKE2b-256 6b022e1aaaea8fabd46330edb7531213d59b83c3ac7e54eab1b4e39c23ac4283

See more details on using hashes here.

File details

Details for the file pyevspace-0.0.12.4-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyevspace-0.0.12.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 968282c926ae38861af39b6b3f15e19e78ef922db83f1e758642721d46724fa6
MD5 f336ded10a27a9aa05a88faba8970dc2
BLAKE2b-256 39255d539d9cc98c41318aad6158ce6ca560db05e3814042d13ceba84b6fd178

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page