How can I find the intersection of a ray with a mesh surface?

Hello,
I have ~800 rays passing through a surface, and I need the 3D coordinates where they each intersect that surface. I am using several points then interpolating those point to create the surface. I feel like there is a very obvious command to solve this problem, but can't figure it out. I can plot the ray and the surface. Everything works, except I can't figure out a way to calculate the intersect point.
load('Rays.mat'); load('Mesh.mat');
for i = 1:25
index = 6*(i-1)
plot3(Rays(:,index+2),Rays(:,index+1),0-Rays(:,index+5),'-b')
hold all;
end
XI=118:0.5:135; % longitude limits of your grid
YI=20:0.5:35; % latitude limits
[qx,qy] = meshgrid(XI,YI);
F = TriScatteredInterp(Slab(:,1),Slab(:,2),0-Slab(:,3));
qz = F(qx,qy);
%%PLOT %%
surf(qx,qy,qz); %or mesh(qx,qy,qz)

1 Comment

Hi Robert, I have the same problem as you.
I have seen that has been a bit 'of time... at the and did you manage to solve it?
I know it's not difficult but I'm quite new to matlab...
Thanks for your help,
Leonardo

Sign in to comment.

Answers (0)

Asked:

on 6 May 2013

Edited:

on 29 Aug 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!