Skip to content

Instantly share code, notes, and snippets.

@Tehsurfer
Created October 31, 2018 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tehsurfer/a6ecd5493579046d353f9430f6e2c252 to your computer and use it in GitHub Desktop.
Save Tehsurfer/a6ecd5493579046d353f9430f6e2c252 to your computer and use it in GitHub Desktop.
def _calculatePointOnPlane(self, x, y):
from opencmiss.utils.maths.algorithms import calculateLinePlaneIntersection
far_plane_point = self.unproject(x, -y, -1.0)
near_plane_point = self.unproject(x, -y, 1.0)
plane_point, plane_offset, plane_normal = self._model.getPlaneDescription()
point_on_plane = calculateLinePlaneIntersection(near_plane_point, far_plane_point, plane_point, plane_normal)
if len(self.grid) < 4:
self.grid.append(point_on_plane)
else:
self.grid = []
self.grid.append(point_on_plane)
return point_on_plane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment