Imagine a pointcloud encoded in TOPs , so then usual rbg = xyz in 32 bit float. I can translate and scale the whole pointcloud using math TOPs (and channel masks), but is there also a way to rotate the pointcloud (completely in TOPs)?
Thx in advance

vec3 Transform(vec3 p, vec3 t, vec3 r, vec3 s)
{
float px = p.x;
float py = p.y;
float pz = p.z;
float tx = t.x;
float ty = t.y;
float tz = t.z;
float rx = r.x;
float ry = r.y;
float rz = r.z;
float sx = s.x;
float sy = s.y;
float sz = s.z;
float crx = cos(rx*PI/180);
float cry = cos(ry*PI/180);
float crz = cos(rz*PI/180);
float srx = sin(rx*PI/180);
float sry = sin(ry*PI/180);
float srz = sin(rz*PI/180);
px *= sx;
py *= sy;
pz *= sz;
vec3 result = vec3(0.);
result.x = (cry * crz) * px + (srx * sry * crz  srz * crx) * py + (crx * sry * crz + srx * srz) * pz + tx;
result.y = (cry * srz) * px + (srz * srx * sry + crx * crz) * py + (crx * sry * srz  srx * crz) * pz + ty;
result.z = sry * px + (srx * cry) * py + (crx * cry) * pz + tz;
return result;
}
Return to General TouchDesigner Discussion
Users browsing this forum: No registered users and 11 guests