Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- typedef complex<double> cd;
- cd p;
- /* x -> real(p) */
- /* y -> imag(p) */
- cd rotire(cd x, double unghi){
- return x * exp(cd(0, unghi)); }
- cd translatie(cd x, cd delta){
- return x + delta; }
- cd reflectie(cd x, cd a, cd b){
- // reflectia lui x fata de dreapta ab
- b -= a;
- x -= a;
- x /= b;
- x = conj(x);
- x *= b;
- b += a;
- x += a;
- return x; }
- cd reflectie__(cd x, cd a, cd b){
- // reflectia lui x fata de dreapta ab
- return conj((x-a) / (b-a)) * (b-a) + a; }
- double orient(cd a, cd b, cd c){
- return imag(conj(a-b) * (c-b)); }
- double len(cd a, cd b){
- return abs(b-a); }
- double unghi(cd a, cd b){
- return arg(b-a); }
- int main(){
- cout << "Hello world!" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement