Main Page   Namespace List   Alphabetical List   Compound List   File List   Compound Members   File Members  

RomAnglePool Class Reference

This class saves the angles of the Rom. More...

#include <romanglepool.h>

List of all members.

Public Member Functions

 RomAnglePool ()
 Constructor of this class.

 ~RomAnglePool ()
 Destructor of this class.

void append (float phi, float theta)
 puts the parameters into a struct and append it to the internal list

int length ()
 return the length of the internal vector

void get (int index, float *phi, float *theta)
 returns the values of the internal stuct at the position index

SoNode * createVisualizationCone () const
 create ROM visualization cone


Private Attributes

std::vector< PoolElement * > poolElementVector
 poolElemenetVector is a vector of PoolElement pointers


Detailed Description

This class saves the angles of the Rom.


Constructor & Destructor Documentation

RomAnglePool::RomAnglePool  )  [inline]
 

Constructor of this class.

00017 {};

RomAnglePool::~RomAnglePool  )  [inline]
 

Destructor of this class.

00020 {};


Member Function Documentation

void RomAnglePool::append float  phi,
float  theta
 

puts the parameters into a struct and append it to the internal list

Parameters:
phi specifies the angle phi
theta specifies the angle theta

00012                                                 {
00013    PoolElement* poolElement = new PoolElement();
00014    poolElement->phi       = phi;
00015    poolElement->theta     = theta;
00016    poolElementVector.insert(poolElementVector.end(), poolElement);
00017 }

SoNode * RomAnglePool::createVisualizationCone  )  const
 

create ROM visualization cone

Use the data points that are already in the pool and create the SGI OpenInventor visualization cone of the Range Of Motion.

Returns:
SoNode of ROM cone

00033 {
00034    SoSeparator *cone = new SoSeparator;
00035    SoCoordinate3 *coords = new SoCoordinate3;
00036    SoIndexedFaceSet *faces = new SoIndexedFaceSet;
00037 
00038    // add tip of cone
00039    coords->point.set1Value(0, 0, 0, 0);
00040    for (int i=0; i<poolElementVector.size(); i++) {
00041       double phi = poolElementVector[i]->phi*M_PI/180.0;
00042       double theta = poolElementVector[i]->theta*M_PI/180.0;
00043       double x = -sin(theta)*cos(phi)*CONE_LENGTH;
00044       double y = -cos(theta)*CONE_LENGTH; 
00045       double z = -sin(theta)*sin(phi)*CONE_LENGTH;
00046       coords->point.set1Value(i+1, x, y, z);
00047    }
00048 
00049    // build up cone faces
00050    for (int i=0; i<poolElementVector.size(); i++) {
00051       faces->coordIndex.set1Value(4*i, i+1); // first point 
00052       faces->coordIndex.set1Value(4*i+1, (i+1)%poolElementVector.size()+1); // second point
00053       faces->coordIndex.set1Value(4*i+2, 0); // cone tip
00054       faces->coordIndex.set1Value(4*i+3, -1); // end of face
00055    }
00056    
00057    cone->addChild(coords);
00058    cone->addChild(faces);
00059    
00060    return cone;
00061 }

void RomAnglePool::get int  index,
float *  phi,
float *  theta
 

returns the values of the internal stuct at the position index

Parameters:
index list index whose values should be returned
phi specifies the angle phi
theta specifies the angle theta

00023                                                           {
00024    PoolElement *poolElement;
00025    if (index < poolElementVector.size()) {
00026       poolElement = poolElementVector[index];
00027       *phi       = poolElement->phi;
00028       *theta     = poolElement->theta;
00029    }
00030 }

int RomAnglePool::length  ) 
 

return the length of the internal vector

00019                          {
00020    return poolElementVector.size();
00021 }


Member Data Documentation

std::vector<PoolElement*> RomAnglePool::poolElementVector [private]
 

poolElemenetVector is a vector of PoolElement pointers


The documentation for this class was generated from the following files:
Generated on Tue Jul 8 13:23:02 2003 for ROM-Visualizer by doxygen 1.3.1