ContRap-Libraries
Public Member Functions | Protected Attributes

crp::GLPrimitive Class Reference

Class GLPrimitive represents all OpenGL geometric primitives. More...

#include <glprimitive.h>

Inheritance diagram for crp::GLPrimitive:
crp::GLCSystem crp::GLCube crp::GLCuboid crp::GLDisk crp::GLIndexTriangle crp::GLLine crp::GLMesh crp::GLPicture crp::GLPlane crp::GLPoint crp::GLPointList crp::GLScene crp::GLSphere crp::GLSquare crp::GLSTLModel crp::GLSurface crp::GLText crp::GLTorus crp::GLTriangle

Public Member Functions

 GLPrimitive (const GLVertex &position, double yaw=0.0, double pitch=0.0, double roll=0.0)
 Initializes a primitive given the coordinates of the center point.
virtual ~GLPrimitive ()
 Virtual destructor.
virtual void make_display_list (int flags=GL_NO_STYLE) const =0
 Performs operations needed to create a display list of the model.
void draw (int flags=GL_NO_STYLE) const
 Drawing method is the same for each primitive.
void set_color (double r, double g, double b)
 Sets the line color.
double get_r () const
 Returns the red line color of the primitive.
double get_g () const
 Returns the green line color of the primitive.
double get_b () const
 Returns the blue line color of the primitive.
void set_outline_color (double r, double g, double b)
 Sets the outline color.
double get_line_r () const
 Returns the red outline color of the primitive.
double get_line_g () const
 Returns the green outline color of the primitive.
double get_line_b () const
 Returns the blue outline color of the primitive.
virtual GLPrimitiveType get_type () const =0
 Type of the primitive.
void set_style (int style)
 Sets the objects style.
int get_style () const
 Returns the style of the object.
GLVertexget_position ()
 Accessor to the position.
const GLVertexget_position () const
 Accessor to the position.
GLfloat get_x () const
 Accessor to the x-coordinate.
GLfloat get_y () const
 Accessor to the y-coordinate.
GLfloat get_z () const
 Accessor to the z-coordinate.
void set_position (const GLVertex &position)
 Sets the position of the object.
void set_position (double x, double y, double z)
 Sets the position of the object.
int get_index () const
 Returns the index of the primitive.
void set_index (int index)
 Sets the index of the primitive.
void set_rotation_unoriented (double dx, double dy, double dz)
 Changes to an unoriented model view, which rotates given normal vector to the Y-Axis.
void set_angles (double yaw, double pitch, double roll)
 Sets the Euler-angles in DIN 9300 norm (Yaw-Pitch-Roll)
void set_angles_xyz (double phi_x, double phi_y, double phi_z)
 Sets the Euler-angles in XYZ-norm.
double get_opacity () const
 Returns the opacity of the entity.
void set_opacity (double opacity)
 Sets the opacity of the entity.
double get_scale () const
 Returns the scale of the entity.
void set_scale (double scale)
 Sets the scale of the entity.
void set_granularity (int value)
 Sets the granularity for all objects.

Protected Attributes

GLfloat T [16]
 Homogeneous 4x4-matrix, which represents the transformation from the coordinate system of the primitive into the OpenGL coordinate system.
GLVertex position
 Position coordinates.
double r
 Line color.
double g
double b
double lr
 Outline colors.
double lg
double lb
int style
 Style of the drawn object.
double opacity
 Opacity of the primitive if transparent.
double scale
 Overall scale of the entity.
int index
 Index of the primitive.
int granularity
 Granularity.

Detailed Description

Class GLPrimitive represents all OpenGL geometric primitives.


Constructor & Destructor Documentation

crp::GLPrimitive::GLPrimitive ( const GLVertex position,
double  yaw = 0.0,
double  pitch = 0.0,
double  roll = 0.0 
) [inline]

Initializes a primitive given the coordinates of the center point.

Notice: The angles are given in radian!

Parameters:
positionPosition of the primitive
yawYaw angle
pitchPitch angle
rollRoll angle
virtual crp::GLPrimitive::~GLPrimitive ( ) [inline, virtual]

Virtual destructor.


Member Function Documentation

void crp::GLPrimitive::draw ( int  flags = GL_NO_STYLE) const [inline]

Drawing method is the same for each primitive.

Parameters:
flagsStyle flags used to filter out drawing
double crp::GLPrimitive::get_b ( ) const [inline]

Returns the blue line color of the primitive.

Returns:
Blue line color
double crp::GLPrimitive::get_g ( ) const [inline]

Returns the green line color of the primitive.

Returns:
Green line color
int crp::GLPrimitive::get_index ( ) const [inline]

Returns the index of the primitive.

Returns:
Primitive index
double crp::GLPrimitive::get_line_b ( ) const [inline]

Returns the blue outline color of the primitive.

Returns:
Blue outline color
double crp::GLPrimitive::get_line_g ( ) const [inline]

Returns the green outline color of the primitive.

Returns:
Green outline color
double crp::GLPrimitive::get_line_r ( ) const [inline]

Returns the red outline color of the primitive.

Returns:
Red outline color
double crp::GLPrimitive::get_opacity ( ) const [inline]

Returns the opacity of the entity.

Returns:
Opacity of the entity
GLVertex& crp::GLPrimitive::get_position ( ) [inline]

