-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhyperbolic_polygon.m
49 lines (41 loc) · 1.39 KB
/
hyperbolic_polygon.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function [ M,P ] = hyperbolic_polygon( k)
%generating the basic polygon which we use as the orbifold domain
%we first construct the triangle T, which has one vertex o located at (0,0)
%with angle 2pi/2k, a vertex v with angle 2pi/2k and a vertex r with 90
%degrees. taking this triangle and reflecting along the edge (o,e) and
%gluing the two copiesgets us the basic triangle T' we will use to construct
%the prefect polygon. T' has vertices o,v,v' with angles 2pi/k 2pi/2k 2pi/2k
%respectively. After this gluing, the vertex r has an angle of 180.
%the angles of T, according to o,v,r
angs=[2*pi/(k*2) 2*pi/(2*k) pi/2];
%compute the hyp arc lengths of T
h_lens=hyperbolic_lengths_from_angles(angs);
%only need the arcs that touch o
lens=hyperbolic_distance_to_euclidean_distance(h_lens);
%place the two points
v=[0 lens(3)]';
r=[0 lens(2)]';
theta=2*pi/(2*k);
R=[cos(theta) -sin(theta);
sin(theta) cos(theta)];
r=R*r;
%transform the lengths from hyperbolic to actual euclidean lengths
h_lens=h_lens(1);
lens=hyperbolic_distance_to_euclidean_distance(h_lens);
%compute the positioning of the points
P=[];
M={};
for i=1:k
theta=2*pi*i/k;
R=[cos(theta) -sin(theta);
sin(theta) cos(theta)];
cur_v=R*v;
cur_r=R*r;
P=[P cur_v cur_r];
M1=mobius_rotate_around_point(cur_r(1)+1i*cur_r(2),pi);
%rotation of pi around (0,0)
M{end+1}=nan;
M{end+1}=M1;
end
P=P';
end