golib  0.5
goPointCloud< T > Class Template Reference

Point cloud. More...

#include <gopointcloud.h>

Public Member Functions

 goPointCloud (goSize_t dim=2)
 
 goPointCloud (const goPointCloud< T > &)
 
 goPointCloud (const goList< goMath::Vector< T > > &)
 
 goPointCloud (const goMath::Matrix< T > &)
 
goPointCloud< T > & operator= (const goPointCloud< T > &)
 
bool operator!= (const goPointCloud< T > &other) const
 
bool operator== (const goPointCloud< T > &other) const
 
goIndex_t getPointCount () const
 Get number of points. More...
 
goList< goMath::Vector< T > > & getPoints ()
 Get list of points. More...
 
const goList< goMath::Vector< T > > & getPoints () const
 Get list of points. More...
 
virtual bool setPoints (const goList< goMath::Vector< T > > &)
 Set the point list. More...
 
virtual bool setPoints (const goMath::Matrix< T > &)
 Set points from the rows of a configuration matrix. More...
 
void addPoint (const goMath::Vector< T > &p)
 Adds point to this cloud. More...
 
void setChanged ()
 
goSize_t getDim () const
 
bool getCenterOfMass (goMath::Vector< T > &comRet) const
 Calculates the center of mass of the point cloud. More...
 
bool translate (const goMath::Vector< T > &d)
 Translate all points. More...
 
bool scale (T s)
 Scale all points. More...
 
void getConfigurationMatrix (goMath::Matrix< T > &cmRet) const
 Get matrix containing the point coordinates. More...
 
void getConfigurationVector (goMath::Vector< T > &cvRet) const
 Get configuration vector. More...
 
bool getPrincipalAxes2D (goMath::Vectorf &a1, goMath::Vectorf &a2, const goArray< goFloat > *weights=0) const
 Calculate 2 principal axes. More...
 
bool getPrincipalAxes (goMath::Matrix< T > &axes) const
 
bool unitScale (goFloat factor=1.0f)
 
template<class matrixT >
bool transform (const matrixT &m)
 
void affineTransform (const goMath::Matrix< T > &m)
 
virtual bool writeObjectFile (FILE *) const
 DO NOT USE Write the point cloud to a file. More...
 
virtual bool readObjectFile (FILE *)
 DO NOT USE Read the point cloud from a file. More...
 
virtual bool callObjectMethod (int methodID, goObjectMethodParameters *param=NULL)
 Call an object method by identifier. More...
 
- Public Member Functions inherited from goObjectBase
 goObjectBase ()
 Constructor.
 
virtual ~goObjectBase ()
 Destructor. More...
 
const char * getClassName () const
 Returns the class name. More...
 
int getClassID () const
 
virtual goSize_t memoryUsage () const
 Returns the size of this object or some measure of its memory consumption. More...
 
void setObjectName (const char *name)
 Set name string for an object. More...
 
void setObjectName (const goString &name)
 Set name string for an object. More...
 
const goStringgetObjectName () const
 Get the object name. More...
 
void connectObject (goObjectBase *object)
 Connects an object to this object. More...
 
void disconnectObject (const goObjectBase *object)
 Disconnects an object from this object.
 
virtual bool queueObjectMethod (int methodID, goObjectMethodParameters *param=NULL, bool blocking=false)
 Enqueue a method call to an internal list of methods. More...
 
bool callQueuedMethods ()
 Call all queued methods. More...
 

Static Public Member Functions

static bool getCenterOfMass (const goFixedArray< goMath::Vector< T > > &, goMath::Vector< T > &comRet)
 
static bool getPrincipalAxes (const goFixedArray< goMath::Vector< T > > &, goMath::Matrix< T > &axes)
 
static bool readASCII (const char *filename, goSize_t dimension, goList< goMath::Vector< T > > &pointList)
 

Protected Member Functions

virtual void receiveObjectMessage (const goObjectMessage &message)
 Receive a message. More...
 
- Protected Member Functions inherited from goObjectBase
void setClassID (int id)
 Sets the class name.
 
void printClassMessage (const char *msg)
 Sets the class name. More...
 
void printClassMessage (goString &msg)
 Prints an informational message to the calling console. More...
 
void sendObjectMessage (int messageID, void *data=NULL)
 Sends a message to all connected objects.
 
void sendObjectMessage (goObjectBase *object, int messageID, void *data=NULL)
 Sends a message to a specific object.
 

Detailed Description

template<class T>
class goPointCloud< T >

Point cloud.

Points are represented using goMath::Vector<T> objects.

Note
The only currently supported template parameters are goFloat and goDouble.
Todo:
Add function to create a configuration matrix goMath::Matrix (N,getDim()) and/or a configuration vector from a point cloud.

Member Function Documentation

◆ addPoint()

template<class T >
void goPointCloud< T >::addPoint ( const goMath::Vector< T > &  p)

Adds point to this cloud.

Parameters
pPoint to be added.

◆ callObjectMethod()

