18#ifndef INCLUDED_HELPER_GEOMETRY
19#define INCLUDED_HELPER_GEOMETRY
73 bool countInsideAsZero =
false);
80 bool countInsideAsZero =
false);
111 bool countInsideAsZero =
false);
Definition: FixedVector2D.h:25
fixed X
Definition: FixedVector2D.h:27
fixed Dot(const CFixedVector2D &v) const
Compute the dot product of this vector with another.
Definition: FixedVector2D.h:209
fixed Y
Definition: FixedVector2D.h:27
A simple fixed-point number class.
Definition: Fixed.h:120
constexpr CFixed Absolute() const
Definition: Fixed.h:315
Definition: Geometry.cpp:23
fixed DistanceSquareToSquare(const CFixedVector2D &relativePos, const CFixedVector2D &u1, const CFixedVector2D &v1, const CFixedVector2D &halfSize1, const CFixedVector2D &u2, const CFixedVector2D &v2, const CFixedVector2D &halfSize2)
Returns the shortest distance between two squares.
Definition: Geometry.cpp:190
bool TestRayAASquare(const CFixedVector2D &a, const CFixedVector2D &b, const CFixedVector2D &halfSize)
Definition: Geometry.cpp:306
std::pair< int, int > GetPerimeterCoordinates(int x_max, int y_max, int k)
Used in Footprint when spawning units: This returns the grid point on the rectangle [-x_max,...
Definition: Geometry.cpp:408
bool TestRaySquare(const CFixedVector2D &a, const CFixedVector2D &b, const CFixedVector2D &u, const CFixedVector2D &v, const CFixedVector2D &halfSize)
Definition: Geometry.cpp:257
CFixedVector2D NearestPointOnSquare(const CFixedVector2D &point, const CFixedVector2D &u, const CFixedVector2D &v, const CFixedVector2D &halfSize)
Returns a point on the boundary of the given rotated rectangle that is closest (or equally closest) t...
Definition: Geometry.cpp:116
fixed DistanceToSquare(const CFixedVector2D &point, const CFixedVector2D &u, const CFixedVector2D &v, const CFixedVector2D &halfSize, bool countInsideAsZero)
Returns the minimum Euclidean distance from the given point to any point on the boundary of the given...
Definition: Geometry.cpp:35
fixed MaxDistanceToSquare(const CFixedVector2D &point, const CFixedVector2D &u, const CFixedVector2D &v, const CFixedVector2D &halfSize, bool countInsideAsZero)
Returns the greatest straight line distance from a point to a square.
Definition: Geometry.cpp:221
fixed DistanceToSegment(const CFixedVector2D &point, const CFixedVector2D &a, const CFixedVector2D &b)
Returns the minimum Euclidean distance from the given point to any point on the given segment.
Definition: Geometry.cpp:429
CFixedVector2D GetHalfBoundingBox(const CFixedVector2D &u, const CFixedVector2D &v, const CFixedVector2D &halfSize)
Returns a vector (bx,by) such that every point inside the given rotated rectangle has coordinates (x,...
Definition: Geometry.cpp:27
int GetPerimeterDistance(int x_max, int y_max, int x, int y)
Used in Footprint when spawning units: Given a grid point (x, y) on the rectangle [-x_max,...
Definition: Geometry.cpp:389
fixed MaxDistanceSquareToSquare(const CFixedVector2D &relativePos, const CFixedVector2D &u1, const CFixedVector2D &v1, const CFixedVector2D &halfSize1, const CFixedVector2D &u2, const CFixedVector2D &v2, const CFixedVector2D &halfSize2)
Return the greatest straight line distance between two squares.
Definition: Geometry.cpp:241
bool TestSquareSquare(const CFixedVector2D &c0, const CFixedVector2D &u0, const CFixedVector2D &v0, const CFixedVector2D &halfSize0, const CFixedVector2D &c1, const CFixedVector2D &u1, const CFixedVector2D &v1, const CFixedVector2D &halfSize1)
Definition: Geometry.cpp:357
fixed DistanceToSquareSquared(const CFixedVector2D &point, const CFixedVector2D &u, const CFixedVector2D &v, const CFixedVector2D &halfSize, bool countInsideAsZero)
Similar to above but never uses sqrt, so it returns the squared distance.
Definition: Geometry.cpp:91
bool PointIsInSquare(const CFixedVector2D &point, const CFixedVector2D &u, const CFixedVector2D &v, const CFixedVector2D &halfSize)
Checks if a point is inside the given rotated rectangle.
Definition: Geometry.h:42