HyperspaceExplorer 0.7.1
|
Base class for Rotate classes, providing the actual rotate() function. More...
#include <Rotate.h>
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. |
Base class for Rotate classes, providing the actual rotate() function.
D | Dimension of the vector space we're working in |
void rotate_base< D >::checkRotationArguments | ( | unsigned | d | ) | [private] |
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)
d | The 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().
void rotate_base< D >::rotate_line | ( | unsigned | d | ) | [private] |
Execute the rotate action on a line (generating a circle)
d | Dimension 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().
void rotate_base< D >::rotate_polygon | ( | unsigned | d, |
const VecMath::MultiDimensionalVector< unsigned, 1 > & | current_surface | ||
) | [private] |
Execute the rotate action on a polygon.
d | Dimension to be rotated into - the vertices are rotated away from axis d-1 |
current_surface | The 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().
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)
d | Dimension to be rotated into - the vertices are rotated away from axis d-1 |
current_surface | The 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.
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().
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)
d | Dimension to be rotated into - the vertices are rotated away from axis d-1 |
current_surface | The triangular surface to be extruded into a cone |
Rotate the current surface through 360 degrees.
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().
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.
v | The vertex to be rotated about rot radians |
rot | Angle of the rotation, in radians |
new_axis | Direction to be rotated into |
old_axis | Axis to be rotated away from |
References cos(), Loki::SingletonHolder< T, CreationPolicy >::Instance(), and sin().