Go to the documentation of this file.
34 #include <OpenGL/gl.h>
59 static const double ONE = 1.0;
60 static const double TWO = 2.0;
65 static const double TWOPI = 6.283185307179586476925287;
66 static const double PI = 3.141592653589793238462643;
73 static const double ROOT2D2 = 0.7071067811865475;
81 recVec(GLdouble x_i, GLdouble y_i, GLdouble z_i) :
x(x_i),
y(y_i),
z(z_i) {}
91 n.
x = this->
y * v.
z - this->
z * v.
y;
92 n.
y = this->
z * v.
x - this->
x * v.
z;
93 n.
z = this->
x * v.
y - this->
y * v.
x;
100 {
x += v.
x;
y += v.
y;
z += v.
z;
return *
this; }
102 {
x -= v.
x;
y -= v.
y;
z -= v.
z;
return *
this; }
104 {
recVec n = *
this; n-=v;
return n; }
106 {
x *= val;
y *= val;
z *= val;
return *
this; }
110 result.
x = this->y*val.
z - this->z*val.
y;
111 result.
y = this->z*val.
x - this->x*val.
z;
112 result.
z = this->x*val.
y - this->y*val.
x;
123 #define point3d Graphics::point
169 void DrawBox(GLfloat x, GLfloat y, GLfloat z, GLfloat radius);
170 void DrawBoxFrame(GLfloat xx, GLfloat yy, GLfloat zz, GLfloat rad);
171 void DrawCircle(GLdouble _x, GLdouble _y, GLdouble tRadius,
int segments = 32,
float rotation = 0);
172 void FrameCircle(GLdouble _x, GLdouble _y, GLdouble tRadius, GLdouble lineWidth,
int segments = 32,
float rotation = 0);
173 void DrawSphere(GLdouble _x, GLdouble _y, GLdouble _z, GLdouble tRadius);
174 void DrawSquare(GLdouble _x, GLdouble _y, GLdouble _z, GLdouble tRadius);
175 void DrawCylinder(GLfloat xx, GLfloat yy, GLfloat zz, GLfloat innerRad, GLfloat outerRad, GLfloat
height);
176 void OutlineRect(GLdouble left, GLdouble top, GLdouble right, GLdouble bottom,
double zz);
178 void DrawText(
double x,
double y,
double z,
double scale,
const char *res);
179 void DrawTextCentered(
double x,
double y,
double z,
double scale,
const char *res);
181 void SetLighting(GLfloat ambientf = 0.2f, GLfloat diffusef = 1.0f, GLfloat specularf = 1.0f);
184 template <
typename T>
187 std::ostringstream out;
189 out << std::fixed << a_value;
recVec GetNormal(recVec v)
recVec & operator-=(const recVec &v)
void DrawTextCentered(double x, double y, double z, double scale, const char *res)
A generic vector (essentially the same as a point, but offers normalization)
void DrawPyramid(GLfloat x, GLfloat y, GLfloat z, GLfloat height, GLfloat width)
Draw a pyramid with the tip at the given location, given height, and width from center to edge as wid...
recVec operator-(const recVec &v)
void DrawBoxFrame(GLfloat xx, GLfloat yy, GLfloat zz, GLfloat rad)
void DrawCircle(GLdouble _x, GLdouble _y, GLdouble tRadius, int segments=32, float rotation=0)
void DrawBox(GLfloat x, GLfloat y, GLfloat z, GLfloat radius)
void SetLighting(GLfloat ambientf=0.2f, GLfloat diffusef=1.0f, GLfloat specularf=1.0f)
line2d(recVec a, recVec b)
void DrawCylinder(GLfloat xx, GLfloat yy, GLfloat zz, GLfloat innerRad, GLfloat outerRad, GLfloat height)
std::string to_string_with_precision(const T a_value, const int n=6)
void FrameCircle(GLdouble _x, GLdouble _y, GLdouble tRadius, GLdouble lineWidth, int segments=32, float rotation=0)
void DrawSphere(GLdouble _x, GLdouble _y, GLdouble _z, GLdouble tRadius)
recVec & operator+=(const recVec &v)
void DrawSquare(GLdouble _x, GLdouble _y, GLdouble _z, GLdouble tRadius)
std::ostream & operator<<(std::ostream &out, const recVec &loc)
static const double ROOT_TWO
void DrawText(double x, double y, double z, double scale, const char *res)
bool crosses(line2d which) const
void OutlineRect(GLdouble left, GLdouble top, GLdouble right, GLdouble bottom, double zz)
recVec(GLdouble x_i, GLdouble y_i, GLdouble z_i)
static const double PID180
static const double ROOT_THREE
recVec & operator*=(GLdouble val)
static const double TWOPI
static const double ROOT2D2
static const double ONE_OVER_ROOT_TWO
bool operator==(const recVec &l1, const recVec &l2)
void normalise()
Normalize a vector.
recVec operator*(const recVec &val) const