40 #ifndef INCLUDED_GLS_VERTEX_H
41 #define INCLUDED_GLS_VERTEX_H
57 # define M_PI 3.14159265358979323846
112 return ( ( v.x - x ) * ( v.x - x ) ) + ( ( v.y - y ) * ( v.y - y ) ) + ( ( v.z - z ) * ( v.z - z ) );
135 float fT = kDiff.
DotProduct( direction ) / fSqrLen;
138 kDiff.x -= direction.x * fT;
139 kDiff.y -= direction.y * fT;
140 kDiff.z -= direction.z * fT;
152 return float( sqrt( ( ( v.x - x ) * ( v.x - x ) ) + ( ( v.y - y ) * ( v.y - y ) ) + ( ( v.z - z ) * ( v.z - z ) ) ) );
161 return ( ( v.x - x ) * ( v.x - x ) ) + ( ( v.y - y ) * ( v.y - y ) );
169 return float( sqrt( ( ( v.x - x ) * ( v.x - x ) ) + ( ( v.y - y ) * ( v.y - y ) ) ) );
260 return ( ( x == arg.x ) && ( y == arg.y ) && ( z == arg.z ) );
269 return ( ( x != arg.x ) || ( y != arg.y ) || ( z != arg.z ) );
310 float length, inv_length;
316 inv_length = 1.0f / length;
329 return float( sqrt( ( ( x ) * ( x ) ) + ( ( y ) * ( y ) ) + ( ( z ) * ( z ) ) ) );
337 return x * x + y * y + z * z;
349 ( z * w.x ) - ( x * w.z ),
350 ( x * w.y ) - ( y * w.x ) );
359 return ( ( x * w.x ) + ( y * w.y ) + ( z * w.z ) );
378 fAB = ( y - a.y ) * ( b.x - a.x ) - ( x - a.x ) * ( b.y - a.y );
379 fBC = ( y - b.y ) * ( c.x - b.x ) - ( x - b.x ) * ( c.y - b.y );
380 fCA = ( y - c.y ) * ( a.x - c.x ) - ( x - c.x ) * ( a.y - c.y );
382 return ( ( ( fAB * fBC ) > 0 ) && ( ( fBC * fCA ) > 0 ) );
405 GLS_EXPORT std::istream& operator>>( std::istream& instr, Vector& vert );
406 GLS_EXPORT std::ostream&
operator<<( std::ostream& outstr,
const Vector& vert );
418 color.
RGBA( DEF_FILL_RCOLOR, DEF_FILL_GCOLOR, DEF_FILL_BCOLOR, DEF_FILL_ALPHA );
425 color.
RGBA( DEF_FILL_RCOLOR, DEF_FILL_GCOLOR, DEF_FILL_BCOLOR, DEF_FILL_ALPHA );
442 color.
RGBA( DEF_FILL_RCOLOR, DEF_FILL_GCOLOR, DEF_FILL_BCOLOR, DEF_FILL_ALPHA );
455 unsigned char _r,
unsigned char _g,
unsigned char _b,
unsigned char _a )
458 color.
RGBA( _r, _g, _b, _a );
478 return Vertex( x + arg.x, y + arg.y, z + arg.z, color );
486 return Vertex( x * s, y * s, z * s, color );
518 return Vertex( x - arg.x, y - arg.y, z - arg.z, color );
524 return Vertex( -x, -y, -z, color );
533 return Vertex( x * arg.x, y * arg.y, z * arg.z, color );
564 PlaneClass(
float A,
float B,
float C,
float D )
574 DISTI_EXPORT std::istream& operator>>( std::istream& instr, Vertex& vert );
575 DISTI_EXPORT std::ostream&
operator<<( std::ostream& outstr,
const Vertex& vert );
585 DISTI_EXPORT
int IntersectionVectorAndPlane( VertexNoColor& point,
const Vector& lineVector,
const VertexNoColor& linePoint,
const Vector& planeNormal,
const Vector& planePoint );
605 DISTI_EXPORT VertexNoColor
ProjectedIntersectingPoint(
const VertexNoColor& p1,
const VertexNoColor& p2,
const VertexNoColor& p3 );
619 DISTI_EXPORT
bool LineHitsTriangle(
const Vector& origin,
const Vector& direction,
const Vector& v0,
const Vector& v1,
const Vector& v2, Vector* collisionPoint = 0 );
631 DISTI_EXPORT
bool RayHitsTriangle(
const Vector& origin,
const Vector& direction,
const Vector& v0,
const Vector& v1,
const Vector& v2, Vector* collisionPoint = 0 );
642 DISTI_EXPORT
void FindCollision(
const Vector& origin,
const Vector& vert1,
const Vector& vert2,
const Vector& vert3, VertexNoColor* collisionPoint,
const Vector& directionVector );
650 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:476
Vertex(const VertexNoColor &noColor)
Definition: vertex.h:422
VertexNoColor(float _x, float _y, float _z)
Definition: vertex.h:100
RotationAxis
Definition: vertex.h:73
Vertex(float _x, float _y, float _z, unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a)
Definition: vertex.h:454
VertexNoColor operator/(const float s) const
Definition: vertex.h:208
const double DEG_TO_RAD
Definition: vertex.h:61
float MagnitudeSquared() const
Definition: vertex.h:335
Vertex()
Definition: vertex.h:415
VertexNoColor operator+(const VertexNoColor &arg) const
Definition: vertex.h:175
VertexNoColor ProjectedIntersectingPoint(const VertexNoColor &p1, const VertexNoColor &p2, const VertexNoColor &p3)
void Normalize(void)
Definition: vertex.h:308
float DotProduct(const VertexNoColor &w) const
Definition: vertex.h:357
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:439
The Color class: Implements a 4 component RGBA color.
A file for all GL Studio files to include.
VertexNoColor()
Definition: vertex.h:90
bool PointInTriangle(const VertexNoColor &a, const VertexNoColor &b, const VertexNoColor &c) const
Definition: vertex.h:374
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:216
VertexNoColor & operator+=(const VertexNoColor &arg)
Definition: vertex.h:227
std::ostream & operator<<(std::ostream &outstr, const AttributeName &name)
Defines the stream out operator.
VertexNoColor operator-() const
Definition: vertex.h:181
Vertex CrossProduct(const VertexNoColor &w) const
Definition: vertex.h:542
bool operator==(const VertexNoColor &arg) const
Definition: vertex.h:258
VertexNoColor operator*(const float s) const
Definition: vertex.h:189
float Distance2Squared(const VertexNoColor &v) const
Definition: vertex.h:159
const double RAD_TO_DEG
Definition: vertex.h:64
VertexNoColor Vector
Definition: gls_font_base.h:66
Vertex operator*(const VertexNoColor &arg) const
Definition: vertex.h:531
GL Studio Enumerations and constants.
Vertex(const VertexNoColor &noColor, const GlsColor &_color)
Definition: vertex.h:429
Vertex Rotate(const float angle) const
VertexNoColor CrossProduct(const VertexNoColor &w) const
Definition: vertex.h:346
Vertex operator-() const
Definition: vertex.h:522
PlaneClass(void)
Definition: vertex.h:556
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:276
VertexNoColor Rotate(const float angle) const
float Distance2(const VertexNoColor &v) const
Definition: vertex.h:167
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:484
float Magnitude() const
Definition: vertex.h:327
float Distance3Squared(const VertexNoColor &v) const
Definition: vertex.h:110
VertexNoColor & operator*=(const float s)
Definition: vertex.h:197
bool operator!=(const VertexNoColor &arg) const
Definition: vertex.h:267
float Distance3(const VertexNoColor &v) const
Definition: vertex.h:150
VertexNoColor operator-(const VertexNoColor &arg) const
Definition: vertex.h:238
float AngleToVector(const VertexNoColor &arg) const
Vertex(float _x, float _y, float _z, const GlsColor &_color)
Definition: vertex.h:467
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:122
Definition: bmpimage.h:46
VertexNoColor & operator-=(const VertexNoColor &arg)
Definition: vertex.h:246
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:516
void RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
Definition: gls_color.h:168