I'm sure you can't do it without an additional data. For example, is it possible to retain transform matrix on points of original geometry? Then yes, just multiply it by inverse. Dealing with object transforms is the most straightforward way, and you need only transform, simple box with some snapping techniques with desired transform is fine.
Extract Transform OBJ.
There is another nice method I didn't found in Houdini, maybe it will fit you. If you have at least two triangles, or any arbitrary 3 points transformed, of before-transform and after-transform states (for example, if you store rest position or if you could recreate it more or less exact), then you may easily calculate transform matrix between them using triangles's "local spaces" created from triangles's sides. Here the code for Primitive Wrangle (I used "0" as group, it runs only for first polygon) with two identical geometries on inputs, where second is arbitrarily transformed.
// Create a basis from points of triangle.
matrix3 basis_from_triangle(vector p1, p2, p3)
{
// Axes vectors. May not be orthogonal.
vector X, Y, Z;
Z = p2 - p1;
X = p3 - p1;
Y = normalize(cross(Z, X)) * length(p2 - p3);
return set(X, Y, Z);
}
// Calculate rotation matrix rotating triangle ABC into triangle DEF.
matrix3 rotation_between_triangles(vector a, b, c, d, e, f)
{
matrix3 basisABC, basisDEF;
basisABC = basis_from_triangle(a, b, c);
basisDEF = basis_from_triangle(d, e, f);
return invert(basisABC) * basisDEF;
}
// Calculate transform matrix transforming triangle ABC into triangle DEF.
matrix transform_between_triangles(vector a, b, c, d, e, f)
{
matrix transform = ident();
matrix3 r = rotation_between_triangles(a, b, c, d, e, f);
transform *= r;
translate(transform, d - a * transform);
return transform;
}
4@transform = transform_between_triangles(point(1, "P", primpoint(1, @primnum, 0)),
point(1, "P", primpoint(1, @primnum, 1)),
point(1, "P", primpoint(1, @primnum, 2)),
point(0, "P", primpoint(0, @primnum, 0)),
point(0, "P", primpoint(0, @primnum, 1)),
point(0, "P", primpoint(0, @primnum, 2)));
Now, transform points using Point Wrangle with second input as geometry, simply getting first primitive's transform attribute.
@P *= matrix(prim(1, "transform", 0));
Or, being contemporary, Deformation Wrangle, because it is exactly why it was created.
pos *= matrix(prim(1, "transform", 0));
It will properly transform attributes you need to have transformed. With Point Wrangle you need to use other wrangles to transform vertex normals or other attributes. Actually, for normals only there is special checkbox on Point Wrangle, and sometimes it works.
betweentria.hipnc