Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

SIGEL_Robot::SIG_Geometry Class Reference

This is a representation of the surface of a link body. More...

#include <SIG_Geometry.h>

List of all members.

Public Methods

 SIG_Geometry ()
 Standard constructor. More...

 SIG_Geometry (const SIG_Geometry *geom)
 Unreal copy constructor. More...

 SIG_Geometry (QTextStream & tx)
 Unstreaming constructor. More...

 ~SIG_Geometry (void)
 Destructor. More...

int getOrAddVertex (DL_vector vertex)
 getOrAddVertex searches for the vertex and hands out its index. More...

QVector<DL_vector> const& getVertices (void) const
 Returns the vector of vertices. More...

int getNumVertices (void) const
 Returns the number of vertices. More...

DL_vector getVertex (int i) const
 Returns the ith vertex of the geometry. More...

int getNumPolygons (void) const
 getNumPolygons reports the number of polygons in the geometry object. More...

void translate (DL_vector dir)
 Move the geometry. More...

void rotate (DL_matrix mat)
 Rotate the geometry. More...

void writeToFileTransfer (QTextStream & tx) const
 Write the geometry to a stream. More...


Protected Methods

void addPolygon (SIG_Polygon *p)
 Adds a polygon. More...

SIG_Polygon const* getPolygon (int i) const
 Returns a polygon. More...


Private Attributes

QVector<SIG_Polygonpolygons
QVector<DL_vector> vertices

Friends

class  SIG_GeometryIterator
class  SIG_Polygon


Detailed Description

This is a representation of the surface of a link body.

Currently, only polygonal surfaces are supported.

In order to build a geometry, make a new SIG_Geometry object dynamically, and then create multiple SIG_Polygon objects dynamically with your new geometry object as the constructor argument. Then add vertices to the polygon using addVertex.

Definition at line 26 of file SIG_Geometry.h.


Constructor & Destructor Documentation

SIGEL_Robot::SIG_Geometry::SIG_Geometry ( void )
 

Standard constructor.

This makes the world entirely black.

Definition at line 20 of file SIG_Geometry.cpp.

SIGEL_Robot::SIG_Geometry::SIG_Geometry ( const SIG_Geometry * geom )
 

Unreal copy constructor.

This constructor makes this geometry object a deep copy of the argument. Remember: Never use SIG_Geometry statically or via reference. Use pointers instead!

Definition at line 24 of file SIG_Geometry.cpp.

SIGEL_Robot::SIG_Geometry::SIG_Geometry ( QTextStream & tx )
 

Unstreaming constructor.

Reads a geometry object and all its polygons from a stream. All stream issues described elsewhere apply also here.

Definition at line 35 of file SIG_Geometry.cpp.

SIGEL_Robot::SIG_Geometry::~SIG_Geometry ( void )
 

Destructor.

Definition at line 58 of file SIG_Geometry.cpp.


Member Function Documentation

void SIGEL_Robot::SIG_Geometry::addPolygon ( SIG_Polygon * p ) [protected]
 

Adds a polygon.

This is used by SIG_Polygon to add itself to the geometry.

Definition at line 5 of file SIG_Geometry.cpp.

int SIGEL_Robot::SIG_Geometry::getNumPolygons ( void ) const
 

getNumPolygons reports the number of polygons in the geometry object.

Definition at line 108 of file SIG_Geometry.cpp.

int SIGEL_Robot::SIG_Geometry::getNumVertices ( void ) const
 

Returns the number of vertices.

Definition at line 98 of file SIG_Geometry.cpp.

int SIGEL_Robot::SIG_Geometry::getOrAddVertex ( DL_vector vertex )
 

getOrAddVertex searches for the vertex and hands out its index.

If the vertex cannot be found, it will be added and the new index will be returned.

Since the array of vertices has to be searched, this is a potentially expensive function. But once an index is handed out, the vertex may not be given another one. This would happen in a reorder operation.

TODO: There has to be yet another level of indirection that enables us to order the vertices in some manner without having to change the indices.

Definition at line 77 of file SIG_Geometry.cpp.

SIG_Polygon const * SIGEL_Robot::SIG_Geometry::getPolygon ( int i ) const [protected]
 

Returns a polygon.

This is used by the SIG_GeometryIterator class to get the polygons it iterates over.

Definition at line 15 of file SIG_Geometry.cpp.

DL_vector SIGEL_Robot::SIG_Geometry::getVertex ( int i ) const
 

Returns the ith vertex of the geometry.

Points in space are considered the same point if the absolute value of their distance is smaller than the zero defined in the implementation.

Definition at line 103 of file SIG_Geometry.cpp.

QVector< DL_vector >const & SIGEL_Robot::SIG_Geometry::getVertices ( void ) const
 

Returns the vector of vertices.

Definition at line 93 of file SIG_Geometry.cpp.

void SIGEL_Robot::SIG_Geometry::rotate ( DL_matrix mat )
 

Rotate the geometry.

You have to provide a rotation matrix to do this. You may also provide any other matrix. So you can perform all transformation that can be done with a matrix multiplication.

Definition at line 121 of file SIG_Geometry.cpp.

void SIGEL_Robot::SIG_Geometry::translate ( DL_vector dir )
 

Move the geometry.

By means of moving all vertices.

Definition at line 113 of file SIG_Geometry.cpp.

void SIGEL_Robot::SIG_Geometry::writeToFileTransfer ( QTextStream & tx ) const
 

Write the geometry to a stream.

Definition at line 130 of file SIG_Geometry.cpp.


Friends And Related Function Documentation

class SIG_GeometryIterator [friend]
 

Definition at line 27 of file SIG_Geometry.h.

class SIG_Polygon [friend]
 

Definition at line 28 of file SIG_Geometry.h.


Member Data Documentation

QVector< SIG_Polygon > SIGEL_Robot::SIG_Geometry::polygons [private]
 

Definition at line 30 of file SIG_Geometry.h.

QVector< DL_vector > SIGEL_Robot::SIG_Geometry::vertices [private]
 

Definition at line 31 of file SIG_Geometry.h.


The documentation for this class was generated from the following files:
Generated at Mon Sep 3 01:32:42 2001 for PG 368 - SIGEL by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000