summaryrefslogtreecommitdiffstats
path: root/libdimension-python
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-06-04 14:56:30 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-06-04 14:58:32 -0400
commit13779f79f41e8bce483e98faa6353c07c12563c8 (patch)
tree32e9daa27f7eb687eb60692529179fb75124f976 /libdimension-python
parent36e399810a25d5d3a41570ee0f52f8e6d1402fbc (diff)
downloaddimension-13779f79f41e8bce483e98faa6353c07c12563c8.tar.xz
triangles: Better API.
Diffstat (limited to 'libdimension-python')
-rw-r--r--libdimension-python/dimension.pxd7
-rw-r--r--libdimension-python/dimension.pyx17
2 files changed, 14 insertions, 10 deletions
diff --git a/libdimension-python/dimension.pxd b/libdimension-python/dimension.pxd
index f5a723c..6579c89 100644
--- a/libdimension-python/dimension.pxd
+++ b/libdimension-python/dimension.pxd
@@ -318,11 +318,8 @@ cdef extern from "../libdimension/dimension.h":
dmnsn_object *dmnsn_new_object(dmnsn_pool *pool)
- dmnsn_object *dmnsn_new_flat_triangle(dmnsn_pool *pool, dmnsn_vector a, dmnsn_vector b, dmnsn_vector c)
- dmnsn_object *dmnsn_new_triangle(
- dmnsn_pool *pool,
- dmnsn_vector a, dmnsn_vector b, dmnsn_vector c,
- dmnsn_vector na, dmnsn_vector nb, dmnsn_vector nc)
+ dmnsn_object *dmnsn_new_triangle(dmnsn_pool *pool, dmnsn_vector vertices[3])
+ dmnsn_object *dmnsn_new_smooth_triangle(dmnsn_pool *pool, dmnsn_vector vertices[3], dmnsn_vector normals[3])
dmnsn_object *dmnsn_new_plane(dmnsn_pool *pool, dmnsn_vector normal)
dmnsn_object *dmnsn_new_sphere(dmnsn_pool *pool)
dmnsn_object *dmnsn_new_cube(dmnsn_pool *pool)
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index d8bbb3a..d3f880c 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -1129,11 +1129,18 @@ cdef class Triangle(Object):
a_normal = cross(b - a, c - a)
b_normal = a_normal
c_normal = a_normal
- self._object = dmnsn_new_triangle(
- _get_pool(),
- Vector(a)._v, Vector(b)._v, Vector(c)._v,
- Vector(a_normal)._v, Vector(b_normal)._v, Vector(c_normal)._v
- )
+
+ cdef dmnsn_vector vertices[3]
+ vertices[0] = Vector(a)._v
+ vertices[1] = Vector(b)._v
+ vertices[2] = Vector(c)._v
+
+ cdef dmnsn_vector normals[3]
+ normals[0] = Vector(a_normal)._v
+ normals[1] = Vector(b_normal)._v
+ normals[2] = Vector(c_normal)._v
+
+ self._object = dmnsn_new_smooth_triangle(_get_pool(), vertices, normals)
Object.__init__(self, *args, **kwargs)
cdef class Plane(Object):