Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
Geometry Namespace Reference

Functions

bool PointIsInSquare (CFixedVector2D point, CFixedVector2D u, CFixedVector2D v, CFixedVector2D halfSize)
 Checks if a point is inside the given rotated square or rectangle. More...
 
CFixedVector2D GetHalfBoundingBox (CFixedVector2D u, CFixedVector2D v, CFixedVector2D halfSize)
 
fixed DistanceToSquare (CFixedVector2D point, CFixedVector2D u, CFixedVector2D v, CFixedVector2D halfSize)
 
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...
 
CFixedVector2D NearestPointOnSquare (CFixedVector2D point, CFixedVector2D u, CFixedVector2D v, CFixedVector2D halfSize)
 Find point closest to the given point on the edge of the given square or rectangle. More...
 
bool TestRaySquare (CFixedVector2D a, CFixedVector2D b, CFixedVector2D u, CFixedVector2D v, CFixedVector2D halfSize)
 
bool TestRayAASquare (CFixedVector2D a, CFixedVector2D b, CFixedVector2D halfSize)
 
bool TestSquareSquare (CFixedVector2D c0, CFixedVector2D u0, CFixedVector2D v0, CFixedVector2D halfSize0, CFixedVector2D c1, CFixedVector2D u1, CFixedVector2D v1, 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.

Definition at line 48 of file Geometry.cpp.

fixed Geometry::DistanceToSquare ( CFixedVector2D  point,
CFixedVector2D  u,
CFixedVector2D  v,
CFixedVector2D  halfSize 
)

Definition at line 53 of file Geometry.cpp.

CFixedVector2D Geometry::GetHalfBoundingBox ( CFixedVector2D  u,
CFixedVector2D  v,
CFixedVector2D  halfSize 
)

Definition at line 40 of file Geometry.cpp.

CFixedVector2D Geometry::NearestPointOnSquare ( CFixedVector2D  point,
CFixedVector2D  u,
CFixedVector2D  v,
CFixedVector2D  halfSize 
)

Find point closest to the given point on the edge of the given square or rectangle.

Note
Currently assumes the u and v vectors are perpendicular.
Parameters
pointpoint vector of the point we want to get the nearest edge point for, relative to the origin (center) of the shape.
urotated X axis unit vector, relative to the absolute XZ plane. Indicates the orientation of the shape. If not rotated, this value is the absolute X axis unit vector (1,0). If rotated by angle theta, this should be (cos theta, -sin theta).
vrotated Z axis unit vector, relative to the absolute XZ plane. Indicates the orientation of the shape. If not rotated, this value is the absolute Z axis unit vector (0,1). If rotated by angle theta, this should be (sin theta, cos theta).
halfSizeHolds half the dimensions of the shape along the u and v vectors, respectively.
Returns
point that is closest to point on the edge of the square specified by orientation unit vectors u and v and half dimensions halfSize, relative to the center of the square

Definition at line 119 of file Geometry.cpp.

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

Checks if a point is inside the given rotated square or rectangle.

Note
Currently assumes the u and v vectors are perpendicular.
Parameters
pointpoint vector of the point that is to be tested relative to the origin (center) of the shape.
urotated X axis unit vector relative to the absolute XZ plane. Indicates the orientation of the rectangle. If not rotated, this value is the absolute X axis unit vector (1,0). If rotated by angle theta, this should be (cos theta, -sin theta), as the absolute Z axis points down in the unit circle.
vrotated Z axis unit vector relative to the absolute XZ plane. Indicates the orientation of the rectangle. If not rotated, this value is the absolute Z axis unit vector (0,1). If rotated by angle theta, this should be (sin theta, cos theta), as the absolute Z axis points down in the unit circle.
halfSizeHolds half the dimensions of the shape along the u and v vectors, respectively.
Returns
true if point is inside the square with rotated X axis unit vector u and rotated Z axis unit vector v, and half dimensions specified by halfSizes.

Definition at line 28 of file Geometry.cpp.

bool Geometry::TestRayAASquare ( CFixedVector2D  a,
CFixedVector2D  b,
CFixedVector2D  halfSize 
)

Definition at line 241 of file Geometry.cpp.

bool Geometry::TestRaySquare ( CFixedVector2D  a,
CFixedVector2D  b,
CFixedVector2D  u,
CFixedVector2D  v,
CFixedVector2D  halfSize 
)

Definition at line 193 of file Geometry.cpp.

bool Geometry::TestSquareSquare ( CFixedVector2D  c0,
CFixedVector2D  u0,
CFixedVector2D  v0,
CFixedVector2D  halfSize0,
CFixedVector2D  c1,
CFixedVector2D  u1,
CFixedVector2D  v1,
CFixedVector2D  halfSize1 
)

Definition at line 305 of file Geometry.cpp.