40#ifndef INCLUDED_GLS_VERTEX_H
41#define INCLUDED_GLS_VERTEX_H
57# define M_PI 3.14159265358979323846
114 return ( ( v.
x -
x ) * ( v.
x -
x ) ) + ( ( v.
y -
y ) * ( v.
y -
y ) ) + ( ( v.
z -
z ) * ( v.
z -
z ) );
137 float fT = kDiff.
DotProduct( direction ) / fSqrLen;
140 kDiff.
x -= direction.
x * fT;
141 kDiff.
y -= direction.
y * fT;
142 kDiff.
z -= direction.
z * fT;
154 return float( sqrt( ( ( v.
x -
x ) * ( v.
x -
x ) ) + ( ( v.
y -
y ) * ( v.
y -
y ) ) + ( ( v.
z -
z ) * ( v.
z -
z ) ) ) );
163 return ( ( v.
x -
x ) * ( v.
x -
x ) ) + ( ( v.
y -
y ) * ( v.
y -
y ) );
171 return float( sqrt( ( ( v.
x -
x ) * ( v.
x -
x ) ) + ( ( v.
y -
y ) * ( v.
y -
y ) ) ) );
263 return ( (
x == arg.
x ) && (
y == arg.
y ) && (
z == arg.
z ) );
272 return ( (
x != arg.
x ) || (
y != arg.
y ) || (
z != arg.
z ) );
313 float length, inv_length;
319 inv_length = 1.0f / length;
332 return float( sqrt( ( (
x ) * (
x ) ) + ( (
y ) * (
y ) ) + ( (
z ) * (
z ) ) ) );
340 return x *
x +
y *
y +
z *
z;
352 (
z * w.
x ) - (
x * w.
z ),
353 (
x * w.
y ) - (
y * w.
x ) );
362 return ( (
x * w.
x ) + (
y * w.
y ) + (
z * w.
z ) );
381 fAB = (
y - a.
y ) * ( b.
x - a.
x ) - (
x - a.
x ) * ( b.
y - a.
y );
382 fBC = (
y - b.
y ) * ( c.
x - b.
x ) - (
x - b.
x ) * ( c.
y - b.
y );
383 fCA = (
y - c.
y ) * ( a.
x - c.
x ) - (
x - c.
x ) * ( a.
y - c.
y );
385 return ( ( ( fAB * fBC ) > 0 ) && ( ( fBC * fCA ) > 0 ) );
468 unsigned char _r,
unsigned char _g,
unsigned char _b,
unsigned char _a )
Definition: gls_color.h:54
void RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
Definition: gls_color.h:169
PlaneClass(float A, float B, float C, float D)
Definition: vertex.h:588
float d
A coefficient to describe a 3D plane: aX + bY + cZ + d = 0.
Definition: vertex.h:573
float a
A coefficient to describe a 3D plane: aX + bY + cZ + d = 0.
Definition: vertex.h:570
float b
A coefficient to describe a 3D plane: aX + bY + cZ + d = 0.
Definition: vertex.h:571
float c
A coefficient to describe a 3D plane: aX + bY + cZ + d = 0.
Definition: vertex.h:572
float AngleToVector(const VertexNoColor &arg) const
VertexNoColor operator+(const VertexNoColor &arg) const
Definition: vertex.h:177
VertexNoColor & operator+=(const VertexNoColor &arg)
Definition: vertex.h:230
VertexNoColor CrossProduct(const VertexNoColor &w) const
Definition: vertex.h:349
VertexNoColor operator*(const VertexNoColor &arg) const
Definition: vertex.h:279
VertexNoColor Rotate(const float angle) const
VertexNoColor operator-() const
Definition: vertex.h:184
float DotProduct(const VertexNoColor &w) const
Definition: vertex.h:360
VertexNoColor & operator/=(const float s)
Definition: vertex.h:219
float Distance2Squared(const VertexNoColor &v) const
Definition: vertex.h:161
VertexNoColor operator/(const float s) const
Definition: vertex.h:211
float Distance2(const VertexNoColor &v) const
Definition: vertex.h:169
VertexNoColor operator*(const float s) const
Definition: vertex.h:192
float MagnitudeSquared() const
Definition: vertex.h:338
bool operator==(const VertexNoColor &arg) const
Definition: vertex.h:261
float DistanceFromLineSquared(const float startx, const float starty, const float startz, const VertexNoColor &direction) const
Definition: vertex.h:124
float Distance3Squared(const VertexNoColor &v) const
Definition: vertex.h:112
VertexNoColor & operator*=(const float s)
Definition: vertex.h:200
float y
The Y component.
Definition: vertex.h:88
VertexNoColor()
Definition: vertex.h:92
float DistanceFromLine(const VertexNoColor &start, const VertexNoColor &direction) const
VertexNoColor(float _x, float _y, float _z)
Definition: vertex.h:102
bool CloseTo(const VertexNoColor &arg, float tolerance=0.0001f) const
VertexNoColor operator-(const VertexNoColor &arg) const
Definition: vertex.h:241
float x
The X component.
Definition: vertex.h:87
VertexNoColor & operator-=(const VertexNoColor &arg)
Definition: vertex.h:249
bool operator!=(const VertexNoColor &arg) const
Definition: vertex.h:270
float Magnitude() const
Definition: vertex.h:330
float Distance3(const VertexNoColor &v) const
Definition: vertex.h:152
void Normalize()
Definition: vertex.h:311
bool PointInTriangle(const VertexNoColor &a, const VertexNoColor &b, const VertexNoColor &c) const
Definition: vertex.h:377
VertexNoColor ProjectPointToLine(const VertexNoColor &origin, const VertexNoColor &direction) const
float z
The Z component.
Definition: vertex.h:89
Vertex Rotate(const float angle) const
Vertex operator*(const VertexNoColor &arg) const
Definition: vertex.h:547
Vertex()
Simple constructor. Ensures all values are initialized.
Definition: vertex.h:425
Vertex(float _x, float _y, float _z, const GlsColor &_color)
Definition: vertex.h:480
Vertex(const VertexNoColor &noColor, const GlsColor &_color)
Definition: vertex.h:442
Vertex operator-(const VertexNoColor &arg) const
Definition: vertex.h:531
Vertex(const VertexNoColor &noColor)
Definition: vertex.h:433
Vertex operator+(const VertexNoColor &arg) const
Definition: vertex.h:489
Vertex operator*(const float s) const
Definition: vertex.h:497
GlsColor color
The RGBA color component.
Definition: vertex.h:422
Vertex(float _x, float _y, float _z, unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a)
Definition: vertex.h:467
Vertex(float _x, float _y, float _z)
Definition: vertex.h:452
Vertex operator-() const
Definition: vertex.h:538
Vertex CrossProduct(const VertexNoColor &w) const
Definition: vertex.h:558
GL Studio Enumerations and constants.
#define DEF_FILL_RCOLOR
Default red channel for object fill.
Definition: display_types.h:163
#define DEF_FILL_BCOLOR
Default blue channel for object fill.
Definition: display_types.h:165
#define DEF_FILL_ALPHA
Default alpha channel for object fill.
Definition: display_types.h:166
#define DEF_FILL_GCOLOR
Default green channel for object fill.
Definition: display_types.h:164
A file for all GL Studio files to include.
The Color class: Implements a 4 component RGBA color.
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47
const double RAD_TO_DEG
Definition: vertex.h:64
VertexNoColor Normal(const VertexNoColor &p1, const VertexNoColor &p2, const VertexNoColor &p3)
std::ostream & operator<<(std::ostream &outstr, const AttributeName &name)
bool RayHitsTriangle(const Vector &origin, const Vector &direction, const Vector &v0, const Vector &v1, const Vector &v2, Vector *collisionPoint=0)
RotationAxis
Definition: vertex.h:74
@ Z_AXIS
Definition: vertex.h:77
@ X_AXIS
Definition: vertex.h:75
@ Y_AXIS
Definition: vertex.h:76
bool LineHitsTriangle(const Vector &origin, const Vector &direction, const Vector &v0, const Vector &v1, const Vector &v2, Vector *collisionPoint=0)
const double DEG_TO_RAD
Definition: vertex.h:61
VertexNoColor Vector
Definition: gls_font_base.h:69
void FindCollision(const Vector &origin, const Vector &vert1, const Vector &vert2, const Vector &vert3, VertexNoColor *collisionPoint, const Vector &directionVector)
std::istream & operator>>(std::istream &instr, GlsColor &color)
VertexNoColor ProjectedIntersectingPoint(const VertexNoColor &p1, const VertexNoColor &p2, const VertexNoColor &p3)
int IntersectionVectorAndPlane(VertexNoColor &point, const Vector &lineVector, const VertexNoColor &linePoint, const Vector &planeNormal, const Vector &planePoint)
The DistiUnhideGlobalsDummyClass class.
#define M_PI
The value of PI.
Definition: vertex.h:57