vectormath
Project description
# vectormath
[![Latest PyPI version](https://img.shields.io/pypi/v/vectormath.svg)](https://pypi.python.org/pypi/vectormath)
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/3ptscience/vectormath/blob/master/LICENSE)
[![Build Status](https://travis-ci.org/3ptscience/vectormath.svg?branch=master)](https://travis-ci.org/3ptscience/vectormath)
Vector math utilities for Python.
```python
import numpy as np
import vectormath as vmath
# Simple vectors
v = vmath.Vector3(5, 0, 0)
v.normalize()
print(v) # > [[1, 0, 0]]
print(v.x, type(v.x)) # > 1.0, float
# Array based vectors are much faster than a for loop
v_array = vmath.Vector3([[4,0,0],[0,2,0]])
print(v_array.x) # > [4, 0]
# we can
print(v_array.length) # [4, 2]
print(v_array.normalize()) # [[1,0,0],[0,1,0]]
# These vectors are just numpy arrays
assert isinstance(v, np.ndarray)
```
Major classes include `Vector3`, `Matrix3`, `Plane`, `Parallelogram`.
[![Latest PyPI version](https://img.shields.io/pypi/v/vectormath.svg)](https://pypi.python.org/pypi/vectormath)
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/3ptscience/vectormath/blob/master/LICENSE)
[![Build Status](https://travis-ci.org/3ptscience/vectormath.svg?branch=master)](https://travis-ci.org/3ptscience/vectormath)
Vector math utilities for Python.
```python
import numpy as np
import vectormath as vmath
# Simple vectors
v = vmath.Vector3(5, 0, 0)
v.normalize()
print(v) # > [[1, 0, 0]]
print(v.x, type(v.x)) # > 1.0, float
# Array based vectors are much faster than a for loop
v_array = vmath.Vector3([[4,0,0],[0,2,0]])
print(v_array.x) # > [4, 0]
# we can
print(v_array.length) # [4, 2]
print(v_array.normalize()) # [[1,0,0],[0,1,0]]
# These vectors are just numpy arrays
assert isinstance(v, np.ndarray)
```
Major classes include `Vector3`, `Matrix3`, `Plane`, `Parallelogram`.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
vectormath-0.0.1.tar.gz
(6.6 kB
view details)
File details
Details for the file vectormath-0.0.1.tar.gz
.
File metadata
- Download URL: vectormath-0.0.1.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7618ec9c5b9da8a206c690eeb5d2cdbca89cf7053289e38e7a0c21e63f887f1 |
|
MD5 | d189716a6adc73e0b482ec500c72d78d |
|
BLAKE2b-256 | 8fc0b48a119dcd8196aa77471bcdcea4f2e6741740461c9decc1d24df2337a9f |