Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/helpers/Geometry.h
Show First 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | |||||
* The rectangle is defined by the four vertexes | * The rectangle is defined by the four vertexes | ||||
* (+/-u*halfSize.X +/-v*halfSize.Y). | * (+/-u*halfSize.X +/-v*halfSize.Y). | ||||
* | * | ||||
* The @p u and @p v vectors must be perpendicular and unit length. | * The @p u and @p v vectors must be perpendicular and unit length. | ||||
*/ | */ | ||||
CFixedVector2D NearestPointOnSquare(const CFixedVector2D& point, | CFixedVector2D NearestPointOnSquare(const CFixedVector2D& point, | ||||
const CFixedVector2D& u, const CFixedVector2D& v, const CFixedVector2D& halfSize); | const CFixedVector2D& u, const CFixedVector2D& v, const CFixedVector2D& halfSize); | ||||
/** | |||||
* Given a circle of radius @p radius, and a chord of length @p chordLength | |||||
* on this circle, computes the central angle formed by | |||||
* connecting the chord's endpoints to the center of the circle. | |||||
* | |||||
* @param radius Radius of the circle; must be strictly positive. | |||||
*/ | |||||
float ChordToCentralAngle(const float chordLength, const float radius); | |||||
bool TestRaySquare(const CFixedVector2D& a, const CFixedVector2D& b, const CFixedVector2D& u, const CFixedVector2D& v, const CFixedVector2D& halfSize); | bool TestRaySquare(const CFixedVector2D& a, const CFixedVector2D& b, const CFixedVector2D& u, const CFixedVector2D& v, const CFixedVector2D& halfSize); | ||||
bool TestRayAASquare(const CFixedVector2D& a, const CFixedVector2D& b, const CFixedVector2D& halfSize); | bool TestRayAASquare(const CFixedVector2D& a, const CFixedVector2D& b, const CFixedVector2D& halfSize); | ||||
bool TestSquareSquare( | bool TestSquareSquare( | ||||
const CFixedVector2D& c0, const CFixedVector2D& u0, const CFixedVector2D& v0, const CFixedVector2D& halfSize0, | const CFixedVector2D& c0, const CFixedVector2D& u0, const CFixedVector2D& v0, const CFixedVector2D& halfSize0, | ||||
const CFixedVector2D& c1, const CFixedVector2D& u1, const CFixedVector2D& v1, const CFixedVector2D& halfSize1); | const CFixedVector2D& c1, const CFixedVector2D& u1, const CFixedVector2D& v1, const CFixedVector2D& halfSize1); | ||||
} // namespace | } // namespace | ||||
#endif // INCLUDED_HELPER_GEOMETRY | #endif // INCLUDED_HELPER_GEOMETRY |
Wildfire Games · Phabricator