Triangle/Ray Intersection

Fast vectorized triangle/ray intersection algorithm
6K download
Aggiornato 18 mag 2018

Visualizza la licenza

Ray/triangle intersection using the algorithm proposed by Möller and
Trumbore (1997), implemented as highly vectorized MATLAB code.
The algorithm can work with one and two sided surfaces, as well as, with
infinite lines, rays (lines bounded on one side) and segments (lines bounded on
both sides).
Input (all arrays in in Nx3, where N is number of vertices or rays):
orig : ray's origin
dir : ray's direction
vert0, vert1, vert2: vertices of the triangle
Intersect - boolean array of length N
t - distance from the ray origin to the intersection point in |dir|
u,v - barycentric coordinates of the intersection point units
xcoor - carthesian coordinates of the intersection point
In addition PointInsideVolume is 3D equivalent to 2D inpolygon function and can test if
array of points is inside or outside any volume defined by the surface grid.

Cita come

Jaroslaw Tuszynski (2024). Triangle/Ray Intersection (, MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2017b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Scopri di più su Surface and Mesh Plots in Help Center e MATLAB Answers

Ispirato da: Ray/Triangle Intersection

Ispirato: in_polyhedron,

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release

small corrections to the interface

Minimal changes suggested by Igor in Comments and Ratings

correct description: no symbolic toolbox is needed
Major rewrite of the function with additional options and output variables. Also provided PointInsideVolume function

documentation improvements and typo correction

correct treatment of 3x3 arrays as suggested by Andreas Weber

Improvements to border handling