Commit e8bdef32 authored by Guillaume Seguin's avatar Guillaume Seguin

ray_near and ray_far were inverted several times. fix

parent b8abd1f3
...@@ -284,9 +284,9 @@ class wxGLPanel(wx.Panel): ...@@ -284,9 +284,9 @@ class wxGLPanel(wx.Panel):
glGetIntegerv(GL_VIEWPORT, viewport) glGetIntegerv(GL_VIEWPORT, viewport)
glGetDoublev(GL_PROJECTION_MATRIX, pmat) glGetDoublev(GL_PROJECTION_MATRIX, pmat)
mvmat = self.get_modelview_mat(local_transform) mvmat = self.get_modelview_mat(local_transform)
gluUnProject(x, y, 0, mvmat, pmat, viewport, px, py, pz) gluUnProject(x, y, 1, mvmat, pmat, viewport, px, py, pz)
ray_far = (px.value, py.value, pz.value) ray_far = (px.value, py.value, pz.value)
gluUnProject(x, y, 1., mvmat, pmat, viewport, px, py, pz) gluUnProject(x, y, 0., mvmat, pmat, viewport, px, py, pz)
ray_near = (px.value, py.value, pz.value) ray_near = (px.value, py.value, pz.value)
return ray_near, ray_far return ray_near, ray_far
......
...@@ -146,7 +146,7 @@ class stl(object): ...@@ -146,7 +146,7 @@ class stl(object):
f.close() f.close()
return return
def intersect(self, ray_far, ray_near): def intersect(self, ray_near, ray_far):
""" """
Möller–Trumbore intersection algorithm in pure python Möller–Trumbore intersection algorithm in pure python
Based on http://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm Based on http://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment