52 # define M_PI 3.14159265358979323846
57 # define DEG_TO_RAD ( M_PI / 180.0 )
69 typedef VertexNoColor
Vector;
111 return ( ( v.x - x ) * ( v.x - x ) ) + ( ( v.y - y ) * ( v.y - y ) ) + ( ( v.z - z ) * ( v.z - z ) );
134 float fT = kDiff.
DotProduct( direction ) / fSqrLen;
137 kDiff.x -= direction.x * fT;
138 kDiff.y -= direction.y * fT;
139 kDiff.z -= direction.z * fT;
151 return float( sqrt( ( ( v.x - x ) * ( v.x - x ) ) + ( ( v.y - y ) * ( v.y - y ) ) + ( ( v.z - z ) * ( v.z - z ) ) ) );
160 return ( ( v.x - x ) * ( v.x - x ) ) + ( ( v.y - y ) * ( v.y - y ) );
168 return float( sqrt( ( ( v.x - x ) * ( v.x - x ) ) + ( ( v.y - y ) * ( v.y - y ) ) ) );
259 return ( ( x == arg.x ) && ( y == arg.y ) && ( z == arg.z ) );
268 return ( ( x != arg.x ) || ( y != arg.y ) || ( z != arg.z ) );
309 float length, inv_length;
315 inv_length = 1.0f / length;
328 return float( sqrt( ( ( x ) * ( x ) ) + ( ( y ) * ( y ) ) + ( ( z ) * ( z ) ) ) );
336 return x * x + y * y + z * z;
348 ( z * w.x ) - ( x * w.z ),
349 ( x * w.y ) - ( y * w.x ) );
358 return ( ( x * w.x ) + ( y * w.y ) + ( z * w.z ) );
377 fAB = ( y - a.y ) * ( b.x - a.x ) - ( x - a.x ) * ( b.y - a.y );
378 fBC = ( y - b.y ) * ( c.x - b.x ) - ( x - b.x ) * ( c.y - b.y );
379 fCA = ( y - c.y ) * ( a.x - c.x ) - ( x - c.x ) * ( a.y - c.y );
381 return ( ( ( fAB * fBC ) > 0 ) && ( ( fBC * fCA ) > 0 ) );
404 GLS_EXPORT std::istream& operator>>( std::istream& instr, Vector& vert );
405 GLS_EXPORT std::ostream& operator<<( std::ostream& outstr,
const Vector& vert );
417 color.
RGBA( DEF_FILL_RCOLOR, DEF_FILL_GCOLOR, DEF_FILL_BCOLOR, DEF_FILL_ALPHA );
424 color.
RGBA( DEF_FILL_RCOLOR, DEF_FILL_GCOLOR, DEF_FILL_BCOLOR, DEF_FILL_ALPHA );
441 color.
RGBA( DEF_FILL_RCOLOR, DEF_FILL_GCOLOR, DEF_FILL_BCOLOR, DEF_FILL_ALPHA );
454 unsigned char _r,
unsigned char _g,
unsigned char _b,
unsigned char _a )
457 color.
RGBA( _r, _g, _b, _a );
477 return Vertex( x + arg.x, y + arg.y, z + arg.z, color );
485 return Vertex( x * s, y * s, z * s, color );
517 return Vertex( x - arg.x, y - arg.y, z - arg.z, color );
523 return Vertex( -x, -y, -z, color );
532 return Vertex( x * arg.x, y * arg.y, z * arg.z, color );
563 PlaneClass(
float A,
float B,
float C,
float D )
573 DISTI_EXPORT std::istream& operator>>( std::istream& instr, Vertex& vert );
574 DISTI_EXPORT std::ostream& operator<<( std::ostream& outstr,
const Vertex& vert );
584 DISTI_EXPORT
int IntersectionVectorAndPlane( VertexNoColor& point,
const Vector& lineVector,
const VertexNoColor& linePoint,
const Vector& planeNormal,
const Vector& planePoint );
604 DISTI_EXPORT VertexNoColor
ProjectedIntersectingPoint(
const VertexNoColor& p1,
const VertexNoColor& p2,
const VertexNoColor& p3 );
618 DISTI_EXPORT
bool LineHitsTriangle(
const Vector& origin,
const Vector& direction,
const Vector& v0,
const Vector& v1,
const Vector& v2, Vector* collisionPoint = 0 );
630 DISTI_EXPORT
bool RayHitsTriangle(
const Vector& origin,
const Vector& direction,
const Vector& v0,
const Vector& v1,
const Vector& v2, Vector* collisionPoint = 0 );
641 DISTI_EXPORT
void FindCollision(
const Vector& origin,
const Vector& vert1,
const Vector& vert2,
const Vector& vert3, VertexNoColor* collisionPoint,
const Vector& directionVector );
649 DISTI_EXPORT VertexNoColor
Normal(
const VertexNoColor& p1,
const VertexNoColor& p2,
const VertexNoColor& p3 );
The DistiUnhideGlobalsDummyClass class.
Vertex operator+(const VertexNoColor &arg) const
Definition: vertex.h:475
Vertex(const VertexNoColor &noColor)
Definition: vertex.h:421
VertexNoColor(float _x, float _y, float _z)
Definition: vertex.h:99
RotationAxis
Definition: vertex.h:72
Vertex(float _x, float _y, float _z, unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a)
Definition: vertex.h:453
VertexNoColor operator/(const float s) const
Definition: vertex.h:207
float MagnitudeSquared() const
Definition: vertex.h:334
Vertex()
Definition: vertex.h:414
VertexNoColor operator+(const VertexNoColor &arg) const
Definition: vertex.h:174
VertexNoColor ProjectedIntersectingPoint(const VertexNoColor &p1, const VertexNoColor &p2, const VertexNoColor &p3)
void Normalize(void)
Definition: vertex.h:307
float DotProduct(const VertexNoColor &w) const
Definition: vertex.h:356
bool CloseTo(const VertexNoColor &arg, float tolerance=0.0001f) const
bool LineHitsTriangle(const Vector &origin, const Vector &direction, const Vector &v0, const Vector &v1, const Vector &v2, Vector *collisionPoint=0)
Vertex(float _x, float _y, float _z)
Definition: vertex.h:438
The Color class: Implements a 4 component RGBA color.
A file for all GL Studio files to include.
VertexNoColor()
Definition: vertex.h:89
bool PointInTriangle(const VertexNoColor &a, const VertexNoColor &b, const VertexNoColor &c) const
Definition: vertex.h:373
void FindCollision(const Vector &origin, const Vector &vert1, const Vector &vert2, const Vector &vert3, VertexNoColor *collisionPoint, const Vector &directionVector)
VertexNoColor & operator/=(const float s)
Definition: vertex.h:215
VertexNoColor & operator+=(const VertexNoColor &arg)
Definition: vertex.h:226
VertexNoColor operator-() const
Definition: vertex.h:180
Vertex CrossProduct(const VertexNoColor &w) const
Definition: vertex.h:541
bool operator==(const VertexNoColor &arg) const
Definition: vertex.h:257
VertexNoColor operator*(const float s) const
Definition: vertex.h:188
float Distance2Squared(const VertexNoColor &v) const
Definition: vertex.h:158
VertexNoColor Vector
Definition: gls_font_base.h:66
Vertex operator*(const VertexNoColor &arg) const
Definition: vertex.h:530
GL Studio Enumerations and constants.
Vertex(const VertexNoColor &noColor, const GlsColor &_color)
Definition: vertex.h:428
Vertex Rotate(const float angle) const
VertexNoColor CrossProduct(const VertexNoColor &w) const
Definition: vertex.h:345
Vertex operator-() const
Definition: vertex.h:521
PlaneClass(void)
Definition: vertex.h:555
Definition: gls_color.h:53
int IntersectionVectorAndPlane(VertexNoColor &point, const Vector &lineVector, const VertexNoColor &linePoint, const Vector &planeNormal, const Vector &planePoint)
VertexNoColor operator*(const VertexNoColor &arg) const
Definition: vertex.h:275
VertexNoColor Rotate(const float angle) const
float Distance2(const VertexNoColor &v) const
Definition: vertex.h:166
VertexNoColor Normal(const VertexNoColor &p1, const VertexNoColor &p2, const VertexNoColor &p3)
float DistanceFromLine(const VertexNoColor &start, const VertexNoColor &direction) const
Vertex operator*(const float s) const
Definition: vertex.h:483
float Magnitude() const
Definition: vertex.h:326
float Distance3Squared(const VertexNoColor &v) const
Definition: vertex.h:109
VertexNoColor & operator*=(const float s)
Definition: vertex.h:196
bool operator!=(const VertexNoColor &arg) const
Definition: vertex.h:266
float Distance3(const VertexNoColor &v) const
Definition: vertex.h:149
VertexNoColor operator-(const VertexNoColor &arg) const
Definition: vertex.h:237
float AngleToVector(const VertexNoColor &arg) const
Vertex(float _x, float _y, float _z, const GlsColor &_color)
Definition: vertex.h:466
VertexNoColor ProjectPointToLine(const VertexNoColor &origin, const VertexNoColor &direction) const
float DistanceFromLineSquared(const float startx, const float starty, const float startz, const VertexNoColor &direction) const
Definition: vertex.h:121
Definition: bmpimage.h:46
VertexNoColor & operator-=(const VertexNoColor &arg)
Definition: vertex.h:245
bool RayHitsTriangle(const Vector &origin, const Vector &direction, const Vector &v0, const Vector &v1, const Vector &v2, Vector *collisionPoint=0)
Vertex operator-(const VertexNoColor &arg) const
Definition: vertex.h:515
void RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
Definition: gls_color.h:168