Core Mesh Data Structures in C++


Queue

   class QueueInt {
     public:
               QueueInt();
       void    erase();
       int     size()              const;
       void    in(const int value);
       int     out();
 }
Many algorithms, such as many recursive subdivision algorithms, require the sequential processing of instances of certain data structure. The QueueInt data structure implements a queue of integer values, which can be indices into a table of pointer or other data associated with the objects to be processed. The constructor QueueInt() instantiates an empty queue. The method erase() removes all the elements from the queue. The method size returns the number of current elements waiting in the queue to be processed. The in(value) method inserts a new value at the end of the queue. The method out() removes and returns the first element from the queue. It is an errot to call this method when the size of the queue is 0.

Priority Queue

   class PriorityQueueFloat {
     public:
               PriorityQueueFloat()
       int     add(const float key);                     // returns indx
       void    replace(const int indx, const float key);
       void    del(const int indx);
       int     delMin();                                 // returns indx
       int     getMin();
       float   getLastKey();
 }
Other algorithm, such as geometric simplification algorithms, require the processing of instances of certain data structure according to the increasing order of certain numerical parameter. The PriorityQueueFloat data structure implements a priority queue of floating point key values. The PriorityQueueFloat() constructor instantiates an empty priority queue. The method add(key) inserts the key value in the priority queue and returns a unique key index value. The correspondence between key index values and the data structures associated with the key vales has to be mantained externally, for example using an array of integers. The method replace(indx,key) replaces the key value associated with the key index indx. It is an error to call this method with a key index which has no key value waiting to be processed in the priority queue. The method del(indx) removes the key value associated with the key index indx from the priority queue. It is an error to call this method with a key index which has no key value waiting to be processed in the priority queue, and in particular if the priority queue is empty. The method delMin() deletes the minimum key value from the priority queue and returns the associated key index. To obtain the actual key value deleted by the methods del(key) or delMin(), the method getLastKey() should be called immediately after the call to the delete method.


Next : Core Mesh


Core Mesh | Faces | Edges | Graph | HalfEdges | Partition | PolygonMesh | Queue