9 #ifndef CUBBYFLOW_POINT2_IMPL_H 10 #define CUBBYFLOW_POINT2_IMPL_H 46 assert(list.size() >= 2);
48 auto inputElem = list.begin();
49 x =
static_cast<T
>(*inputElem);
50 y =
static_cast<T
>(*(++inputElem));
70 return Point(x + v, y + v);
76 return Point(x + v.x, y + v.y);
82 return Point(x - v, y - v);
88 return Point(x - v.x, y - v.y);
94 return Point(x * v, y * v);
100 return Point(x * v.x, y * v.y);
103 template <
typename T>
106 return Point(x / v, y / v);
109 template <
typename T>
112 return Point(x / v.x, y / v.y);
116 template <
typename T>
119 return Point(v + x, v + y);
122 template <
typename T>
125 return Point(v.x + x, v.y + y);
128 template <
typename T>
131 return Point(v - x, v - y);
134 template <
typename T>
137 return Point(v.x - x, v.y - y);
140 template <
typename T>
143 return Point(v * x, v * y);
146 template <
typename T>
149 return Point(v.x * x, v.y * y);
152 template <
typename T>
155 return Point(v / x, v / y);
158 template <
typename T>
161 return Point(v.x / x, v.y / y);
165 template <
typename T>
172 template <
typename T>
179 template <
typename T>
186 template <
typename T>
193 template <
typename T>
200 template <
typename T>
207 template <
typename T>
214 template <
typename T>
222 template <
typename T>
229 template <
typename T>
236 template <
typename T>
242 template <
typename T>
245 return std::min(x, y);
248 template <
typename T>
251 return std::max(x, y);
254 template <
typename T>
260 template <
typename T>
266 template <
typename T>
269 return (std::fabs(x) > std::fabs(y)) ? 0 : 1;
272 template <
typename T>
275 return (std::fabs(x) < std::fabs(y)) ? 0 : 1;
278 template <
typename T>
279 template <
typename U>
282 return Point2<U>(
static_cast<U
>(x), static_cast<U>(y));
285 template <
typename T>
288 return (x == other.x && y == other.y);
292 template <
typename T>
299 template <
typename T>
306 template <
typename T>
313 template <
typename T>
320 template <
typename T>
327 template <
typename T>
334 template <
typename T>
341 template <
typename T>
348 template <
typename T>
355 template <
typename T>
362 template <
typename T>
369 template <
typename T>
376 template <
typename T>
382 template <
typename T>
389 template <
typename T>
395 template <
typename T>
401 template <
typename T>
407 template <
typename T>
413 template <
typename T>
419 template <
typename T>
425 template <
typename T>
431 template <
typename T>
437 template <
typename T>
443 template <
typename T>
449 template <
typename T>
455 template <
typename T>
461 template <
typename T>
467 template <
typename T>
473 template <
typename T>
479 template <
typename T>
485 template <
typename T>
491 template <
typename T>
497 template <
typename T>
T AbsMin(T x, T y)
Returns the absolute minimum value among the two inputs.
Definition: MathUtils-Impl.h:39
Point Mul(T v) const
Computes this * (v, v).
Definition: Point2-Impl.h:92
Point Div(T v) const
Computes this / (v, v).
Definition: Point2-Impl.h:104
Point< T, 2 > Ceil(const Point< T, 2 > &a)
Returns element-wise ceiled point.
Definition: Point2-Impl.h:492
Matrix< T, 2, 2 > operator+(const Matrix< T, 2, 2 > &a, const Matrix< T, 2, 2 > &b)
Returns a + b (element-size).
Definition: Matrix2x2-Impl.h:660
T x
X (or the first) component of the point.
Definition: Point2.h:28
Point Sub(T v) const
Computes this - (v, v).
Definition: Point2-Impl.h:80
void Set(const std::initializer_list< U > &list)
Set point instance with initializer list.
Definition: Point-Impl.h:57
2-D point class.
Definition: Point2.h:25
Point RDiv(T v) const
Computes (v, v) / this.
Definition: Point2-Impl.h:153
Point RMul(T v) const
Computes (v, v) * this.
Definition: Point2-Impl.h:141
T y
Y (or the second) component of the point.
Definition: Point2.h:34
Point< T, 2 > Floor(const Point< T, 2 > &a)
Returns element-wise floored point.
Definition: Point2-Impl.h:498
Generic N-D point class.
Definition: Point.h:24
Point Add(T v) const
Computes this + (v, v).
Definition: Point2-Impl.h:68
Matrix< T, 2, 2 > operator/(const Matrix< T, 2, 2 > &a, T b)
Definition: Matrix2x2-Impl.h:720
Definition: pybind11Utils.h:24
Point RAdd(T v) const
Computes (v, v) + this.
Definition: Point2-Impl.h:117
T Clamp(T val, T low, T high)
Returns the clamped value.
Definition: MathUtils-Impl.h:123
Point & operator=(const std::initializer_list< U > &list)
Set point instance with initializer list.
Matrix< T, 2, 2 > operator-(const Matrix< T, 2, 2 > &a)
Returns a matrix with opposite sign.
Definition: Matrix2x2-Impl.h:654
Point< T, 2 > Max(const Point< T, 2 > &a, const Point< T, 2 > &b)
Returns element-wise max point: (max(a.x, b.x), max(a.y, b.y)).
Definition: Point2-Impl.h:480
const T & operator[](size_t i) const
Returns the const reference to the i -th element.
Definition: Point-Impl.h:91
Point RSub(T v) const
Computes (v, v) - this.
Definition: Point2-Impl.h:129
Vector< T, 3 > operator*(const Quaternion< T > &q, const Vector< T, 3 > &v)
Returns quaternion q * vector v.
Definition: Quaternion-Impl.h:481
T AbsMax(T x, T y)
Returns the absolute maximum value among the two inputs.
Definition: MathUtils-Impl.h:45
Point()
Constructs a point with zeros.
Definition: Point-Impl.h:17
Point< T, 2 > Min(const Point< T, 2 > &a, const Point< T, 2 > &b)
Returns element-wise min point: (min(a.x, b.x), min(a.y, b.y)).
Definition: Point2-Impl.h:474