Pyrogenesis  trunk
Functions
Geometry Namespace Reference

Functions

bool PointIsInSquare (const CFixedVector2D &point, const CFixedVector2D &u, const CFixedVector2D &v, const CFixedVector2D &halfSize)
 Checks if a point is inside the given rotated rectangle. More...
 
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,y) with -bx <= x <= bx, -by <= y < by. More...
 
fixed DistanceToSquare (const CFixedVector2D &point, const CFixedVector2D &u, const CFixedVector2D &v, const CFixedVector2D &halfSize, bool countInsideAsZero=false)
 Returns the minimum Euclidean distance from the given point to any point on the boundary of the given rotated rectangle. More...
 
fixed DistanceToSquareSquared (const CFixedVector2D &point, const CFixedVector2D &u, const CFixedVector2D &v, const CFixedVector2D &halfSize, bool countInsideAsZero=false)
 Similar to above but never uses sqrt, so it returns the squared distance. More...
 
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) to the given point in Euclidean distance. More...
 
float ChordToCentralAngle (const float chordLength, const float radius)
 Given a circle of radius radius, and a chord of length chordLength on this circle, computes the central angle formed by connecting the chord's endpoints to the center of the circle. More...
 
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 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)
 

Function Documentation

float Geometry::ChordToCentralAngle ( const float  chordLength,
const float  radius 
)

Given a circle of radius radius, and a chord of length chordLength on this circle, computes the central angle formed by connecting the chord's endpoints to the center of the circle.

Parameters
radiusRadius of the circle; must be strictly positive.
fixed Geometry::DistanceToSquare ( const CFixedVector2D point,
const CFixedVector2D u,
const CFixedVector2D v,
const CFixedVector2D halfSize,
bool  countInsideAsZero = false 
)

Returns the minimum Euclidean distance from the given point to any point on the boundary of the given rotated rectangle.

If countInsideAsZero is true, and the point is inside the rectangle, it will return 0. If countInsideAsZero is false, the (positive) distance to the boundary will be returned regardless of where the point is.

The rectangle is defined by the four vertexes (+/-u*halfSize.X +/-v*halfSize.Y).

The u and v vectors must be perpendicular and unit length.

fixed Geometry::DistanceToSquareSquared ( const CFixedVector2D point,
const CFixedVector2D u,
const CFixedVector2D v,
const CFixedVector2D halfSize,
bool  countInsideAsZero = false 
)

Similar to above but never uses sqrt, so it returns the squared distance.

CFixedVector2D Geometry::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,y) with -bx <= x <= bx, -by <= y < by.

The rectangle is defined by the four vertexes (+/-u*halfSize.X +/-v*halfSize.Y).

CFixedVector2D Geometry::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) to the given point in Euclidean distance.

The rectangle is defined by the four vertexes (+/-u*halfSize.X +/-v*halfSize.Y).

The u and v vectors must be perpendicular and unit length.

bool Geometry::PointIsInSquare ( const CFixedVector2D point,
const CFixedVector2D u,
const CFixedVector2D v,
const CFixedVector2D halfSize 
)
inline

Checks if a point is inside the given rotated rectangle.

Points precisely on an edge are considered to be inside.

The rectangle is defined by the four vertexes (+/-u*halfSize.X +/-v*halfSize.Y)

The u and v vectors must be perpendicular.

bool Geometry::TestRayAASquare ( const CFixedVector2D a,
const CFixedVector2D b,
const CFixedVector2D halfSize 
)
bool Geometry::TestRaySquare ( const CFixedVector2D a,
const CFixedVector2D b,
const CFixedVector2D u,
const CFixedVector2D v,
const CFixedVector2D halfSize 
)
bool Geometry::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 
)