Reputation: 181
I have an array of 3D coordinates that make up a 3D object (a sphere in this example)
I want to cast a ray from the origin along a vector and calculate any points at which the ray intersects with the 3D object.
In this diagram I want to find point 1 and point 2.
I am using Python, so I would prefer an approach that I can use Python with.
Any suggestions would be appreciated.
Upvotes: 1
Views: 2722
Reputation: 80187
Find what point is the closest to the ray using line-point distance.
Find mesh cells around that point and calculate line-triangle intersection to get intersection point(s).
If you have sphere equation (center and radius) - it is simpler to calculate exact intersections
Upvotes: 2