-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtransform.cpp
More file actions
37 lines (29 loc) · 971 Bytes
/
transform.cpp
File metadata and controls
37 lines (29 loc) · 971 Bytes
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
#include <cmath>
#include <cstdio>
#include "element.h"
using namespace std;
point transform::operator ()(point p){
return point( unit(th) * (p - c) / (1 - p*c.conj()) );
}
line transform::operator ()(line l){
return line(l.getLeft().mobius(c).rotate(th), l.getRight().mobius(c).rotate(th));
}
ideal transform::operator ()(ideal q){
return q.mobius(c).rotate(th);
}
segment transform::operator ()(segment s){
return s.mobius(c).rotate(th);
}
transform transform::operator ()(transform t){
complex e = unit(t.th);
return transform( th + ( (e + t.c.conj()*c) / (1 + t.c*c.conj()*e) ).arg() ,
(e*t.c + c) / (e + t.c.conj()*c) );
}
transform transform::operator *(transform t){
complex e = unit(t.th);
return transform( th + ( (e + t.c.conj()*c) / (1 + t.c*c.conj()*e) ).arg() ,
(e*t.c + c) / (e + t.c.conj()*c) );
}
transform transform::inversion(){
return transform( -th, -c*unit(th) );
}