hyperbolic icon indicating copy to clipboard operation
hyperbolic copied to clipboard

Transform.merge produces incorrect output for non-orientation-preserving transformations

Open switzel opened this issue 2 years ago • 2 comments

Something goes wrong when Transform.merge() is applied to transformations that are not all orientation-preserving. Below is a (not quite) minimal example illustrating the problem. The second and third output point should be equal and should be the first one with the second coordinated negated. However, the second one is not.

import math
import hyperbolic.poincare as pc

half_to_disk = pc.Transform.half_to_disk()
infty = pc.Ideal.from_degree(90)
p = half_to_disk.apply_to_tuple((.5,math.sqrt(3)/2))
q = half_to_disk.apply_to_tuple((0,1))
rot_q = pc.Transform.rotation(deg=-90)
rot_p = pc.Transform.merge(pc.Transform.shift_origin(p),pc.Transform.rotation(deg=-60),pc.Transform.shift_origin(p).inverted())
refl = pc.Transform.mirror()
par = pc.Transform.merge(rot_p,rot_p,rot_q,rot_q)
t = pc.Transform.merge(par,par,refl)
print(t.apply_to_point(infty),pc.Transform.merge(refl,t).apply_to_point(infty),refl.apply_to_point(t.apply_to_point(infty)))

switzel avatar Aug 29 '23 20:08 switzel

Thanks for opening the issue. Looking at the last line of your example, if I switch t and refl in merge(t,refl) it's output matches the last output.

Does this match your understanding? The arguments of merge are applied in the other order?

cduck avatar Aug 31 '23 00:08 cduck

I think the problem is this: the matrices act (apply_to_tuple) from the left and if a transformation conjugates, it does so before multiplying the matrix. So when multiplying (merge) conjugation should be applied to the entries of the product to the right, not to the left. I attempted a fix in my fork (branch semidirect_product), but at the moment there's still something wrong. I'll have a closer look when I find time.

Btw. a smaller illustration is to compare merge(rot_q, refl).apply_to_point(infty) to rot_q.apply_to_point(refl.apply_to_point(infty)).

switzel avatar Aug 31 '23 05:08 switzel