euclid3

raw JSON →
0.01 verified Fri May 01 auth: no python

A Python 3 update of the original euclid library providing 2D and 3D vector, matrix, quaternion, and geometry primitives. Current version is 0.01, with infrequent releases and minimal maintenance.

pip install euclid3
error ModuleNotFoundError: No module named 'euclid'
cause Attempted to import the old euclid package (Python 2) instead of euclid3.
fix
Install and import euclid3: pip install euclid3, then 'from euclid3 import Vector3'.
error AttributeError: module 'euclid3' has no attribute 'Vector3'
cause Misspelled the class (e.g., vector3 instead of Vector3) or imported the wrong module.
fix
Ensure correct casing: from euclid3 import Vector3
error TypeError: unsupported operand type(s) for *: 'Vector3' and 'Vector3' (when trying cross product with *)
cause euclid3 uses * for dot product, not cross product. For cross product, use .cross() method.
fix
Use v1.cross(v2) instead of v1 * v2 for cross product.
gotcha Vector multiplication uses * for dot product, not @ operator. For cross product, use the .cross() method.
fix Use v1.cross(v2) for cross product, and v1 * v2 for dot product.
deprecated The library has not been updated in years (last release 0.01 from ~2016). It may have unpatched bugs and no official support for newer Python versions beyond 3.4.
fix Consider using alternatives like numpy, pyrr, or pyquaternion for more active development.
gotcha Matrix4 multiplication is left-multiplication (matrix * vector). The order matters and may not match other libraries.
fix Always use matrix * vector for transformation, not vector * matrix.

Basic usage showing vector cross product, matrix rotation, and quaternion rotation.

from euclid3 import Vector3, Matrix4, Quaternion

v1 = Vector3(1, 2, 3)
v2 = Vector3(4, 5, 6)
print(v1.cross(v2))

m = Matrix4.new_rotate_axis(1.570796, 'z')
rotated = m * v1
print(rotated)

q = Quaternion.new_rotate_axis(1.570796, Vector3(0, 0, 1))
print(q)