probe
Ray tracing probing of the surface of a solid.
Signatures
- bool probe( ray ray, solid solid, vector& hitpoint )
- bool probe( ray ray, solid solid, vector& hitpoint, vector& normal )
Details
The function performs a ray tracing probing of the ray on the solid and returns whether the solid got hit. In this case, the closest hit point is returned in parameter hitpoint.
Example
ray r( <[2.0, 0.5, 0.5 ]>, <[-1.0, 0.0, 0.0 ]> )
box b()
vector v
if( probe(r,b,v) )
echo( "hit the box at " + v )
Output
hit the box at <[1,0.5,0.5]>
Parameters
- ray
-
A ray that is used for detecting the hit point on solid solid.
- solid
-
A solid that is probed by ray.
- hitpoint
-
Reference to a vector that returns the 3d point in which ray hits solid. If there is no hit, hitpoint stays unchanged.
- normal
-
Reference to a vector that returns the normal of the solid's surface at the hitpoint. If there is no hit, normal stays unchanged.
Return value
'true' if the ray hits the solid, 'false' otherwise.