Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Horocycle.from_center_point() #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions hyperbolic/poincare/horocycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down