| 
 | 1 | +#pragma once  | 
 | 2 | + | 
 | 3 | +namespace mapbox { namespace geometry {  | 
 | 4 | + | 
 | 5 | +template <typename T>  | 
 | 6 | +point<T> operator+(point<T> const& lhs, point<T> const& rhs)  | 
 | 7 | +{  | 
 | 8 | +    return point<T>(lhs.x + rhs.x, lhs.y + rhs.y);  | 
 | 9 | +}  | 
 | 10 | + | 
 | 11 | +template <typename T>  | 
 | 12 | +point<T> operator+(point<T> const& lhs, T const& rhs)  | 
 | 13 | +{  | 
 | 14 | +    return point<T>(lhs.x + rhs, lhs.y + rhs);  | 
 | 15 | +}  | 
 | 16 | + | 
 | 17 | +template <typename T>  | 
 | 18 | +point<T> operator-(point<T> const& lhs, point<T> const& rhs)  | 
 | 19 | +{  | 
 | 20 | +    return point<T>(lhs.x - rhs.x, lhs.y - rhs.y);  | 
 | 21 | +}  | 
 | 22 | + | 
 | 23 | +template <typename T>  | 
 | 24 | +point<T> operator-(point<T> const& lhs, T const& rhs)  | 
 | 25 | +{  | 
 | 26 | +    return point<T>(lhs.x - rhs, lhs.y - rhs);  | 
 | 27 | +}  | 
 | 28 | + | 
 | 29 | +template <typename T>  | 
 | 30 | +point<T> operator*(point<T> const& lhs, point<T> const& rhs)  | 
 | 31 | +{  | 
 | 32 | +    return point<T>(lhs.x * rhs.x, lhs.y * rhs.y);  | 
 | 33 | +}  | 
 | 34 | + | 
 | 35 | +template <typename T>  | 
 | 36 | +point<T> operator*(point<T> const& lhs, T const& rhs)  | 
 | 37 | +{  | 
 | 38 | +    return point<T>(lhs.x * rhs, lhs.y * rhs);  | 
 | 39 | +}  | 
 | 40 | + | 
 | 41 | +template <typename T>  | 
 | 42 | +point<T> operator/(point<T> const& lhs, point<T> const& rhs)  | 
 | 43 | +{  | 
 | 44 | +    return point<T>(lhs.x / rhs.x, lhs.y / rhs.y);  | 
 | 45 | +}  | 
 | 46 | + | 
 | 47 | +template <typename T>  | 
 | 48 | +point<T> operator/(point<T> const& lhs, T const& rhs)  | 
 | 49 | +{  | 
 | 50 | +    return point<T>(lhs.x / rhs, lhs.y / rhs);  | 
 | 51 | +}  | 
 | 52 | + | 
 | 53 | +template <typename T>  | 
 | 54 | +point<T>& operator+=(point<T>& lhs, point<T> const& rhs)  | 
 | 55 | +{  | 
 | 56 | +    lhs.x += rhs.x;  | 
 | 57 | +    lhs.y += rhs.y;  | 
 | 58 | +    return lhs;  | 
 | 59 | +}  | 
 | 60 | + | 
 | 61 | +template <typename T>  | 
 | 62 | +point<T>& operator+=(point<T>& lhs, T const& rhs)  | 
 | 63 | +{  | 
 | 64 | +    lhs.x += rhs;  | 
 | 65 | +    lhs.y += rhs;  | 
 | 66 | +    return lhs;  | 
 | 67 | +}  | 
 | 68 | + | 
 | 69 | +template <typename T>  | 
 | 70 | +point<T>& operator-=(point<T>& lhs, point<T> const& rhs)  | 
 | 71 | +{  | 
 | 72 | +    lhs.x -= rhs.x;  | 
 | 73 | +    lhs.y -= rhs.y;  | 
 | 74 | +    return lhs;  | 
 | 75 | +}  | 
 | 76 | + | 
 | 77 | +template <typename T>  | 
 | 78 | +point<T>& operator-=(point<T>& lhs, T const& rhs)  | 
 | 79 | +{  | 
 | 80 | +    lhs.x -= rhs;  | 
 | 81 | +    lhs.y -= rhs;  | 
 | 82 | +    return lhs;  | 
 | 83 | +}  | 
 | 84 | + | 
 | 85 | +template <typename T>  | 
 | 86 | +point<T>& operator*=(point<T>& lhs, point<T> const& rhs)  | 
 | 87 | +{  | 
 | 88 | +    lhs.x *= rhs.x;  | 
 | 89 | +    lhs.y *= rhs.y;  | 
 | 90 | +    return lhs;  | 
 | 91 | +}  | 
 | 92 | + | 
 | 93 | +template <typename T>  | 
 | 94 | +point<T>& operator*=(point<T>& lhs, T const& rhs)  | 
 | 95 | +{  | 
 | 96 | +    lhs.x *= rhs;  | 
 | 97 | +    lhs.y *= rhs;  | 
 | 98 | +    return lhs;  | 
 | 99 | +}  | 
 | 100 | + | 
 | 101 | +template <typename T>  | 
 | 102 | +point<T>& operator/=(point<T>& lhs, point<T> const& rhs)  | 
 | 103 | +{  | 
 | 104 | +    lhs.x /= rhs.x;  | 
 | 105 | +    lhs.y /= rhs.y;  | 
 | 106 | +    return lhs;  | 
 | 107 | +}  | 
 | 108 | + | 
 | 109 | +template <typename T>  | 
 | 110 | +point<T>& operator/=(point<T>& lhs, T const& rhs)  | 
 | 111 | +{  | 
 | 112 | +    lhs.x /= rhs;  | 
 | 113 | +    lhs.y /= rhs;  | 
 | 114 | +    return lhs;  | 
 | 115 | +}  | 
 | 116 | + | 
 | 117 | +}}  | 
0 commit comments