template<class T >
bool goPointCloud< T >::callObjectMethod ( int  methodID,
goObjectMethodParameters param = NULL 
)
virtual

Call an object method by identifier.

See the file goobjectmessage.h for messages and add messages there if needed. External applications building on this class should use identifiers starting with GO_OBJECTMETHOD_USER.

Note
Reimplement this in sub-classes as needed. The method should return true if the method call was successful. Values can also be returned through the goObjectMethodParameters* param.
Parameters
methodIDID of the method. See goobjectmethod.h
paramPointer to parameters for the method, if any.
Returns
True if successful, false otherwise.

Reimplemented from goObjectBase.

Reimplemented in goCurve< T >.

◆ getCenterOfMass()

template<class T >
bool goPointCloud< T >::getCenterOfMass ( goMath::Vector< T > &  comRet) const

Calculates the center of mass of the point cloud.

No weights are used, all points are weighted with the factor 1.

Parameters
comRetCenter of mass.
Returns
True if successful, false otherwise.

◆ getConfigurationMatrix()

template<class T >
void goPointCloud< T >::getConfigurationMatrix ( goMath::Matrix< T > &  cmRet) const

Get matrix containing the point coordinates.

Fill a matrix $M \in R^{k\times n}$, where with the k points of dimension n from this point cloud.

Parameters
cmRetConfiguration matrix. Resized if necessary.

◆ getConfigurationVector()

template<class T >
void goPointCloud< T >::getConfigurationVector ( goMath::Vector< T > &  cvRet) const

Get configuration vector.

Get a vector $v = (p_0,\dots,p_{k-1})^\top \in R^{k \cdot n}$ containing the coordinates of all k points p of dimension n in this point cloud concatenated.

Parameters
cvRetConfiguration vector. Resized if necessary.

◆ getPointCount()

template<class T >
goIndex_t goPointCloud< T >::getPointCount ( ) const

Get number of points.

Returns
Number of points in the point cloud.

◆ getPoints() [1/2]

template<class T >
goList< goMath::Vector< T > > & goPointCloud< T >::getPoints ( )

Get list of points.

Returns
Reference to the list of pointT objects constituting the point cloud.

◆ getPoints() [2/2]

template<class T >
const goList< goMath::Vector< T > > & goPointCloud< T >::getPoints ( ) const

Get list of points.

Returns
Reference to the list of goPointf objects constituting the point cloud.

◆ getPrincipalAxes2D()

template<class T >
bool goPointCloud< T >::getPrincipalAxes2D ( goMath::Vectorf a1,
goMath::Vectorf a2,
const goArray< goFloat > *  weights = 0 
) const

Calculate 2 principal axes.

Works only with x and y coordinates of the points.

Points must be moved to their center of mass prior to this method.

Parameters
a1Contains the major principal axis (the one with the higher eigenvalue).
a2Contains the minor principal axis.
Returns
True if successful, false otherwise.

◆ readObjectFile()

template<class T >
bool goPointCloud< T >::readObjectFile ( FILE *  f)
virtual

DO NOT USE Read the point cloud from a file.

Reads all 4 coordinates and the point value from the file.

Parameters
fValid, open file.
Returns
True if successful, false otherwise.

Reimplemented from goObjectBase.

Reimplemented in goCurve< T >.

◆ receiveObjectMessage()

template<class T >
void goPointCloud< T >::receiveObjectMessage ( const goObjectMessage message)
protectedvirtual

Receive a message.

This function gets called each time another object "sends" a message to this object. Reimplement this in order to allow derived classes to react to messages.

Reimplemented from goObjectBase.

Reimplemented in goCurve< T >.

◆ scale()

template<class T >
bool goPointCloud< T >::scale ( s)

Scale all points.

Parameters
sScale factor.
Returns
True if successful, false otherwise.

◆ setPoints() [1/2]

template<class T >
bool goPointCloud< T >::setPoints ( const goList< goMath::Vector< T > > &  points)
virtual

Set the point list.

Parameters
pointsList of points. This list will be deep-copied into the internal list.

Reimplemented in goCurve< T >.

◆ setPoints() [2/2]

template<class T >
bool goPointCloud< T >::setPoints ( const goMath::Matrix< T > &  m)
virtual

Set points from the rows of a configuration matrix.

Parameters
mMatrix, each row containing one point.
Returns
True if successful, false otherwise.

Reimplemented in goCurve< T >.

◆ translate()

template<class T >
bool goPointCloud< T >::translate ( const goMath::Vector< T > &  d)

Translate all points.

Parameters
dTranslation.
Returns
True if successful, false otherwise.

◆ writeObjectFile()

template<class T >
bool goPointCloud< T >::writeObjectFile ( FILE *  f) const
virtual

DO NOT USE Write the point cloud to a file.

Writes all 4 coordinates and the point value to the file.

Parameters
fValid, open file.
Returns
True if successful, false otherwise.

Reimplemented from goObjectBase.

Reimplemented in goCurve< T >.


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