[apply_transforms] fix handling of rotations while mirrored
This commit is contained in:
parent
7eec2b7acf
commit
5989e45906
1 changed files with 7 additions and 3 deletions
|
|
@ -114,9 +114,13 @@ def apply_transforms(
|
|||
|
||||
tot = numpy.empty((outer.shape[0], inner.shape[0], 4))
|
||||
tot[:, :, :2] = outer[:, None, :2] + xy
|
||||
tot[:, :, 2:] = outer[:, None, 2:] + inner[None, :, 2:] # sum rotations and mirrored
|
||||
tot[:, :, 2] %= 2 * pi # clamp rot
|
||||
tot[:, :, 3] %= 2 # clamp mirrored
|
||||
|
||||
# If mirrored, flip inner rotation
|
||||
mirrored_outer = outer[:, None, 3].astype(bool)
|
||||
rotations = outer[:, None, 2] + numpy.where(mirrored_outer, -inner[None, :, 2], inner[None, :, 2])
|
||||
|
||||
tot[:, :, 2] = rotations % (2 * pi)
|
||||
tot[:, :, 3] = (outer[:, None, 3] + inner[None, :, 3]) % 2 # net mirrored
|
||||
|
||||
if tensor:
|
||||
return tot
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue