Institut de Robòtica i Informàtica Industrial
KRD Group

The CuikSuite Project

box_list.h File Reference

Collection of methods to work on Tlist of boxes. More...

#include "list.h"
#include "box.h"
#include "boolean.h"

Go to the source code of this file.

Functions

void InitListOfBoxes (Tlist *l)
 Constructor.
void CopyListOfBoxes (Tlist *l_dst, Tlist *l_src)
 Copy constructor.
double ListOfBoxesVolume (boolean *used, Tlist *l)
 Computes the volume of a list.
double ListOfBoxesMaxDiagonal (boolean *used, Tlist *l)
 Computes the maximum diagonal for all boxes in a list.
double ListOfBoxesMaxSize (boolean *used, Tlist *l)
 Computes the maximum size for all boxes in a list.
void ListOfBoxesBB (boolean *used, Tbox *b, Tlist *l)
 Computes an axis-aligned bounding box for all boxes in a list.
void ListOfBoxesCluster (boolean *used, Tlist *l_out, Tlist *l_in)
 Clusters a list of boxes.
void ConcatListOfBoxes (Tlist *l_new, Tlist *l)
 Concats two lists.
void ReverseListOfBoxes (Tlist *l_orig, Tlist *l)
 Reverses a list.
void PrintListOfBoxes (FILE *f, boolean *used, char *heading, Tlist *l)
 Prints a list of boxes.
boolean ReadListOfBoxes (char *filename, Tlist *l)
 Reads a list of boxes from a file.
void SaveListOfBoxes (FILE *f, Tlist *l)
 Saves a list of boxes.
void LoadListOfBoxes (FILE *f, Tlist *l)
 Loads a list of boxes from a file.
void DeleteListOfBoxes (Tlist *l)
 Destructor.

Detailed Description

This is a collection of functions working on box lists. A box list is a special list including boxes. This specialization is handy since it facilitates the manipulation of sets of boxes.
It its assumed that all boxes in a list have the same dimensionality. If this is not so, some of the functions implement here will generate errors.

See also:
list.h, box.h, Tlist, Tbox.

Definition in file box_list.h.


Function Documentation

void InitListOfBoxes ( Tlist l  ) 

Defines an empty list of boxes.

Parameters:
l The list to create.

Definition at line 24 of file box_list.c.

References InitList().

Referenced by CopyListOfBoxes(), Heap2List(), ListOfBoxesCluster(), LoadListOfBoxes(), ReverseListOfBoxes(), and SampleCuikSystemInBox().

Here is the call graph for this function:

Here is the caller graph for this function:

void CopyListOfBoxes ( Tlist l_dst,
Tlist l_src 
)

Copies one list into another.

The boxes in l_src are duplicated before inserting them into l_dst.

Parameters:
l_dst The new list to create.
l_src The source list from which to copy.

Definition at line 29 of file box_list.c.

References AddLastElement(), Advance(), CopyBox(), EndOfList(), First(), GetCurrent(), InitIterator(), and InitListOfBoxes().

Here is the call graph for this function:

double ListOfBoxesVolume ( boolean used,
Tlist l 
)

Computes the sum of the volume of the boxes stored in the list.

Parameters:
used Array of booleans, one for each interval of the input boxes. If the boolean is TRUE, the corresponding interval is used in the computations. If the given pointer is NULL, all intervals are used.
l The list.
See also:
BoxVolume

Definition at line 50 of file box_list.c.

References Advance(), EndOfList(), First(), GetBoxVolume(), GetCurrent(), and InitIterator().

Here is the call graph for this function:

double ListOfBoxesMaxDiagonal ( boolean used,
Tlist l 
)

Computes the maximum diagonal for all the boxes stored in the list.

Parameters:
used Array of booleans, one for each interval of the input boxes. If the boolean is TRUE, the corresponding interval is used in the computations. If the given pointer is NULL, all intervals are used.
l The list.
See also:
BoxDiagonal

Definition at line 70 of file box_list.c.

References Advance(), EndOfList(), First(), GetBoxDiagonal(), GetCurrent(), and InitIterator().

Here is the call graph for this function:

double ListOfBoxesMaxSize ( boolean used,
Tlist l 
)

Computes the maximum size for all the boxes stored in the list.

Parameters:
used Array of booleans, one for each interval of the input boxes. If the boolean is TRUE, the corresponding interval is used in the computations. If the given pointer is NULL, all intervals are used.
l The list.
See also:
BoxSize

Definition at line 91 of file box_list.c.

References Advance(), EndOfList(), First(), GetBoxSize(), GetCurrent(), and InitIterator().

Here is the call graph for this function:

void ListOfBoxesBB ( boolean used,
Tbox b,
Tlist l 
)

Computes a box that is an axis-aligned bounding box for all boxes in a list.
This is a box constructor and, therefore box b does not need to be initialized externally before calling this function.
The dimensionality of the output box is that of the boxes in the list.
If the list is empty it returns a dimension-less box.

