29 #ifndef __WINDING2D_H__
30 #define __WINDING2D_H__
40 #define MAX_POINTS_ON_WINDING_2D 16
55 void Expand(
const float d );
75 void Print(
void )
const;
100 for ( i = 0; i < winding.
numPoints; i++ ) {
129 plane.
x = start.
y - end.
y;
130 plane.
y = end.
x - start.
x;
134 plane.
z = - ( start.
x * plane.
x + start.
y * plane.
y );
145 plane.
z = - ( start.
x * plane.
x + start.
y * plane.
y );
150 float n00, n01, n11, det, invDet, f0, f1;
152 n00 = plane1.
x * plane1.
x + plane1.
y * plane1.
y;
153 n01 = plane1.
x * plane2.
x + plane1.
y * plane2.
y;
154 n11 = plane2.
x * plane2.
x + plane2.
y * plane2.
y;
155 det = n00 * n11 - n01 * n01;
162 f0 = ( n01 * plane2.
z - n11 * plane1.
z ) * invDet;
163 f1 = ( n01 * plane1.
z - n00 * plane2.
z ) * invDet;
164 point.
x = f0 * plane1.
x + f1 * plane2.
x;
165 point.
y = f0 * plane1.
y + f1 * plane2.
y;
const idVec2 & operator[](const int index) const
float GetArea(void) const
void Expand(const float d)
static bool Plane2DIntersection(const idVec3 &plane1, const idVec3 &plane2, idVec2 &point)
int PlaneSide(const idVec3 &plane, const float epsilon=ON_EPSILON) const
float PlaneDistance(const idVec3 &plane) const
const idVec2 & ToVec2(void) const
idVec2 p[MAX_POINTS_ON_WINDING_2D]
bool PointInside(const idVec2 &point, const float epsilon) const
int Split(const idVec3 &plane, const float epsilon, idWinding2D **front, idWinding2D **back) const
static float Fabs(float f)
idWinding2D * Copy(void) const
static idVec3 Plane2DFromPoints(const idVec2 &start, const idVec2 &end, const bool normalize=false)
void ExpandForAxialBox(const idVec2 bounds[2])
int GetNumPoints(void) const
idVec2 GetCenter(void) const
bool ClipInPlace(const idVec3 &plane, const float epsilon=ON_EPSILON, const bool keepOn=false)
float GetRadius(const idVec2 ¢er) const
bool RayIntersection(const idVec2 &start, const idVec2 &dir, float &scale1, float &scale2, int *edgeNums=NULL) const
#define MAX_POINTS_ON_WINDING_2D
void GetBounds(idVec2 bounds[2]) const
bool LineIntersection(const idVec2 &start, const idVec2 &end) const
void AddPoint(const idVec2 &point)
idWinding2D & operator=(const idWinding2D &winding)
idWinding2D * Reverse(void) const
static idVec3 Plane2DFromVecs(const idVec2 &start, const idVec2 &dir, const bool normalize=false)
void normalize(float v[])