52 #define M_PI 3.14159265358979323846
57 #define DEG_TO_RAD (M_PI/180.0)
70 typedef VertexNoColor
Vector;
112 {
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;
150 {
return float(sqrt( ((v.x-x)*(v.x-x)) + ((v.y-y)*(v.y-y)) + ((v.z-z)*(v.z-z)))); }
157 {
return ((v.x-x)*(v.x-x))+ ((v.y-y)*(v.y-y)); }
163 {
return float(sqrt(((v.x-x)*(v.x-x))+ ((v.y-y)*(v.y-y)))); }
185 { x *= s; y *= s; z *= s;
198 { x /= s; y /= s; z /= s;
205 { x += arg.x; y += arg.y; z += arg.z;
218 { x -= arg.x; y -= arg.y; z -= arg.z;
226 {
return ((x == arg.x) && (y == arg.y) && (z == arg.z)); }
233 {
return ((x != arg.x) || (y != arg.y) || (z != arg.z)); }
273 float length, inv_length;
279 inv_length = 1.0f / length;
291 {
return float( sqrt( ((x)*(x)) + ((y)*(y)) + ((z)*(z))) ); }
297 {
return x*x + y*y + z*z; }
307 (z * w.x) - (x * w.z),
308 (x * w.y) - (y * w.x));
316 {
return ((x * w.x) + (y * w.y) + (z * w.z)); }
334 fAB = (y-a.y)*(b.x-a.x) - (x-a.x)*(b.y-a.y);
335 fBC = (y-b.y)*(c.x-b.x) - (x-b.x)*(c.y-b.y);
336 fCA = (y-c.y)*(a.x-c.x) - (x-c.x)*(a.y-c.y);
338 return (((fAB*fBC) > 0) && ((fBC*fCA) > 0));
361 GLS_EXPORT std::istream& operator>>(std::istream& instr, Vector& vert) ;
362 GLS_EXPORT std::ostream& operator<<(std::ostream& outstr,
const Vector& vert);
374 color.
RGBA(DEF_FILL_RCOLOR,DEF_FILL_GCOLOR,DEF_FILL_BCOLOR,DEF_FILL_ALPHA);
380 color.
RGBA(DEF_FILL_RCOLOR,DEF_FILL_GCOLOR,DEF_FILL_BCOLOR,DEF_FILL_ALPHA);
395 color.
RGBA(DEF_FILL_RCOLOR,DEF_FILL_GCOLOR,DEF_FILL_BCOLOR,DEF_FILL_ALPHA);
408 unsigned char _r,
unsigned char _g,
unsigned char _b,
unsigned char _a) :
411 color.
RGBA(_r,_g,_b,_a);
430 {
return Vertex(x + arg.x,y + arg.y,z + arg.z, color); }
436 {
return Vertex(x*s,y*s,z*s, color); }
466 {
return Vertex(x - arg.x,y - arg.y,z - arg.z, color); }
470 {
return Vertex(-x,-y,-z,color); }
478 return Vertex(x * arg.x,y * arg.y,z * arg.z, color);
502 PlaneClass(
float A,
float B,
float C,
float D) { a = A; b = B; c = C; d = D; }
506 DISTI_EXPORT std::istream& operator>>(std::istream& instr, Vertex& vert) ;
507 DISTI_EXPORT std::ostream& operator<<(std::ostream& outstr,
const Vertex& vert);
517 DISTI_EXPORT
int IntersectionVectorAndPlane(VertexNoColor &point,
const Vector &lineVector,
const VertexNoColor &linePoint,
const Vector &planeNormal,
const Vector &planePoint);
538 DISTI_EXPORT VertexNoColor
ProjectedIntersectingPoint(
const VertexNoColor& p1,
const VertexNoColor& p2,
const VertexNoColor& p3);
552 DISTI_EXPORT
bool LineHitsTriangle(
const Vector &origin,
const Vector &direction,
const Vector &v0,
const Vector &v1,
const Vector &v2,Vector *collisionPoint = 0);
564 DISTI_EXPORT
bool RayHitsTriangle(
const Vector &origin,
const Vector &direction,
const Vector &v0,
const Vector &v1,
const Vector &v2,Vector *collisionPoint = 0);
575 DISTI_EXPORT
void FindCollision(
const Vector &origin,
const Vector &vert1,
const Vector &vert2,
const Vector &vert3, VertexNoColor *collisionPoint,
const Vector &directionVector);
583 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:429
Vertex(const VertexNoColor &noColor)
Definition: vertex.h:378
VertexNoColor(float _x, float _y, float _z)
Definition: vertex.h:101
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:407
VertexNoColor operator/(const float s) const
Definition: vertex.h:191
float MagnitudeSquared() const
Definition: vertex.h:296
Vertex()
Definition: vertex.h:372
VertexNoColor operator+(const VertexNoColor &arg) const
Definition: vertex.h:168
VertexNoColor ProjectedIntersectingPoint(const VertexNoColor &p1, const VertexNoColor &p2, const VertexNoColor &p3)
void Normalize(void)
Definition: vertex.h:271
Vertex(const VertexNoColor &noColor, const glsColor &_color)
Definition: vertex.h:384
float DotProduct(const VertexNoColor &w) const
Definition: vertex.h:315
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:393
The Color class: Implements a 4 component RGBA color.
A file for all GL Studio files to include.
VertexNoColor()
Definition: vertex.h:91
bool PointInTriangle(const VertexNoColor &a, const VertexNoColor &b, const VertexNoColor &c) const
Definition: vertex.h:330
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:197
VertexNoColor & operator+=(const VertexNoColor &arg)
Definition: vertex.h:204
VertexNoColor operator-() const
Definition: vertex.h:172
Vertex CrossProduct(const VertexNoColor &w) const
Definition: vertex.h:487
bool operator==(const VertexNoColor &arg) const
Definition: vertex.h:225
VertexNoColor operator*(const float s) const
Definition: vertex.h:178
float Distance2Squared(const VertexNoColor &v) const
Definition: vertex.h:156
Vertex(float _x, float _y, float _z, const glsColor &_color)
Definition: vertex.h:420
VertexNoColor Vector
Definition: gls_font_base.h:68
GL Studio Enumerations and constants.
Vertex Rotate(const float angle) const
VertexNoColor CrossProduct(const VertexNoColor &w) const
Definition: vertex.h:305
Vertex operator-() const
Definition: vertex.h:469
PlaneClass(void)
Definition: vertex.h:500
int IntersectionVectorAndPlane(VertexNoColor &point, const Vector &lineVector, const VertexNoColor &linePoint, const Vector &planeNormal, const Vector &planePoint)
VertexNoColor Rotate(const float angle) const
float Distance2(const VertexNoColor &v) const
Definition: vertex.h:162
Definition: gls_color.h:54
void RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Definition: gls_color.h:164
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:435
float Magnitude() const
Definition: vertex.h:290
float Distance3Squared(const VertexNoColor &v) const
Definition: vertex.h:111
VertexNoColor & operator*=(const float s)
Definition: vertex.h:184
bool operator!=(const VertexNoColor &arg) const
Definition: vertex.h:232
float Distance3(const VertexNoColor &v) const
Definition: vertex.h:149
float AngleToVector(const VertexNoColor &arg) const
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:217
bool RayHitsTriangle(const Vector &origin, const Vector &direction, const Vector &v0, const Vector &v1, const Vector &v2, Vector *collisionPoint=0)