Parameters:
used Array of booleans, one for each interval of the input boxes. If the boolean is TRUE, the corresponding interval is used in the computations. If the given pointer is NULL, all intervals are used.
b The output box defining the bounding box for the boxes in the list for the used dimensions.
l The list.
See also:
BoxUnion

Definition at line 113 of file box_list.c.

References Advance(), BoxUnion(), CopyBox(), EndOfList(), First(), GetCurrent(), InitBox(), InitIterator(), and ListSize().

Here is the call graph for this function:

void ListOfBoxesCluster ( boolean used,
Tlist l_out,
Tlist l_in 
)

Computes a list of boxes, with one box bounding each one of the connected components defined by the boxes in the input list.
A box is included in a connected component if it has a non-null intersection with one of the boxes already in the component.

Parameters:
used Array of booleans, one for each interval of the input boxes. If the boolean is TRUE, the corresponding interval is used in the computations. If the given pointer is NULL, all intervals are used.
l_out The output list, with one box for each one of the clusters of the input list.
l_in The input list to be clustered.

Definition at line 138 of file box_list.c.

References AddLastElement(), Advance(), BoxesIntersection(), BoxUnion(), CopyBox(), DeleteBox(), EndOfList(), FALSE, First(), GetCurrent(), InitIterator(), InitListOfBoxes(), ListSize(), NEW, and TRUE.

Here is the call graph for this function:

void ConcatListOfBoxes ( Tlist l_new,
Tlist l 
)

Adds l_new at the end of l. We assume l to be properly initialized.

Parameters:
l_new The list to add.
l The list where to add.

Definition at line 230 of file box_list.c.

References AddLastElement(), Advance(), CopyBox(), EndOfList(), First(), GetCurrent(), and InitIterator().

Here is the call graph for this function:

void ReverseListOfBoxes ( Tlist l_orig,
Tlist l 
)

Reverses the order of a list.

This is a constructor and, thus, l is initialized inside the function.

Parameters:
l_orig The list to reverse.
l The ouput reversed list.

Definition at line 245 of file box_list.c.

References AddFirstElement(), Advance(), CopyBox(), EndOfList(), First(), GetCurrent(), InitIterator(), and InitListOfBoxes().

Here is the call graph for this function:

void PrintListOfBoxes ( FILE *  f,
boolean used,
char *  heading,
Tlist l 
)

Prints a list of boxes to a stream that can be stdout.

Parameters:
f The stream where to write.
used Array of booleans, one for each interval of the input boxes. If the boolean is TRUE, the corresponding interval is used in the computations. If the given pointer is NULL, all intervals are used.
heading A string to be printed before each box. Possibly NULL, in which case nothing is printed. This is used to differentiate list printed in the same file.
l The list to be printed.
See also:
PrintBox

Definition at line 265 of file box_list.c.

References Advance(), EndOfList(), First(), GetCurrent(), InitIterator(), and PrintBoxSubset().

Here is the call graph for this function:

boolean ReadListOfBoxes ( char *  filename,
Tlist l 
)

This is a constructor from a file.

Parameters:
filename The name of the file from where to read the boxes.
l The list to initialize.
Returns:
TRUE if the given file exists and it could be opened and FALSE otherwise.
See also:
ReadBox

Definition at line 286 of file box_list.c.

References AddLastElement(), FALSE, InitList(), NEW, ReadBox(), and TRUE.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void SaveListOfBoxes ( FILE *  f,
Tlist l 
)

Saves a list of boxes to a stream in binary format.

Parameters:
f The stream where to write.
l The list to be saved.
See also:
SaveBox

Definition at line 315 of file box_list.c.

References Advance(), EndOfList(), First(), GetCurrent(), InitIterator(), ListSize(), and SaveBox().

Referenced by SaveCSState().

Here is the call graph for this function:

Here is the caller graph for this function:

void LoadListOfBoxes ( FILE *  f,
Tlist l 
)

This is a constructor from a file in binary format.

Parameters:
f The binary stream from where to read the list.
l The list to be created from the binary file.
See also:
LoadBox

Definition at line 333 of file box_list.c.

References AddLastElement(), InitListOfBoxes(), and LoadBox().

Referenced by LoadCSState().

Here is the call graph for this function:

Here is the caller graph for this function:

void DeleteListOfBoxes ( Tlist l  ) 

Destructor

Parameters:
l The list to be deleted.
See also:
DeleteBox

Definition at line 352 of file box_list.c.

References DeleteBox(), DeleteCurrent(), EndOfList(), First(), GetCurrent(), and InitIterator().

Referenced by main(), MPI_SolveCuikSystem(), SampleCuikSystemInBox(), and SolveCuikSystem().

Here is the call graph for this function:

Here is the caller graph for this function: