How can I intersect a line and a 3D object (cube, sphere, prism)?

7 visualizzazioni (ultimi 30 giorni)
Hello everyone, I am doing a program for the faculty, and in one part of the program I need to know the penetration distance between a line (incident beam) and a geometric shape loaded by the user, which in general can be a cube, sphere or Prism, nothing too complicated. Do you have any idea how I could deal with the problem? The user would initially enter the geometric parameters of the figure, such as radius, height and others. Based on this, he would have to generate the figure and intersect it. I was reading a bit the programs for computational geometry but I get a little dizzy, I am a little new in matlab. If you know any way to solve it or any good reading for the subject I would really appreciate it! Thank you.

Risposte (1)

darova
darova il 19 Set 2019
It is a pyramid. If you want to know if line intersects pyramid you should inspect each plane of it
11Untitled.png
Once you have all intersection points - inspect if there are points belonging to walls of pyramid
There are conditions that have to be met (use dot product to calculate angle):
21Untitled.png

Community Treasure Hunt

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

Start Hunting!

Translated by