vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AP_LSystem::AbstractTurtle Class Referenceabstract

#include <abstractturtle.h>

Inheritance diagram for AP_LSystem::AbstractTurtle:
AP_LSystem::MovingTurtle AP_LSystem::LoftTurtle AP_LSystem::QueryTurtle AP_LSystem::Rectangle AP_LSystem::JointedPipe AP_LSystem::StraightPipe AP_LSystem::HermitPipe

Public Member Functions

virtual int initialize ()
 
virtual int finalize ()
 
virtual int resetValues ()
 
TurtlePropertiesgetProperties ()
 
virtual void setProperties (TurtleProperties p)
 
virtual void inheritProperties (TurtleProperties p)
 
void bindGeode (LSGeode *geode)
 
LSGeodegetGeode ()
 
osg::Matrixd getMatrix ()
 
virtual void drawFrame (osg::Matrixd &matrix, osg::Vec4d *color=NULL)=0
 
virtual void drawVector (const osg::Vec3d &vector, osg::Matrixd &matrix, osg::Vec4d &color)
 
double toRad (double angle)
 
double rand (double angle)
 
virtual int turnLeft (std::vector< Parameter > &p)=0
 
virtual int turnRight (std::vector< Parameter > &p)=0
 
virtual int pitchDown (std::vector< Parameter > &p)=0
 
virtual int pitchUp (std::vector< Parameter > &p)=0
 
virtual int rollLeft (std::vector< Parameter > &p)=0
 
virtual int rollRight (std::vector< Parameter > &p)=0
 
virtual int turnArround ()=0
 
virtual int rollArround ()=0
 
virtual int rollUntilHorizontal ()=0
 
virtual int randomTurnPitchRoll (std::vector< Parameter > &p)=0
 
virtual int multiplyLength (std::vector< Parameter > &p)=0
 
virtual int multiplyRadius (std::vector< Parameter > &p)=0
 
virtual int multiplyAngle (std::vector< Parameter > &p)=0
 
virtual int multiplyTropismElasticity (std::vector< Parameter > &p)=0
 
virtual int multiplyGravitropismElasticity (std::vector< Parameter > &p)=0
 
virtual int drawForward (std::vector< Parameter > &p)=0
 
virtual int drawForwardHalf ()=0
 
virtual int moveForward (std::vector< Parameter > &p)=0
 
virtual int moveForwardHalf ()=0
 

Protected Attributes

TurtleProperties properties
 properties of turtle is used for getting parameters for generation of geometry More...
 
LSGeodegeode
 all geometry generated by turtle is stored to this output geode More...
 

Detailed Description

Abstract class for all turtles with declarations of all necessary functions.

Member Function Documentation

void AP_LSystem::AbstractTurtle::bindGeode ( LSGeode geode)
inline

Bind a turtle with LSGeode. During interpretation, the turtle will generate geometry to this LSGeode.

Parameters
geodeGeode to be binded.
Parameters
geodebind output geode with current turtle
virtual int AP_LSystem::AbstractTurtle::drawForward ( std::vector< Parameter > &  p)
pure virtual

Move forward and generate a geometry

Parameters
pvector with parameters
  • 0 parameters: use a default distance/length for a movement
  • 1 parameter: use this parameter as distance for a movement. Type is double.
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::drawForwardHalf ( )
pure virtual

Move forward and generate a geometry. Use half of default length value for movement.

Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual void AP_LSystem::AbstractTurtle::drawFrame ( osg::Matrixd &  matrix,
osg::Vec4d *  color = NULL 
)
pure virtual

For debugging. Draw a turtle frame.

Parameters
matrixposition matrix of turtle
colorcolor of all vectors. Default is red for heading, green for up and blue for left vector.

Implemented in AP_LSystem::MovingTurtle.

virtual void AP_LSystem::AbstractTurtle::drawVector ( const osg::Vec3d &  vector,
osg::Matrixd &  matrix,
osg::Vec4d &  color 
)
inlinevirtual

For debugging. Draw a vector as arrow.

Parameters
vectordisplayed vector
matrixposition matrix of vector
colorcolor of vector
virtual int AP_LSystem::AbstractTurtle::finalize ( )
inlinevirtual

Process a finalization of turtle. This method is called when turtle is removed from the stack.

Returns
error code

Reimplemented in AP_LSystem::StraightPipe, AP_LSystem::Rectangle, AP_LSystem::QueryTurtle, and AP_LSystem::HermitPipe.

LSGeode* AP_LSystem::AbstractTurtle::getGeode ( )
inline

Get pointer to binded geode.

Returns
binded geode.
osg::Matrixd AP_LSystem::AbstractTurtle::getMatrix ( )
inline

Get position matrix of turtle.

Returns
position matrix
TurtleProperties& AP_LSystem::AbstractTurtle::getProperties ( )
inline

Get turtle properties

Returns
properties
virtual void AP_LSystem::AbstractTurtle::inheritProperties ( TurtleProperties  p)
inlinevirtual

Inherit some properties. This method is called if different L-system is detected. This subsystems has own properties, but some properties are inherited from the turtle on the stack.

Parameters
pproperties
virtual int AP_LSystem::AbstractTurtle::initialize ( void  )
inlinevirtual

