39#ifndef INCLUDED_GLS_VERTEX_H
40#define INCLUDED_GLS_VERTEX_H
56# define M_PI 3.14159265358979323846
113 return ( ( v.
x -
x ) * ( v.
x -
x ) ) + ( ( v.
y -
y ) * ( v.
y -
y ) ) + ( ( v.
z -
z ) * ( v.
z -
z ) );
136 float fT = kDiff.
DotProduct( direction ) / fSqrLen;
139 kDiff.
x -= direction.
x * fT;
140 kDiff.
y -= direction.
y * fT;
141 kDiff.
z -= direction.
z * fT;
153 return float( sqrt( ( ( v.
x -
x ) * ( v.
x -
x ) ) + ( ( v.
y -
y ) * ( v.
y -
y ) ) + ( ( v.
z -
z ) * ( v.
z -
z ) ) ) );
162 return ( ( v.
x -
x ) * ( v.
x -
x ) ) + ( ( v.
y -
y ) * ( v.
y -
y ) );
170 return float( sqrt( ( ( v.
x -
x ) * ( v.
x -
x ) ) + ( ( v.
y -
y ) * ( v.
y -
y ) ) ) );
262 return ( (
x == arg.
x ) && (
y == arg.
y ) && (
z == arg.
z ) );
271 return ( (
x != arg.
x ) || (
y != arg.
y ) || (
z != arg.
z ) );
312 float length, inv_length;
318 inv_length = 1.0f / length;
331 return float( sqrt( ( (
x ) * (
x ) ) + ( (
y ) * (
y ) ) + ( (
z ) * (
z ) ) ) );
339 return x *
x +
y *
y +
z *
z;
351 (
z * w.
x ) - (
x * w.
z ),
352 (
x * w.
y ) - (
y * w.
x ) );
361 return ( (
x * w.
x ) + (
y * w.
y ) + (
z * w.
z ) );
380 fAB = (
y - a.
y ) * ( b.
x - a.
x ) - (
x - a.
x ) * ( b.
y - a.
y );
381 fBC = (
y - b.
y ) * ( c.
x - b.
x ) - (
x - b.
x ) * ( c.
y - b.
y );
382 fCA = (
y - c.
y ) * ( a.
x - c.
x ) - (
x - c.
x ) * ( a.
y - c.
y );
384 return ( ( ( fAB * fBC ) > 0 ) && ( ( fBC * fCA ) > 0 ) );
467 unsigned char _r,
unsigned char _g,
unsigned char _b,
unsigned char _a )
Definition: gls_color.h:53
void RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
Definition: gls_color.h:172
PlaneClass(float A, float B, float C, float D)
Definition: vertex.h:587
float d
A coefficient to describe a 3D plane: aX + bY + cZ + d = 0.
Definition: vertex.h:572
float a
A coefficient to describe a 3D plane: aX + bY + cZ + d = 0.
Definition: vertex.h:569
float b
A coefficient to describe a 3D plane: aX + bY + cZ + d = 0.
Definition: vertex.h:570
float c
A coefficient to describe a 3D plane: aX + bY + cZ + d = 0.
Definition: vertex.h:571
float AngleToVector(const VertexNoColor &arg) const
VertexNoColor operator+(const VertexNoColor &arg) const
Definition: vertex.h:176
VertexNoColor & operator+=(const VertexNoColor &arg)
Definition: vertex.h:229
VertexNoColor CrossProduct(const VertexNoColor &w) const
Definition: vertex.h:348
VertexNoColor operator*(const VertexNoColor &arg) const
Definition: vertex.h:278
VertexNoColor Rotate(const float angle) const
VertexNoColor operator-() const
Definition: vertex.h:183
float DotProduct(const VertexNoColor &w) const
Definition: vertex.h:359
VertexNoColor & operator/=(const float s)
Definition: vertex.h:218
float Distance2Squared(const VertexNoColor &v) const
Definition: vertex.h:160
VertexNoColor operator/(const float s) const
Definition: vertex.h:210
float Distance2(const VertexNoColor &v) const
Definition: vertex.h:168
VertexNoColor operator*(const float s) const
Definition: vertex.h:191
float MagnitudeSquared() const
Definition: vertex.h:337
bool operator==(const VertexNoColor &arg) const
Definition: vertex.h:260
float DistanceFromLineSquared(const float startx, const float starty, const float startz, const VertexNoColor &direction) const
Definition: vertex.h:123
float Distance3Squared(const VertexNoColor &v) const
Definition: vertex.h:111
VertexNoColor & operator*=(const float s)
Definition: vertex.h:199
float y
The Y component.
Definition: vertex.h:87
VertexNoColor()
Definition: vertex.h:91
float DistanceFromLine(const VertexNoColor &start, const VertexNoColor &direction) const
VertexNoColor(float _x, float _y, float _z)
Definition: vertex.h:101
bool CloseTo(const VertexNoColor &arg, float tolerance=0.0001f) const
VertexNoColor operator-(const VertexNoColor &arg) const
Definition: vertex.h:240
float x
The X component.
Definition: vertex.h:86
VertexNoColor & operator-=(const VertexNoColor &arg)
Definition: vertex.h:248
bool operator!=(const VertexNoColor &arg) const
Definition: vertex.h:269
float Magnitude() const
Definition: vertex.h:329
float Distance3(const VertexNoColor &v) const
Definition: vertex.h:151
void Normalize()
Definition: vertex.h:310
bool PointInTriangle(const VertexNoColor &a, const VertexNoColor &b, const VertexNoColor &c) const
Definition: vertex.h:376
VertexNoColor ProjectPointToLine(const VertexNoColor &origin, const VertexNoColor &direction) const
float z
The Z component.
Definition: vertex.h:88
Vertex Rotate(const float angle) const
Vertex operator*(const VertexNoColor &arg) const
Definition: vertex.h:546
Vertex()
Simple constructor. Ensures all values are initialized.
Definition: vertex.h:424
Vertex(float _x, float _y, float _z, const GlsColor &_color)
Definition: vertex.h:479
Vertex(const VertexNoColor &noColor, const GlsColor &_color)
Definition: vertex.h:441
Vertex operator-(const VertexNoColor &arg) const
Definition: vertex.h:530
Vertex(const VertexNoColor &noColor)
Definition: vertex.h:432
Vertex operator+(const VertexNoColor &arg) const
Definition: vertex.h:488
Vertex operator*(const float s) const
Definition: vertex.h:496
GlsColor color
The RGBA color component.
Definition: vertex.h:421
Vertex(float _x, float _y, float _z, unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a)
Definition: vertex.h:466
Vertex(float _x, float _y, float _z)
Definition: vertex.h:451
Vertex operator-() const
Definition: vertex.h:537
Vertex CrossProduct(const VertexNoColor &w) const
Definition: vertex.h:557
GL Studio Enumerations and constants.
#define DEF_FILL_RCOLOR
Default red channel for object fill.
Definition: display_types.h:162
#define DEF_FILL_BCOLOR
Default blue channel for object fill.
Definition: display_types.h:164
#define DEF_FILL_ALPHA
Default alpha channel for object fill.
Definition: display_types.h:165
#define DEF_FILL_GCOLOR
Default green channel for object fill.
Definition: display_types.h:163
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:50
Definition: bmpimage.h:46
const double RAD_TO_DEG
Definition: vertex.h:63
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:73
@ Z_AXIS
Definition: vertex.h:76
@ X_AXIS
Definition: vertex.h:74
@ Y_AXIS
Definition: vertex.h:75
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:60
VertexNoColor Vector
Definition: gls_font_base.h:68
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:56