diff --git a/hyperbolic/poincare/horocycle.py b/hyperbolic/poincare/horocycle.py index 9d2d4ad..a2fb25f 100644 --- a/hyperbolic/poincare/horocycle.py +++ b/hyperbolic/poincare/horocycle.py @@ -4,6 +4,7 @@ from ..euclid import Circle as ECircle from .util import radial_euclid_to_poincare, radial_poincare_to_euclid from . import point +from .transform import Transform class Horocycle: @@ -39,6 +40,13 @@ def from_closest_point(pt, surround_origin=False, cw=True): return Horocycle( shape, closest_point=pt, surround_origin=surround_origin) @classmethod + def from_center_point(cls,center,pt,cw = True): + theta = math.atan2(center.y,center.x) + rot = Transform.rotation(rad=-theta) + rpt = rot.apply_to_point(pt) + d = (rpt.x**2 + rpt.y**2 - rpt.x)/(rpt.x - 1) + return cls.from_closest_point_e_polar(d,theta,cw = cw) + @classmethod def from_closest_point_h_polar(cls, hr, theta, cw=True): p = point.Point.from_h_polar(hr, theta) return cls.from_closest_point(p, surround_origin=hr<0, cw=cw)