HOG2
Classes | Macros | Functions | Variables
GLUtil.h File Reference
#include "FPUtil.h"
#include <ostream>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <GL/gl.h>
#include "Colors.h"
#include "Graphics.h"
Include dependency graph for GLUtil.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  recVec
 A generic vector (essentially the same as a point, but offers normalization) More...
 
class  line2d
 ‍** More...
 

Macros

#define point3d   Graphics::point
 

Functions

bool operator== (const recVec &l1, const recVec &l2)
 
std::ostream & operator<< (std::ostream &out, const recVec &loc)
 
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 width. More...
 
void DrawBox (GLfloat x, GLfloat y, GLfloat z, GLfloat radius)
 
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 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)
 
void DrawSquare (GLdouble _x, GLdouble _y, GLdouble _z, GLdouble tRadius)
 
void DrawCylinder (GLfloat xx, GLfloat yy, GLfloat zz, GLfloat innerRad, GLfloat outerRad, GLfloat height)
 
void OutlineRect (GLdouble left, GLdouble top, GLdouble right, GLdouble bottom, double zz)
 
void DrawText (double x, double y, double z, double scale, const char *res)
 
void DrawTextCentered (double x, double y, double z, double scale, const char *res)
 
void SetLighting (GLfloat ambientf=0.2f, GLfloat diffusef=1.0f, GLfloat specularf=1.0f)
 
template<typename T >
std::string to_string_with_precision (const T a_value, const int n=6)
 

Variables

static const double ONE = 1.0
 
static const double TWO = 2.0
 
static const double ROOT_TWO = 1.414213562
 
static const double ONE_OVER_ROOT_TWO = 1.0/ROOT_TWO
 
static const double ROOT_THREE = 1.732050808
 
static const double TWOPI = 6.283185307179586476925287
 
static const double PI = 3.141592653589793238462643
 
static const double PID180 = PI/180
 
static const double PID2 = PI/2
 
static const double PID3 = PI/3
 
static const double PID4 = PI/4
 
static const double PID6 = PI/6
 
static const double PID8 = PI/8
 
static const double ROOT2D2 = 0.7071067811865475
 

Macro Definition Documentation

◆ point3d

#define point3d   Graphics::point

Definition at line 123 of file GLUtil.h.

Function Documentation

◆ DrawBox()

void DrawBox ( GLfloat  x,
GLfloat  y,
GLfloat  z,
GLfloat  radius 
)

◆ DrawBoxFrame()

void DrawBoxFrame ( GLfloat  xx,
GLfloat  yy,
GLfloat  zz,
GLfloat  rad 
)

Definition at line 252 of file GLUtil.cpp.

Referenced by AirplaneEnvironment::OpenGLDraw(), and Voxels::OpenGLDraw().

◆ DrawCircle()

void DrawCircle ( GLdouble  _x,
GLdouble  _y,
GLdouble  tRadius,
int  segments = 32,
float  rotation = 0 
)

Definition at line 421 of file GLUtil.cpp.

References rotation, and TWOPI.

Referenced by DoDrawCommands(), DrawGraphics(), and DrawLines().

◆ DrawCylinder()

void DrawCylinder ( GLfloat  xx,
GLfloat  yy,
GLfloat  zz,
GLfloat  innerRad,
GLfloat  outerRad,
GLfloat  height 
)

Definition at line 309 of file GLUtil.cpp.

References height, and TWOPI.

Referenced by AirplaneEnvironment::OpenGLDraw(), and TOH< patternDisks >::OpenGLDraw().

◆ DrawPyramid()

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 width.

Definition at line 185 of file GLUtil.cpp.

References height, ROOT2D2, and width.

Referenced by SearchUnit::OpenGLDraw().

◆ DrawSphere()

void DrawSphere ( GLdouble  _x,
GLdouble  _y,
GLdouble  _z,
GLdouble  tRadius 
)

◆ DrawSquare()

void DrawSquare ( GLdouble  _x,
GLdouble  _y,
GLdouble  _z,
GLdouble  tRadius 
)

◆ DrawText()

void DrawText ( double  x,
double  y,
double  z,
double  scale,
const char *  res 
)

◆ DrawTextCentered()

void DrawTextCentered ( double  x,
double  y,
double  z,
double  scale,
const char *  res 
)

Definition at line 542 of file GLUtil.cpp.

References width.

Referenced by DrawGraphics(), CanonicalGraphEnvironment::OpenGLDraw(), and GraphEnvironment::OpenGLDraw().

◆ FrameCircle()

void FrameCircle ( GLdouble  _x,
GLdouble  _y,
GLdouble  tRadius,
GLdouble  lineWidth,
int  segments = 32,
float  rotation = 0 
)

Definition at line 407 of file GLUtil.cpp.

References rotation, and TWOPI.

Referenced by DoDrawCommands(), and DrawGraphics().

◆ operator<<()

std::ostream& operator<< ( std::ostream &  out,
const recVec loc 
)

Definition at line 27 of file GLUtil.cpp.

References loc::x, and loc::y.

◆ operator==()

bool operator== ( const recVec l1,
const recVec l2 
)

Definition at line 22 of file GLUtil.cpp.

References fequal(), recVec::x, and recVec::y.

◆ OutlineRect()

void OutlineRect ( GLdouble  left,
GLdouble  top,
GLdouble  right,
GLdouble  bottom,
double  zz 
)

◆ SetLighting()

void SetLighting ( GLfloat  ambientf = 0.2f,
GLfloat  diffusef = 1.0f,
GLfloat  specularf = 1.0f 
)

Definition at line 565 of file GLUtil.cpp.

◆ to_string_with_precision()

template<typename T >
std::string to_string_with_precision ( const T  a_value,
const int  n = 6 
)

Variable Documentation

◆ ONE

const double ONE = 1.0
static

Definition at line 59 of file GLUtil.h.

◆ ONE_OVER_ROOT_TWO

const double ONE_OVER_ROOT_TWO = 1.0/ROOT_TWO
static

Definition at line 62 of file GLUtil.h.

Referenced by GraphEnvironment::DrawStateLabel().

◆ PI

const double PI = 3.141592653589793238462643
static

◆ PID180

const double PID180 = PI/180
static

Definition at line 67 of file GLUtil.h.

◆ PID2

const double PID2 = PI/2
static

Definition at line 68 of file GLUtil.h.

Referenced by DrawSphere().

◆ PID3

const double PID3 = PI/3
static

Definition at line 69 of file GLUtil.h.

◆ PID4

const double PID4 = PI/4
static

Definition at line 70 of file GLUtil.h.

◆ PID6

const double PID6 = PI/6
static

Definition at line 71 of file GLUtil.h.

◆ PID8

const double PID8 = PI/8
static

Definition at line 72 of file GLUtil.h.

◆ ROOT2D2

const double ROOT2D2 = 0.7071067811865475
static

Definition at line 73 of file GLUtil.h.

Referenced by DrawPyramid().

◆ ROOT_THREE

const double ROOT_THREE = 1.732050808
static

Definition at line 63 of file GLUtil.h.

Referenced by VoxelGrid::GCost(), and VoxelGrid::HCost().

◆ ROOT_TWO

const double ROOT_TWO = 1.414213562
static

◆ TWO

const double TWO = 2.0
static

Definition at line 60 of file GLUtil.h.

◆ TWOPI

const double TWOPI = 6.283185307179586476925287
static