vector ptransform(vector vec, matrix transform)
vector4 ptransform(vector4 vec, matrix transform)
Transforms the vector using the given transform matrix.
vector ptransform(string tospace, vector vec)
vector4 ptransform(string tospace, vector4 vec)
Transforms from "space:current"
.
vector ptransform(string fromspace, string tospace, vector vec)
vector4 ptransform(string fromspace, string tospace, vector4 vec)
Transforms the vector from fromspace
into tospace
.
fromspace
, tospace
The possible values for the space arguments are:
An object path |
Use the object space of an object specified by a path string. Tip In some cases, such as point instancing, mantra may
automatically mangle object paths. You can generate an |
|
Object space of the current object. |
|
Object space of the current light when executing a shadow or light shader. |
|
Houdini world space. |
|
mantra camera space. |
|
Normal Device Coordinate space. |
|
Normal Device Coordinate space for the current light when executing a shadow or light shader. |
|
The current space the vector is in. |
-
ptransform interprets the vector as a position.
-
vtransform interprets the vector as a direction vector, and so doesn’t apply the translations from the matrix.
-
ntransform interprets the vector as a normal vector, and so multiplies by the inverse transpose of the matrix (ignoring the translations).
Examples ¶
The version with only a ‹tospace› argument assumes ‹fromspace› is
"space:current"
. For example:
Pworld = ptransform("space:world", P);
…is equivalent to:
Pworld = ptransform("space:current", "space:world", P);
Transform a vector from its current space to object space:
ospace = ptransform("space:object", P)
Transform a vector from object space to mantra’s natural coordinate space (“camera” space):
ospace = ptransform("space:object", "space:current", P)
See also | |
point |
|
transform |