Get Normal vector / the face of a mesh containing a point #45
-
Hi there, that's me again, hoping I don't get too much of your time ! This time I have a simple question and I don't see the answer anywhere in the documentation. I need to get the normal vector of a mesh surface in a given point, for example the point I clicked. I found, in the documentation, the function But I lack one last brick to make it happen : to get the face I'm clicking on when I click on a mesh. So I would have something like this : Do you have a tip on this one ? Thanks again for your precious time ! 😄 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @Yarkane ! The problem of getting the index of a face intersecting a ray (from the view point to the clicked direction for instance) is a common problem, typically in rendering programs featuring ray tracing, or in collision detection. But those are not the main purpose of madcad (there is nothing wrong in using madcad together with such functions, but that's not a target for madcad). In the madcad rendering pipeline, the problem is addressed only for the purpose of mouse-selection in the GUI, and implemented in a way that only works for GUI interactions: every frame rendered in the window also renders an identification frame where each pixel value is the ident of the object in the scene that is below this pixel. (it basically is rasterization, made on the GPU)
I hope this help ! |
Beta Was this translation helpful? Give feedback.
Hello @Yarkane !
Unfortunately, there is no such thing out of the box in madcad.
The problem of getting the index of a face intersecting a ray (from the view point to the clicked direction for instance) is a common problem, typically in rendering programs featuring ray tracing, or in collision detection. But those are not the main purpose of madcad (there is nothing wrong in using madcad together with such functions, but that's not a target for madcad).
In the madcad rendering pipeline, the problem is addressed only for the purpose of mouse-selection in the GUI, and implemented in a way that only works for GUI interactions: every frame rendered in the window also renders an identification …