Accessor to the position.

Returns:
Primitive position
const GLVertex& crp::GLPrimitive::get_position ( ) const [inline]

Accessor to the position.

Returns:
Primitive position
double crp::GLPrimitive::get_r ( ) const [inline]

Returns the red line color of the primitive.

Returns:
Red line color
double crp::GLPrimitive::get_scale ( ) const [inline]

Returns the scale of the entity.

Returns:
Scale of the entity
int crp::GLPrimitive::get_style ( ) const [inline]

Returns the style of the object.

Returns:
Style constant of the object
virtual GLPrimitiveType crp::GLPrimitive::get_type ( ) const [pure virtual]
GLfloat crp::GLPrimitive::get_x ( ) const [inline]

Accessor to the x-coordinate.

Returns:
The x-coordinate
GLfloat crp::GLPrimitive::get_y ( ) const [inline]

Accessor to the y-coordinate.

Returns:
The y-coordinate
GLfloat crp::GLPrimitive::get_z ( ) const [inline]

Accessor to the z-coordinate.

Returns:
The z-coordinate
virtual void crp::GLPrimitive::make_display_list ( int  flags = GL_NO_STYLE) const [pure virtual]

Performs operations needed to create a display list of the model.

Parameters:
flagsStyle flags used to filter out drawing

Implemented in crp::GLCSystem, crp::GLCube, crp::GLCuboid, crp::GLDisk, crp::GLLine, crp::GLMesh, crp::GLPicture, crp::GLPlane, crp::GLPoint, crp::GLPointList, crp::GLScene, crp::GLSphere, crp::GLSquare, crp::GLSTLModel, crp::GLSurface, crp::GLText, crp::GLTorus, and crp::GLTriangle.

void crp::GLPrimitive::set_angles ( double  yaw,
double  pitch,
double  roll 
) [inline]

Sets the Euler-angles in DIN 9300 norm (Yaw-Pitch-Roll)

Notice: The angles are given in radian!

Parameters:
yawYaw angle
pitchPitch angle
rollRoll angle
void crp::GLPrimitive::set_angles_xyz ( double  phi_x,
double  phi_y,
double  phi_z 
) [inline]

Sets the Euler-angles in XYZ-norm.

Notice: The angles are given in radian!

Parameters:
phi_xRotation angle around the X-Axis
phi_yRotation angle around the Y-Axis
phi_zRotation angle around the Z-Axis
void crp::GLPrimitive::set_color ( double  r,
double  g,
double  b 
) [inline]

Sets the line color.

Parameters:
rRed amount between 0.0 and 1.0
gGreen amount between 0.0 and 1.0
bBlue amount between 0.0 and 1.0
void crp::GLPrimitive::set_granularity ( int  value) [inline]

Sets the granularity for all objects.

Parameters:
valueNew granularity
void crp::GLPrimitive::set_index ( int  index) [inline]

Sets the index of the primitive.

Parameters:
indexNew index
void crp::GLPrimitive::set_opacity ( double  opacity) [inline]

Sets the opacity of the entity.

Parameters:
opacityNew opacity
void crp::GLPrimitive::set_outline_color ( double  r,
double  g,
double  b 
) [inline]

Sets the outline color.

Parameters:
rRed amount between 0.0 and 1.0
gGreen amount between 0.0 and 1.0
bBlue amount between 0.0 and 1.0
void crp::GLPrimitive::set_position ( double  x,
double  y,
double  z 
) [inline]

Sets the position of the object.

Parameters:
xX-Coordinate of the position
yY-Coordinate of the position
zZ-Coordinate of the position
void crp::GLPrimitive::set_position ( const GLVertex position) [inline]

Sets the position of the object.

Parameters:
xX-Coordinate of the position
yY-Coordinate of the position
zZ-Coordinate of the position
void crp::GLPrimitive::set_rotation_unoriented ( double  dx,
double  dy,
double  dz 
) [inline]

Changes to an unoriented model view, which rotates given normal vector to the Y-Axis.

The intention is that the Y-Axis points up.

Parameters:
dxX-coordinate of the normal
dyY-coordinate of the normal
dzZ-coordinate of the normal
void crp::GLPrimitive::set_scale ( double  scale) [inline]

Sets the scale of the entity.

Parameters:
scaleNew scale
void crp::GLPrimitive::set_style ( int  style) [inline]

Sets the objects style.

Parameters:
styleTransparency style

Field Documentation

double crp::GLPrimitive::b [protected]
double crp::GLPrimitive::g [protected]

Granularity.

int crp::GLPrimitive::index [protected]

Index of the primitive.

double crp::GLPrimitive::lb [protected]
double crp::GLPrimitive::lg [protected]
double crp::GLPrimitive::lr [protected]

Outline colors.

double crp::GLPrimitive::opacity [protected]

Opacity of the primitive if transparent.

Position coordinates.

double crp::GLPrimitive::r [protected]

Line color.

double crp::GLPrimitive::scale [protected]

Overall scale of the entity.

int crp::GLPrimitive::style [protected]

Style of the drawn object.

GLfloat crp::GLPrimitive::T[16] [protected]

Homogeneous 4x4-matrix, which represents the transformation from the coordinate system of the primitive into the OpenGL coordinate system.


The documentation for this class was generated from the following file: