Advertisement
CelticsOrlean

Geometry

Dec 14th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.86 KB | None | 0 0
  1. // #define _GLIBCXX_DEBUG
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.    
  5. typedef long long ll;
  6. typedef long double ld;
  7.    
  8. #define P pair
  9. typedef P < int, int > Pii;
  10. typedef P < ll, ll > Pll;
  11. typedef P < string, string > Pss;
  12.    
  13.    
  14.    
  15. #define all(a) (a).begin(), (a).end()
  16. #define rall(a) (a).rbegin(), (a).rend()
  17.    
  18.    
  19. #define forn(i, n) for(int (i) = 0; (i) < (n); (i)++)
  20. #define fore(i, a) for(auto (i) : (a))
  21.  
  22. #define add_fill(a, c) setw(a) << setfill(c)
  23. // #define endl '\n'
  24.  
  25. #define slimming(a) a.shrink_to_fit()
  26. #define len(a) (ll)a.size()
  27. #define check(a) next_permutation(all(a))
  28.  
  29. #define f first
  30. #define s second
  31.  
  32. // #define ff f.f
  33. // #define fs f.s
  34. // #define sf s.f
  35. // #define ss s.s
  36.    
  37. #define INF 1e9
  38. #define MOD (ll)1e9
  39.    
  40. #define yes "YES"
  41. #define no "NO"
  42.    
  43.    
  44. #define pb push_back
  45. #define eb emplace_back
  46.  
  47. // #define M_PI 3.14159265359
  48.  
  49. // ||           ----   ||
  50. // ||          /    \  ||
  51. // ||          |    |  ||
  52. // ||          |    |  ||
  53. // ||          |    |  ||
  54. // ||          |    |  ||
  55. // ||_______   |    |  ||_______
  56. // \\_______|  \____/  \\_______|
  57.  
  58. #pragma GCC optimize("unroll-loops")
  59. #pragma GCC optimize("Ofast")
  60. #pragma GCC optimize("no-stack-protector")
  61. #pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
  62. #pragma GCC optimize("fast-math")
  63. #pragma GCC optimize "-O3"
  64.  
  65. struct Point{
  66.     ld x, y;
  67.     Point(){}
  68.     Point(ld a, ld b){
  69.         this->x = a;
  70.         this->y = b;
  71.     }
  72. };
  73.  
  74. struct Vector{
  75.     ld x, y;
  76.     ld length2, length;
  77.     Point bg, en;
  78.     Vector(ld x, ld y){
  79.         this->x = x;
  80.         this->y = y;
  81.  
  82.         this->length2 = x * x + y * y;
  83.         this->length = sqrt(this->length2);
  84.     }
  85.    
  86.     Vector(Point a){
  87.         this->x = a.x;
  88.         this->y = a.y;
  89.  
  90.         this->length2 = a.x * a.x + a.y * a.y;
  91.         this->length = sqrt(this->length2);  
  92.     }
  93.  
  94.     Vector(Point a, Point b){
  95.         this->x = b.x - a.x;
  96.         this->y = b.y - a.y;
  97.  
  98.         this->bg = a;
  99.         this->en = b;
  100.  
  101.         this->length2 = this->x * this->x + this->y * this->y;
  102.         this->length = sqrt(this->length2);
  103.     }
  104. };
  105.  
  106. struct Line{
  107.     ld a, b, c;
  108.    
  109.     Line(){}
  110.  
  111.     Line(ll a, ll b, ll c){
  112.         this->a = a;
  113.         this->b = b;
  114.         this->c = c;
  115.     }
  116.  
  117.     Line(Point x, Point y){
  118.         this->a = x.y - y.y;
  119.         this->b = y.x - x.x;
  120.         this->c = -a * x.x - b * x.y;
  121.     }
  122.  
  123.     Line(Point x, Vector y){
  124.         this->a = y.x;
  125.         this->b = y.y;
  126.         this->c = -a*x.x - b*x.y;
  127.     }
  128.  
  129.     bool CheckPoint(Point q){
  130.         // cout << (a*q.y + b*q.x + c) << ' ' << q.y;
  131.         return (a*q.x + b*q.y + c == 0);
  132.     }
  133.  
  134.     ll lol(Point q){
  135.         return a*q.x + b*q.y + c;
  136.     }
  137.  
  138.     Vector lineToVector(){
  139.         Point q(1, (a + c)/b);
  140.         Point w(2, (2*a + c)/b);
  141.         return Vector(q, w);
  142.     }
  143. };
  144.  
  145. Vector operator+(Vector a, Vector b){return Vector(a.x + b.x, a.y + b.y);}
  146. Vector operator*(Vector a, ll k){return Vector(a.x * k, a.y * k);}
  147. ld DotProduct(Vector a, Vector b){return b.x * a.x + b.y * a.y;}
  148. ld CrossProduct(Vector a, Vector b){return a.x * b.y - a.y * b.x;}
  149. ld AngleRad(Vector a, Vector b){return -atan2(CrossProduct(a, b), DotProduct(a, b));}
  150. ld PolarAngle(ld angle){
  151.     if(angle >= 0)
  152.         return angle;
  153.     return (2*M_PI + angle);}
  154.  
  155. Point ReadPoint(){
  156.     Point a;
  157.     cin >> a.x >> a.y;
  158.     return a;}
  159. Line ReadLine(){
  160.     ll a, b, c;
  161.     cin >> a >> b >> c;
  162.     return Line(a, b, c);}
  163.  
  164. ld dist(Point a, Point b){return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));}
  165.  
  166. void solve(){
  167.    
  168. }
  169.  
  170. int main() {
  171.     // ios_base::sync_with_stdio(false);
  172.     // cin.tie(nullptr);
  173.     // cout.tie(nullptr);
  174.  
  175.     // freopen("input.txt", "r", stdin);
  176.     // freopen("output.txt", "w", stdout);
  177.    
  178.     solve();
  179.     return 0;
  180. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement