Skip to content

Instantly share code, notes, and snippets.

@spatial-bit
Created January 16, 2022 01:06
Show Gist options
  • Save spatial-bit/a618c5471c9ecf3d8f4a9ed4962d1f95 to your computer and use it in GitHub Desktop.
Save spatial-bit/a618c5471c9ecf3d8f4a9ed4962d1f95 to your computer and use it in GitHub Desktop.
USD pose transformations... #USD #OMNIVERSE
# Not sure what I have here
# from pxr import Gf, Usd, UsdGeom
# pose = Gf.Matrix4d(0.10028808960009783, 1.0899614544257474e-13, -0.9949584408830167, 0, -0.2896496895839791, 0.9566873438849783, -0.02919560539207469, 0, 0.9518641480843092, 0.29111737504021507, 0.09594434606284785, 0, 170.13235291094, 118.33856922920114, -26.433392816374774, 1)
# rotateAroundX = Gf.Matrix3d(1, 0, 0, 0, 0, -1, 0, 1, 0)
# rotation = pose.ExtractRotation()
# print(f'rotation={rotation}')
# print(f'type(rotation)={type(rotation)}')
# rotation = Gf.Matrix3d(*pose[0][0:3], *pose[1][0:3], *pose[2][0:3])
# other = rotateAroundX * rotation
# print(f'other={other}')
# pose.SetRow3(0, Gf.Vec3d(other[0][0:3]))
# pose.SetRow3(1, Gf.Vec3d(other[1][0:3]))
# pose.SetRow3(2, Gf.Vec3d(other[2][0:3]))
# print(f'pose={pose}')
# translation = Gf.Vec3d(*pose[3][0:3])
# new_trans = rotateAroundX * translation
# print(f'new_trans={new_trans}')
# pose.SetRow3(3, new_trans)
##print(f'pose.data()={[*pose[0][0:3], *pose[1][0:3]], *pose[2][0:3]}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment