double Squared(const Pointf& p)
Returns p.x2 + p.y2.
double Length(const Pointf& p)
Returns sqrt(p.x2 + p.y2).
double Direction(const Pointf& p)
Returns atan2(p.y, p.x) : the angle between line [0,0] - p and x axis in radians.
double Distance(const Pointf& p1, const Pointf& p2)
Returns distance p1 p2 - Length(p1 - p2).
double SquaredDistance(const Pointf& p1, const Pointf& p2)
Returns squared distance p1 p2 : Squared(p1 - p2).
Pointf Mid(const Pointf& a, const Pointf& b)
Returns middle point between a and b : 0.5 * (a + b).
Pointf Orthogonal(const Pointf& p)
Returns a point that is ortoghonal to p wrt to [0,0] : [-p.y, p.x].
Pointf Normalize(const Pointf& p)
Returns p / Length(p). If p is [0,0], returns [0,0].
Pointf Polar(double a)
Returns a point with distance 1 from [0,0] and angle a between the point and x axis.
Pointf Polar(const Pointf& p, double r, double a)
Returns p + r * Polar(a).
template <typename T> Point_<T> Lerp(Point_<T> a, Point_<T> b, double t)
template <typename T> Size_<T> Lerp(Size_<T> a, Size_<T> b, double t)
template <typename T> Rect_<T> Lerp(Rect_<T> a, Rect_<T> b, double t)
Performs linear interpolation between 2 geometric objects, if the parameter t is inside [0,1] (the linear extrapolation otherwise).
|