summaryrefslogtreecommitdiffstats
path: root/libdimension-python/dimension.pyx
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-09-03 15:55:19 -0400
committerTavian Barnes <tavianator@tavianator.com>2015-10-25 11:03:56 -0400
commitb554b20c8d59d6046bdcec7c79fb61cd0e65811c (patch)
treea6c6f257cfaffcec953be7c0cce180f7a8855c68 /libdimension-python/dimension.pyx
parentb2cf35c26d5263f3079480208429e3a1d7dd2373 (diff)
downloaddimension-b554b20c8d59d6046bdcec7c79fb61cd0e65811c.tar.xz
math: Make vectors have an array instead of different fields.
Diffstat (limited to 'libdimension-python/dimension.pyx')
-rw-r--r--libdimension-python/dimension.pyx8
1 files changed, 4 insertions, 4 deletions
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index 34d720e..77c9cd8 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -234,15 +234,15 @@ cdef class Vector:
property x:
"""The x coordinate."""
def __get__(self):
- return self._v.x
+ return self._v.n[0]
property y:
"""The y coordinate."""
def __get__(self):
- return self._v.y
+ return self._v.n[1]
property z:
"""The z coordinate."""
def __get__(self):
- return self._v.z
+ return self._v.n[2]
def __pos__(self):
return self
@@ -261,7 +261,7 @@ cdef class Vector:
else:
return _Vector(dmnsn_vector_mul(lhs, (<Vector?>rhs)._v))
def __truediv__(Vector lhs not None, double rhs):
- return _Vector(dmnsn_vector_div(lhs._v, rhs))
+ return _Vector(dmnsn_vector_mul(1.0/rhs, lhs._v))
def __richcmp__(lhs, rhs, int op):
equal = (Vector(lhs) - Vector(rhs)).norm() < dmnsn_epsilon