HyperspaceExplorer 0.7.1
Public Member Functions | Private Member Functions
rotate_base< D > Class Template Reference

Base class for Rotate classes, providing the actual rotate() function. More...

#include <Rotate.h>

Inheritance diagram for rotate_base< D >:
Inheritance graph
[legend]
Collaboration diagram for rotate_base< D >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 rotate_base (const VertexData< D > &v)
 Create a rotate_base object from an already existing object.
void rotate (unsigned d)
 Execute the rotate action of the previous object along axis d.

Private Member Functions

void checkRotationArguments (unsigned d)
VecMath::Vector< D > rotate_vertex (const VecMath::Vector< D > &, double, unsigned, unsigned)
 Execute a rotation on a VecMath::Vector.
void rotate_line (unsigned)
 Execute the rotate action on a line (generating a circle)
void rotate_triangle (unsigned, const VecMath::MultiDimensionalVector< unsigned, 1 > &)
 Execute the rotate action on a triangle (generating a cone)
void rotate_quad (unsigned, const VecMath::MultiDimensionalVector< unsigned, 1 > &)
 Execute the rotate action on a rectangle (generating a cylinder)
void rotate_polygon (unsigned, const VecMath::MultiDimensionalVector< unsigned, 1 > &)
 Execute the rotate action on a polygon.

Detailed Description

template<unsigned D>
class rotate_base< D >

Base class for Rotate classes, providing the actual rotate() function.

Template Parameters:
DDimension of the vector space we're working in
Author:
Helge Preuss <lene.preuss@gmail.com>

Member Function Documentation

template<unsigned D>
void rotate_base< D >::checkRotationArguments ( unsigned  d) [private]
Todo:
rename check_argument()
template<unsigned D>
void rotate_base< D >::rotate ( unsigned  d)

Execute the rotate action of the previous object along axis d.

We must implement the following algorithm:

For every (d - 2)-surface realm in the (d - 1)-dimensional object: generate a new (d - 1)-dimensional object from the (d - 2)-surface realm and its rotated image Repeat until the rotation is full (180 degrees are enough)

Parameters:
dThe direction into which is extruded. The rotation takes place in the ( d, d-1 )-plane.

References RotopeInterface::_numSegments, std::vector< _Tp, _Alloc >::begin(), VertexData< D >::dimension(), std::vector< _Tp, _Alloc >::end(), Loki::SingletonHolder< T, CreationPolicy >::Instance(), std::vector< _Tp, _Alloc >::push_back(), VertexData< D >::raw_vertices(), VertexData< D >::realm(), Realm::rotated(), and std::vector< _Tp, _Alloc >::size().

Here is the call graph for this function:

template<unsigned D>
void rotate_base< D >::rotate_line ( unsigned  d) [private]

Execute the rotate action on a line (generating a circle)

Parameters:
dDimension to be rotated into - the vertices are rotated away from axis d-1

References RotopeInterface::_numSegments, Loki::SingletonHolder< T, CreationPolicy >::Instance(), std::vector< _Tp, _Alloc >::pop_back(), std::vector< _Tp, _Alloc >::push_back(), VecMath::MultiDimensionalVector< T, D >::push_back(), VertexData< D >::raw_vertices(), and size().

Here is the call graph for this function:

template<unsigned D>
void rotate_base< D >::rotate_polygon ( unsigned  d,
const VecMath::MultiDimensionalVector< unsigned, 1 > &  current_surface 
) [private]

Execute the rotate action on a polygon.

Parameters:
dDimension to be rotated into - the vertices are rotated away from axis d-1
current_surfaceThe polygonal surface to be extruded into a sphere

Rotate the current surface through 180 degrees along its central axis

New quad surface (current, next, rotated_next, rotated_current)

Update vertices from which to draw the next surface

References RotopeInterface::_numSegments, std::cerr, Loki::SingletonHolder< T, CreationPolicy >::Instance(), next(), std::vector< _Tp, _Alloc >::push_back(), VertexData< D >::raw_vertices(), size(), std::vector< _Tp, _Alloc >::size(), and VecMath::MultiDimensionalVector< T, D >::size().

Here is the call graph for this function:

template<unsigned D>
void rotate_base< D >::rotate_quad ( unsigned  d,
const VecMath::MultiDimensionalVector< unsigned, 1 > &  current_surface 
) [private]

Execute the rotate action on a rectangle (generating a cylinder)

Parameters:
dDimension to be rotated into - the vertices are rotated away from axis d-1
current_surfaceThe rectangular surface to be extruded into a cylinder

Save first vertex of "bottom" cap.

Save first vertex of "top" cap. This relies on quads being defined in the order, 0, 1, 2, 3, where vertex 2 and 3 lie in the direction of the extrusion.

Rotate the current surface through 360 degrees.

Bug:
Instead of rotating it through 180 degrees and using every vertex, we only take the vertices on one side of the rotation axis. Taking the indexes on the other side too would be an indexing nightmare.

New vertices generated by rotation about angle rot.

Add quad surface: (current, next, rotated_next, rotated_current).

Update vertices from which to draw the next surface.

Add rotated vertex to bottom cap and rotated_next to top cap.

Add the new circular surfaces ("caps") generated by the rotation.

References RotopeInterface::_numSegments, Loki::SingletonHolder< T, CreationPolicy >::Instance(), next(), std::vector< _Tp, _Alloc >::push_back(), VecMath::MultiDimensionalVector< T, D >::push_back(), VertexData< D >::raw_vertices(), std::vector< _Tp, _Alloc >::size(), and size().

Here is the call graph for this function:

template<unsigned D>
void rotate_base< D >::rotate_triangle ( unsigned  d,
const VecMath::MultiDimensionalVector< unsigned, 1 > &  current_surface 
) [private]

Execute the rotate action on a triangle (generating a cone)

Parameters:
dDimension to be rotated into - the vertices are rotated away from axis d-1
current_surfaceThe triangular surface to be extruded into a cone

Rotate the current surface through 360 degrees.

Bug:
Instead of rotating it through 180 degrees and using every vertex, we only take the vertices on one side of the rotation axis.

New vertex generated by rotation about angle rot

Add new vertex to cap

New triangular surface (current, next, rotated_current)

Add the new circular surface ("cap") generated by the rotation

References RotopeInterface::_numSegments, Loki::SingletonHolder< T, CreationPolicy >::Instance(), next(), std::vector< _Tp, _Alloc >::push_back(), VecMath::MultiDimensionalVector< T, D >::push_back(), VertexData< D >::raw_vertices(), std::vector< _Tp, _Alloc >::size(), and size().

Here is the call graph for this function:

template<unsigned D>
VecMath::Vector< D > rotate_base< D >::rotate_vertex ( const VecMath::Vector< D > &  v,
double  rot,
unsigned  new_axis,
unsigned  old_axis 
) [private]

Execute a rotation on a VecMath::Vector.

Parameters:
vThe vertex to be rotated about rot radians
rotAngle of the rotation, in radians
new_axisDirection to be rotated into
old_axisAxis to be rotated away from

References cos(), Loki::SingletonHolder< T, CreationPolicy >::Instance(), and sin().

Here is the call graph for this function:


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:18 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo