45 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
47 return !(
x +
w + margin < o.
x ||
48 x - margin > o.
x + o.
w ||
49 y +
h + margin < o.
y ||
50 y - margin > o.
y + o.
h);
63 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
66 return (
p1 == other.
p1 &&
p2 == other.
p2) ||
72 return (
p1.same(other.
p1) &&
p2.same(other.
p2)) ||
73 (
p1.same(other.
p2) &&
p2.same(other.
p1));
86 template<typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
98 T term1 = a.
x * (b.
y * c2 - c.
y * b2);
99 T term2 = - a.
y * (b.
x * c2 - c.
x * b2);
100 T term3 = a2 * b.
cross(c);
101 T det = term1 + term2 + term3;
108 const double abc = 0.5 * abs(
p1.x * (
p2.y -
p3.y) +
p2.x * (
p3.y -
p1.y) +
p3.x * (
p1.y -
p2.y));
110 const double abp = 0.5 * abs(
p1.x * (
p2.y - P.
y) +
p2.x * (P.
y -
p1.y) + P.
x * (
p1.y -
p2.y));
111 const double bcp = 0.5 * abs(
p2.x * (
p3.y - P.
y) +
p3.x * (P.
y -
p2.y) + P.
x * (
p2.y -
p3.y));
112 const double cap = 0.5 * abs(
p3.x * (
p1.y - P.
y) +
p1.x * (P.
y -
p3.y) + P.
x * (
p3.y -
p1.y));
120 return ((
p1 == other.
p1) && (
p2 == other.
p2) && (
p3 == other.
p3)) ||
121 ((
p1 == other.
p1) && (
p2 == other.
p3) && (
p3 == other.
p2)) ||
122 ((
p1 == other.
p2) && (
p2 == other.
p1) && (
p3 == other.
p3)) ||
123 ((
p1 == other.
p2) && (
p2 == other.
p3) && (
p3 == other.
p1)) ||
124 ((
p1 == other.
p3) && (
p2 == other.
p1) && (
p3 == other.
p2)) ||
125 ((
p1 == other.
p3) && (
p2 == other.
p2) && (
p3 == other.
p1));
131 return (
p1.same(other.
p1) &&
p2.same(other.
p2) &&
p3.same(other.
p3)) ||
132 (
p1.same(other.
p1) &&
p2.same(other.
p3) &&
p3.same(other.
p2)) ||
133 (
p1.same(other.
p2) &&
p2.same(other.
p1) &&
p3.same(other.
p3)) ||
134 (
p1.same(other.
p2) &&
p2.same(other.
p3) &&
p3.same(other.
p1)) ||
135 (
p1.same(other.
p3) &&
p2.same(other.
p1) &&
p3.same(other.
p2)) ||
136 (
p1.same(other.
p3) &&
p2.same(other.
p2) &&
p3.same(other.
p1));
Line< std::int32_t > Linei
Definition Shape.hpp:78
Rect< std::int32_t > Recti
Definition Shape.hpp:55
Triangle< std::uint32_t > Triangleu
Definition Shape.hpp:141
Line< double > Linef
Definition Shape.hpp:79
Triangle< double > Trianglef
Definition Shape.hpp:143
Rect< std::uint32_t > Rectu
Definition Shape.hpp:54
Line< std::uint32_t > Lineu
Definition Shape.hpp:77
Rect< double > Rectf
Definition Shape.hpp:56
Triangle< std::int32_t > Trianglei
Definition Shape.hpp:142
Definition Constants.hpp:14
Vector2< std::uint32_t > p1
Definition Shape.hpp:61
bool operator==(const Line &other) const
Definition Shape.hpp:64
bool same(const Line &other) const
Definition Shape.hpp:70
Vector2< std::uint32_t > p2
Definition Shape.hpp:61
Vector2< T > size() const
Definition Shape.hpp:42
Vector2< T > half() const
Definition Shape.hpp:39
std::uint32_t w
Definition Shape.hpp:33
std::uint32_t h
Definition Shape.hpp:33
std::uint32_t y
Definition Shape.hpp:33
std::uint32_t x
Definition Shape.hpp:33
bool intersects(const Rect &o, T margin=T(0)) const
Definition Shape.hpp:46
Vector2< T > corner() const
Definition Shape.hpp:41
Vector2< T > center() const
Definition Shape.hpp:38
bool isInsideCircumcircle(const Vector2< T > &p)
Definition Shape.hpp:87
Vector2< std::uint32_t > p3
Definition Shape.hpp:84
bool same(const Triangle< T > &other) const
Definition Shape.hpp:128
bool isInside(Vector2< T > P)
Definition Shape.hpp:107
Vector2< std::uint32_t > p2
Definition Shape.hpp:84
Vector2< std::uint32_t > p1
Definition Shape.hpp:84
bool operator==(const Triangle< T > &other) const
Definition Shape.hpp:118
Definition Vector2.hpp:20
T y
Definition Vector2.hpp:21
T x
Definition Vector2.hpp:21
T cross(const Vector2 &other) const
Definition Vector2.hpp:65
T square_magnitude() const
Definition Vector2.hpp:68