To get a list of all intersections along a ray, use intersect_all.
int intersect(<geometry>geometry, vector orig, vector dir, vector &p, float &u, float &v)
int intersect(<geometry>geometry, vector orig, vector dir, vector &p, float &u, float &v, ...)
Computes the first intersection of the specified ray with the geometry.
To get all intersections along a vector, use intersect_all instead.
The variadic argument "farthest"
can be used to indicate whether to return the last intersection instead of the first.
int intersect(<geometry>geometry, vector orig, vector dir, vector &p, vector &uvw)
Computes the first intersection of the specified ray with the geometry. To get all intersections along a vector, use intersect_all instead.
int intersect(<geometry>geometry, string group, vector orig, vector dir, vector &p, vector &uvw)
Computes the intersection of the specified ray with primitives in the given group.
<geometry>
При запуске в контексте ноды (например, Wrangle SOP) этот аргумент может быть целым числом, представляющим номер входа (начиная с 0), с которого функция будет читать атрибуты.
В качестве альтернативы аргумент может быть строкой, указывающей на файл геометрии (например, *.bgeo
) для чтения. При запуске внутри Houdini может быть ссылкой op:/путь/до/sop
.
group
If given, only intersect primitives in this group.
orig
The ray origin point.
dir
The ray direction and maximum distance. This function does not expect a normalized direction vector. Instead, it uses the length of the vector as the maximum distance to search.
&p
If the ray intersects a primitive, this variable is overwritten with the intersection position in world space.
&u
, &v
, &uvw
If the ray intersects a primitive, this/these variable(s) is/are overwritten with the parametric intersection position on the primitive.
Returns
The intersected primitive number, or -1
if there was an error or the ray didn’t intersect anything.
Note
When intersections are performed against metaball geometry, it is impossible to determine the primitive number of the metaball which was hit. In this case, the function returns the number of primitives in the intersection geometry.
See also | |
intersect | |
ray | |
search |