Process an initialization of turtle. This method is called when turtle is pushed onto the stack.

Returns
error code

Reimplemented in AP_LSystem::StraightPipe, AP_LSystem::JointedPipe, AP_LSystem::Rectangle, AP_LSystem::HermitPipe, and AP_LSystem::QueryTurtle.

virtual int AP_LSystem::AbstractTurtle::moveForward ( std::vector< Parameter > &  p)
pure virtual

Move forward and without generating a geometry

Parameters
pvector with parameters
  • 0 parameters: use a default distance/length for a movement
  • 1 parameter: use this parameter as distance for a movement. Type is double.
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::moveForwardHalf ( )
pure virtual

Move forward without generating a geometry. Use half of default length value for movement.

Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::multiplyAngle ( std::vector< Parameter > &  p)
pure virtual

Multiply a default angle.

Parameters
pvector with parameters
  • 0 parameters: multiply by default value
  • 1 parameter: use this parameter as multiplier. Type is double.
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::multiplyGravitropismElasticity ( std::vector< Parameter > &  p)
pure virtual

Multiply a gravitropism/geotropism elasticity.

Parameters
pvector with parameters
  • 0 parameters: multiply by default value
  • 1 parameter: use this parameter as multiplier. Type is double.
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::multiplyLength ( std::vector< Parameter > &  p)
pure virtual

Multiply a default lenght.

Parameters
pvector with parameters
  • 0 parameters: multiply by default value
  • 1 parameter: use this parameter as multiplier. Type is double.
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::multiplyRadius ( std::vector< Parameter > &  p)
pure virtual

Multiply a default radius/thickness.

Parameters
pvector with parameters
  • 0 parameters: multiply by default value
  • 1 parameter: use this parameter as multiplier. Type is double.
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::multiplyTropismElasticity ( std::vector< Parameter > &  p)
pure virtual

Multiply a diatropism elasticity.

Parameters
pvector with parameters
  • 0 parameters: multiply by default value
  • 1 parameter: use this parameter as multiplier. Type is double.
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::pitchDown ( std::vector< Parameter > &  p)
pure virtual

Make a rotation around vector L down.

Parameters
pvector with parameters
  • 0 parameters: use default angle
  • 1 parameter: use this parameter as angle. Type is double.
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::pitchUp ( std::vector< Parameter > &  p)
pure virtual

Make a rotation around vector L up.

Parameters
pvector with parameters
  • 0 parameters: use default angle
  • 1 parameter: use this parameter as angle. Type is double.
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

double AP_LSystem::AbstractTurtle::rand ( double  angle)
inline

Conditionally fluctuate the angle.

Parameters
angleinput angle
Returns
conditionally randomized angle
virtual int AP_LSystem::AbstractTurtle::randomTurnPitchRoll ( std::vector< Parameter > &  p)
pure virtual

Make a random rotation.

Todo:
Not implemented
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::resetValues ( )
inlinevirtual

Reset all values in properties to default value as set in Configuration.

Todo:
Not implemented.
Returns
error code
virtual int AP_LSystem::AbstractTurtle::rollArround ( )
pure virtual

Make a 180° rotation around vector U.

Todo:
Not implemented
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::rollLeft ( std::vector< Parameter > &  p)
pure virtual

Make a rotation around vector H to the left.

Parameters
pvector with parameters
  • 0 parameters: use default angle
  • 1 parameter: use this parameter as angle. Type is double.
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::rollRight ( std::vector< Parameter > &  p)
pure virtual

Make a rotation around vector H to the right.

Parameters
pvector with parameters
  • 0 parameters: use default angle
  • 1 parameter: use this parameter as angle. Type is double.
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::rollUntilHorizontal ( )
pure virtual

Make a rotation around vector H until left vector is in horizontal position.

Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual void AP_LSystem::AbstractTurtle::setProperties ( TurtleProperties  p)
inlinevirtual

Set turtle properties. The setup must be part of turtle initialization.

Parameters
pproperties
double AP_LSystem::AbstractTurtle::toRad ( double  angle)
inline

Conditionally converts degrees to radians.

Parameters
angleangle in degrees or radians
Returns
angle in radians
virtual int AP_LSystem::AbstractTurtle::turnArround ( )
pure virtual

Make a 180° rotation around vector U.

Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::turnLeft ( std::vector< Parameter > &  p)
pure virtual

Make a rotation around vector U to the left.

Parameters
pvector with parameters
  • 0 parameters: use default angle
  • 1 parameter: use this parameter as angle. Type is double.
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

virtual int AP_LSystem::AbstractTurtle::turnRight ( std::vector< Parameter > &  p)
pure virtual

Make a rotation around vector U to the right.

Parameters
pvector with parameters
  • 0 parameters: use default angle
  • 1 parameter: use this parameter as angle. Type is double.
Returns
error code

Implemented in AP_LSystem::MovingTurtle.

Member Data Documentation

LSGeode* AP_LSystem::AbstractTurtle::geode
protected

all geometry generated by turtle is stored to this output geode

TurtleProperties AP_LSystem::AbstractTurtle::properties
protected

properties of turtle is used for getting parameters for generation of geometry


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