#include <romanglepool.h>
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 |
|
Constructor of this class.
00017 {}; |
|
Destructor of this class.
00020 {}; |
|
puts the parameters into a struct and append it to the internal list
00012 { 00013 PoolElement* poolElement = new PoolElement(); 00014 poolElement->phi = phi; 00015 poolElement->theta = theta; 00016 poolElementVector.insert(poolElementVector.end(), poolElement); 00017 } |
|
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.
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 } |
|
returns the values of the internal stuct at the position index
00023 { 00024 PoolElement *poolElement; 00025 if (index < poolElementVector.size()) { 00026 poolElement = poolElementVector[index]; 00027 *phi = poolElement->phi; 00028 *theta = poolElement->theta; 00029 } 00030 } |
|
return the length of the internal vector
00019 { 00020 return poolElementVector.size(); 00021 } |
|
poolElemenetVector is a vector of PoolElement pointers
|