# Visualizing an Affine Matrix

I have a computer graphics program that prints out affine matrices like

Transform Basis: V3 (V3 0.99060506 (-1.4430956e-2) 0.1359906) (V3 1.381684e-2 0.9998897 5.458703e-3) (V3 (-0.13605437) (-3.5284583e-3) 0.9906951)
Transform Position: V3 0.4690141 0.6664715 0.16474605


Is there a way to visualize this matrix in Mathematica (in some sort of 3D plot)? Say of where it sends the origin looking forward?

inputstring =
"Transform Basis: V3 (V3 0.99060506 (-1.4430956e-2) 0.1359906) (V3 1.381684e-2 0.9998897 5.458703e-3) (V3 (-0.13605437) (-3.5284583e-3) 0.9906951)
Transform Position: V3 0.4690141 0.6664715 0.16474605";

lines = StringSplit[
StringDelete[inputstring, {
"(", ")",
RegularExpression["V\\d+"],
RegularExpression["Transform.*?:"]}], "\n"];

getnumbers[line_] := Module[{parts},
parts = Flatten[StringCases[StringSplit[line], RegularExpression["-?[\\d.e]+-?\\d+"]]];
ToExpression[StringReplace[#, "e" -> "*^"]] & /@ Flatten[parts]
]

m = ArrayReshape[getnumbers[lines[]], {3, 3}];
v = getnumbers[lines[]];
Graphics3D[{
Opacity[.25],
Blue, Cuboid[],
Red, GeometricTransformation[Cuboid[], {m, v}]
}] Since it's an affine transform m.p + v, the origin is displaced from {0,0,0} to v.

• Nifty! ${}{}{}{}{}{}{}{}{}$ – mjw Aug 7 '20 at 2:47
• It should be noted that the transformation function itself can be obtained as AffineTransform[{m, v}]. – J. M.'s torpor Aug 7 '20 at 9:02