Implementation of the functions operating on Tbox.
- See Also
- box.h, Tbox.
Definition in file box.c.
|
void | InitBox (unsigned int dim, Tinterval *is, Tbox *b) |
| Initializes a box. More...
|
|
void | InitBoxFromPoint (unsigned int dim, double *p, Tbox *b) |
| Initializes a box from a point. More...
|
|
void | EnlargeBox (double lo, double uo, Tbox *b) |
| Enlarges all the intervals of a box. More...
|
|
void | ExpandBox (double *p, Tbox *b) |
| Expands a box so that it includes a given point. More...
|
|
unsigned int | GetBoxBufferSize (Tbox *b) |
| Returns the size of a box when converted to an array of doubles. More...
|
|
void | Box2Buffer (unsigned int c, unsigned int n, double *buffer, Tbox *b) |
| Converts a box into an array of doubles. More...
|
|
void | Buffer2Box (unsigned int *c, unsigned int *n, double *buffer, Tbox *b) |
| Converts a buffer of doubles into a box. More...
|
|
void | CopyBox (void *b_out, void *b_in) |
| Box copy operator. More...
|
|
void | MergeBoxes (Tbox *b1, Tbox *b2, Tbox *bout) |
| Concats two boxes. More...
|
|
void | CopyBoxSubset (boolean *used, void *b_out, void *b_in) |
| Creates a box from a sub-set of a given box. More...
|
|
void | SetBoxSubset (boolean *used, Tbox *bset, Tbox *b) |
| Changes a sub-set of ranges in a given box. More...
|
|
void | SetBoxIntervals (Tinterval *is, Tbox *b) |
| Replaces the box intervals with a new set. More...
|
|
void | SetBoxInterval (unsigned int n, Tinterval *is, Tbox *b) |
| Replaces a particular interval in a box. More...
|
|
Tinterval * | GetBoxInterval (unsigned int n, Tbox *b) |
| Returns a pointer to one of the intervals defining the box. More...
|
|
Tinterval * | GetBoxIntervals (Tbox *b) |
| Returns a pointer to the array of intervals defining the box. More...
|
|
boolean | BoxesIntersection (boolean *used, Tbox *b1, Tbox *b2, Tbox *bout) |
| Computes the box intersection of two given boxes. More...
|
|
void | BoxUnion (boolean *used, Tbox *b1, Tbox *b2, Tbox *b_out) |
| Computes the box union of two given boxes. More...
|
|
boolean | PointInBox (boolean *used, unsigned int n, double *v, double tol, Tbox *b) |
| Checks if a point is included in a(sub-) box. More...
|
|
boolean | PointInBoxTopology (boolean *used, boolean update, unsigned int n, double *v, double tol, unsigned int *tp, Tbox *b) |
| Checks if a point is included in a(sub-) box. More...
|
|
unsigned int | OutOfBoxTopology (boolean *used, unsigned int n, double *v, unsigned int *tp, signed int *s, Tbox *b) |
| Determines the violated box limit. More...
|
|
boolean | PointInSubBox (boolean *used, Tvector *v, double tol, Tbox *b) |
| Checks if a point is included in a (sub-)box. More...
|
|
double | DistanceToSubBoxCenter (boolean *used, Tvector *v, Tbox *b) |
| Computes the distance from a point to the center of a (sub-)box. More...
|
|
boolean | IsPunctualBox (boolean *used, double epsilon, Tbox *b) |
| Checks if a (sub-)box is (almost) punctual. More...
|
|
boolean | BoxInclusion (boolean *used, Tbox *b1, Tbox *b2) |
| Checks if a (sub-)box is fully included in another box. More...
|
|
double | GetBoxSize (boolean *used, Tbox *b) |
| Computes the size of the box. More...
|
|
double | GetBoxMaxSizeVarSet (Tvariable_set *vars, Tbox *b) |
| Computes the size of the box. More...
|
|
double | GetBoxMinSizeVarSet (Tvariable_set *vars, Tbox *b) |
| Computes the minimum size of the box. More...
|
|
double | GetBoxDiagonal (boolean *used, Tbox *b) |
| Computes the diagonal of a (sub-)box. More...
|
|
unsigned int | GetBoxLevel (Tbox *b) |
| Returns the box level. More...
|
|
void | RandomPointInBox (boolean *used, double *c, Tbox *b) |
| Returns the a random point along the selected dimensions. More...
|
|
void | GetBoxCenter (boolean *used, double *c, Tbox *b) |
| Returns the box center along the selected dimensions. More...
|
|
double | GetBoxCenterDistance (boolean *used, Tbox *b1, Tbox *b2) |
| Computes distance between the center of two (sub-)boxes. More...
|
|
double | SquaredDistancePointToBox (double t, double *p, Tbox *b) |
| Distance from a point to a box. More...
|
|
double | DistancePointToBox (double *p, Tbox *b) |
| Distance from a point to a box. More...
|
|
double | SquaredDistanceToBoxDimensionTopology (unsigned int dim, double p, unsigned int *tp, Tbox *b) |
| Squared distance from a value to a given box dimension. More...
|
|
double | SquaredDistancePointToBoxTopology (double t2, double *p, unsigned int *tp, Tbox *b) |
| Squared distance from a point to a box. More...
|
|
double | DistancePointToBoxTopology (double *p, unsigned int *tp, Tbox *b) |
| Distance from a point to a box. More...
|
|
double | GetBoxVolume (boolean *used, Tbox *b) |
| Computes the volume of the box. More...
|
|
double | GetBoxSumSide (boolean *used, Tbox *b) |
| Computes the sum of the sides of the box. More...
|
|
unsigned int | GetBoxNIntervals (Tbox *b) |
| Box dimensionality. More...
|
|
unsigned int | GetBoxMaxDim (boolean *used, Tbox *b) |
| The dimension of the (sub-)box along which the box has maximum size. More...
|
|
unsigned int | GetBoxSplitDim (boolean *used, Tbox *b) |
| Computes the box dimension for which it is better to split the box. More...
|
|
void | SplitBox (unsigned int n, double r, Tbox *b1, Tbox *b2, Tbox *b) |
| Splits a box. More...
|
|
void | ScaleBox (double max_upper, Tbox *b) |
| Scales a box. More...
|
|
void | AddMargin2Box (double m, Tbox *b) |
| Adds a margin to all dimensions of a box. More...
|
|
boolean | CmpBoxDepthFirst (void *b1, void *b2, void *userData) |
| Determines which box to explore first in depth first mode. More...
|
|
boolean | CmpBoxBreadthFirst (void *b1, void *b2, void *userData) |
| Determines which box to explore first in breadth first mode. More...
|
|
void | PrintBox (FILE *f, Tbox *b) |
| Prints a box. More...
|
|
void | PrintBoxSubset (FILE *f, boolean *used, char **varNames, Tbox *b) |
| Prints a (sub-)box. More...
|
|
int | ReadBox (FILE *f, Tbox *b) |
| Reads a box from a file. More...
|
|
void | SaveBox (FILE *f, Tbox *b) |
| Saves a box in binary format. More...
|
|
void | LoadBox (FILE *f, Tbox *b) |
| Reads a box in binary format. More...
|
|
void | DeleteBox (void *b) |
| Destructor. More...
|
|
Creates a new box with the given parameters.
- Parameters
-
dim | Dimension of the new box (i.e., number of intervals). |
is | Vector of intervals used to initilize the new box. If the pointer is NULL the box intervals are set to [0,0]. |
b | The box to initialize. |
Definition at line 23 of file box.c.
References Tbox::is, Tbox::level, Tbox::n, NEW, and NewInterval().
Referenced by BoxFromVariables(), CSRemoveLCVars(), DefinePolytope(), ListOfBoxesBB(), main(), MPI_SolveCuikSystem(), MPI_TreatBox(), NewtonInWorld(), ReadBox(), RegenerateSolution(), and SolveCuikSystem().
void InitBoxFromPoint |
( |
unsigned int |
dim, |
|
|
double * |
p, |
|
|
Tbox * |
b |
|
) |
| |
Creates a new box with punctual intervals from a given vector.
- Parameters
-
dim | Dimension of the new box (i.e., number of intervals). |
p | The point to use to initialize the box. |
b | The box to initialize. |
Definition at line 43 of file box.c.
References Tbox::is, Tbox::level, Tbox::n, NEW, and NewInterval().
Referenced by AdjustBioWorldGeometry(), CuikNewtonInBox(), CutPolytopeWithFace(), DetectLinksAndJointsFromResidues(), RegenerateSolutionPoint(), SaveSamplesInt(), and WorldDOF2Sol().
void EnlargeBox |
( |
double |
lo, |
|
|
double |
uo, |
|
|
Tbox * |
b |
|
) |
| |
Enlarges all the intervals of the box by substracting/adding a given value to their lower/upper limits.
- Parameters
-
lo | The offset to add to all interval lower limits. |
uo | The offset to add to all interval upper limits. |
b | The box to modify. |
- See Also
- EnlargeInterval.
Definition at line 59 of file box.c.
References EnlargeInterval(), Tbox::is, and Tbox::n.
void ExpandBox |
( |
double * |
p, |
|
|
Tbox * |
b |
|
) |
| |
unsigned int GetBoxBufferSize |
( |
Tbox * |
b | ) |
|
In a multiprocessors system, the master and the slave processors exchange boxes and they do so by converting boxes into arrays of doubles. This function returns the number of doubles that takes a box when converted to into doubles. Typically, in the array of doubles we store some heading information plus the lower and upper limits for each one of the intervals in the box.
- Parameters
-
b | The box to convert to an array of doubles. |
- Returns
- The number of doubles that the box conversion will use.
- See Also
- Box2Buffer, Buffer2Box
Definition at line 76 of file box.c.
References Tbox::n.
Referenced by MPI_SolveCuikSystem(), and MPI_TreatBox().
void Box2Buffer |
( |
unsigned int |
c, |
|
|
unsigned int |
n, |
|
|
double * |
buffer, |
|
|
Tbox * |
b |
|
) |
| |
Packs a box into an array of doubles and adds some heading information to the array.
- Parameters
-
c | Status information related to the box (EMPTY_BOX, REDUCED_BOX, etc.). |
n | Process information related to the box. Right now this is used to store the number of time a box is reduced in a slave processors before it is returned to the master processors. The master collects this informations into a global statistics. |
buffer | The buffer of doubles where the box is to be stored. The size of this buffer should be, at least, the number returned by GetBoxBufferSize. |
b | The box to convert to an array of doubles. |
- See Also
- GetBoxBufferSize
Definition at line 81 of file box.c.
References EMPTY_BOX, Error(), ERROR_IN_PROCESS, Tbox::is, Tbox::level, LowerLimit(), Tbox::n, REDUCED_BOX, REDUCED_BOX_WITH_SOLUTION, and UpperLimit().
Referenced by MPI_SolveCuikSystem(), and MPI_TreatBox().
void Buffer2Box |
( |
unsigned int * |
c, |
|
|
unsigned int * |
n, |
|
|
double * |
buffer, |
|
|
Tbox * |
b |
|
) |
| |
Converts an array of doubles into a box.
This is not a box constructor. The box is to be initialized before calling this function and if the box size and the buffer size do not match this function will trigger an error. The idea is to convert a box into a buffer, send it to slave processor, and then update the box with the information sent by the slave.
- Parameters
-
c | Recovers the box status (EMPTY_BOX, REDUCED_BOX, etc.) from the buffer. |
n | Recovers process information related to the box. Right now it returns the number box reductions applied in the slave processors in order to crop the box. |
buffer | The buffer from which the box is to be defined. |
b | The output box. |
- See Also
- GetBoxBufferSize
Definition at line 122 of file box.c.
References EMPTY_BOX, Error(), ERROR_IN_PROCESS, Tbox::is, Tbox::level, Tbox::n, NewInterval(), REDUCED_BOX, and REDUCED_BOX_WITH_SOLUTION.
Referenced by MPI_SolveCuikSystem(), and MPI_TreatBox().
void CopyBox |
( |
void * |
b_out, |
|
|
void * |
b_in |
|
) |
| |
Copies one box into another. This is a copy constructor and, therefore, the output box is initialized inside the CopyBox (i.e., there is no need to init the box beforehand).
The parameters are given as a void pointers to define a generic copy function that is used in box list or box vectors.
- Parameters
-
b_out | Output box. Box constructed by the copy. |
b_in | Input box. Box used to create b_out. |
Definition at line 160 of file box.c.
References NEW.
Referenced by ConcatListOfBoxes(), CopyListOfBoxes(), CopyPolytope(), CropEquation(), CuikNewtonInBox(), Heap2List(), IncrementalSampleCuikSystemInBox(), InitHeapOfBoxes(), ListOfBoxesBB(), ListOfBoxesCluster(), main(), MergeBoxes(), NewCP(), PostProcessBox(), ReduceBox(), ReduceBoxEquationWise(), ReverseListOfBoxes(), SampleCuikSystemInBox(), and SetPolytopeBB().
void CopyBoxSubset |
( |
boolean * |
used, |
|
|
void * |
b_out, |
|
|
void * |
b_in |
|
) |
| |
This is a constructor that builds a box form a subset of intervals of a given box.
The parameters are given as a void pointers to define a generic copy function that is used in box list or box vectors.
- Parameters
-
used | Array of booleans, one for each interval of the input box (b_in). If the boolean is TRUE, the corresponding interval is used in the selective copy. If the given pointer is NULL, all intervals are used (i.e., in this case CopyBoxSubset is the same as CopyBox). |
b_out | Output box. Box constructed by the copy. |
b_in | Input box. Box used to create b_out. |
Definition at line 210 of file box.c.
References CopyInterval(), and NEW.
Replaces the ranges selected by the flags used of box by the ranges in box bset. Box bset only need to have as many ranges as flags to TRUE in used but the array of flags need as many entries as elements in b.
- Parameters
-
used | Array of booleans, one for each interval of the input box (b_in). If the boolean is TRUE, the corresponding interval is used in the selective copy. If the given pointer is NULL, all intervals are used (i.e., in this case CopyBoxSubset is the same as CopyBox). |
bset | The box with the new sub-set of ranges. |
b | The box to modify. |
Definition at line 238 of file box.c.
References CopyInterval(), Tbox::is, and Tbox::n.
Referenced by CuikNewtonInBox().
Replaces the box intervals with a new set of intervals.
- Parameters
-
is | Array with the new set of intervals. The array must have as many elements as those in the box, otherwise the effect of SetBoxIntervals is undefined. |
b | The box to be modified. |
Definition at line 253 of file box.c.
References Tbox::is, and Tbox::n.
Replaces a particular interval in a box by the given one.
- Parameters
-
n | The index of the interval to replace. |
is | The new interval. |
b | The box to be modified. |
Definition at line 259 of file box.c.
References CopyInterval(), Error(), and Tbox::is.
Referenced by BoxFromVariables(), CSRemoveLCVars(), CuikNewtonInBox(), DefinePolytope(), IncrementalSampleCuikSystemInBox(), main(), NewtonInWorld(), RegenerateJointBox(), RegenerateLinkBoxLinks(), RegenerateLinkBoxQLinks(), RegenerateSolution(), and UpdateOriginalFromSimple().
Returns a pointer to the n interval of the box.
- Parameters
-
n | The interval to retrive. |
b | The box. |
- Returns
- A pointer to the required interval or NULL if n is larger than the box dimensionality.
Note that we give access directly to the box internal structures. This allow to directly modify the interval. If you free the pointer, the behavior will be undefined.
Definition at line 270 of file box.c.
References Error(), and Tbox::is.
Referenced by CSRemoveVarsWithCtRange(), CuikNewtonInBox(), ErrorInInequalities(), ErrorInSolution(), EvaluateEqMin(), GetSCpSystem(), IncrementalSampleCuikSystemInBox(), InitBTree(), InitRRT(), InitSampleFromBox(), IsSimplificable(), LoadRRT(), main(), MoveWorld(), NewCP(), NewtonInWorld(), PointInSystemBox(), PrintWorldAxes(), ReduceBox(), ReduceBoxEquationWise(), ReduceRange(), RegenerateJointBox(), RegenerateLinkBoxQLinks(), RegenerateSolutionPoint(), SampleCuikSystemInBox(), SimpleFromOriginal(), SimplexGetOptimalValue(), SimplifyCuikSystem(), UpdateOriginalFromSimple(), and VariablesFromBox().
Returns a pointer to the intervals defining the box. This allows fast access to the whole set of intervals of the box, i.e., we do not have to access them one at a time.
- Parameters
-
- Returns
- A pointer to the array of intervals.
Note that we give access directly to the box internal structures. This allow to directly modify the interval. If you free the pointer, the behavior will be undefined.
Definition at line 284 of file box.c.
References Tbox::is.
Referenced by AddEquation2Simplex(), ComputeSplitDimInt(), CropEquation(), CropLinearConstraint(), EvaluateEqMin(), GetFirstOrderApproximationToEquation(), LinearizeBilinealMonomialEquation(), LinearizeCircleEquation(), LinearizeGeneralEquation(), LinearizeGeneralEquationInt(), LinearizeParabolaEquation(), LinearizeSaddleEquation(), LinearizeSphereEquation(), RegenerateLinkBoxLinks(), SetSimplexBounds(), UpdateOriginalFromSimple(), and UpdateSplitWeight().
The intersection of two boxes is a box (possibly empty). This function computes the intersection of two given boxes, along a sub-set of its intervals.
The two input boxes must have the same dimensionality.
- 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 intersection. The non-used intervals are undefined in the output. If the given pointer is NULL, all intervals are used. |
b1 | The first box to be intersected. |
b2 | The second box to be intersected. |
bout | The box resulting from the intersection. |
- Returns
- Returns TRUE if the boxes actually intersect (i.e., if the output box is not empty).
- See Also
- Intersection
Definition at line 293 of file box.c.
References Error(), Intersection(), Tbox::is, Tbox::n, and TRUE.
Referenced by ListOfBoxesCluster().
The union of two boxes is a box. This function computes the union of two given boxes, along a sub-set of its intervals.
The two input boxes must have the same dimensionality.
Note that the union of two boxes is never empty (if the input boxes are not empty).
- 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 intersection. The non-used intervals are undefined in the output. If the given pointer is NULL, all intervals are used. |
b1 | The first box to be intersected. |
b2 | The second box to be intersected. |
b_out | The box resulting from the intersection. |
- See Also
- Union
Definition at line 314 of file box.c.
References Error(), Tbox::is, Tbox::n, and Union().
Referenced by ListOfBoxesBB(), and ListOfBoxesCluster().
Checks if a point (defined by an array of n doubles) is included in a 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 check. If the given pointer is NULL, all intervals are used. |
n | Length of the array of doubles. It must be the same as the box dimensionality. |
v | The array of doubles defining the point. |
tol | Tolerance in the comparison. |
b | The box. |
- Returns
- TRUE if the point is inside the(sub-)box.
Definition at line 332 of file box.c.
References Error(), Tbox::is, IsInside(), Tbox::n, and TRUE.
Referenced by CuikNewtonInBox(), and InitWorldFromMolecule().
boolean PointInBoxTopology |
( |
boolean * |
used, |
|
|
boolean |
update, |
|
|
unsigned int |
n, |
|
|
double * |
v, |
|
|
double |
tol, |
|
|
unsigned int * |
tp, |
|
|
Tbox * |
b |
|
) |
| |
Checks if a point (defined by an array of n doubles) is included in a box taking into accont the topology of each variable.
If the point can be made to enter the box by adjusting the angular variables (adding/substracting 2*pi), the given point (v) is modified and at the end of the function it contains the values tha make the point to be inside the 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 check. If the given pointer is NULL, all intervals are used. |
update | TRUE if the input point has to be updated using the topology. |
n | Length of the array of doubles. It must be the same as the box dimensionality. |
v | The array of doubles defining the point. |
tol | Tolerance in the comparison. |
tp | The topology for each variable. |
b | The box. |
- Returns
- TRUE if the point is inside the (sub-)box.
Definition at line 350 of file box.c.
References ANGLE_ACCURACY, Error(), FALSE, Tbox::is, IsInside(), LowerLimit(), M_2PI, M_PI, Tbox::n, NEW, PI2PI, TOPOLOGY_R, TRUE, and UpperLimit().
Referenced by AddBranchToRRT(), AtlasRRT(), AtlasRRTstar(), AtlasTRRT(), cBiRRT(), ccRRT(), ccTRRT(), ConnectSamples(), ConnectSamplesChart(), ExtendAtlasFromPoint(), GradientSmooth(), InitChartInt(), InitRRT(), main(), NewChartFromPoint(), NewTemptativeSample(), and RRTstar().
unsigned int OutOfBoxTopology |
( |
boolean * |
used, |
|
|
unsigned int |
n, |
|
|
double * |
v, |
|
|
unsigned int * |
tp, |
|
|
signed int * |
s, |
|
|
Tbox * |
b |
|
) |
| |
For a point aut of the box, we determine the dimension for which the point is out of the box.
We assume that the point is out of the box only in one of the dimensions. This is typically the case when tracing rays from inside the box to out of the box, where the point out of the box is acurately located via dichotomics search.
- 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 check. If the given pointer is NULL, all intervals are used. |
n | Length of the array of doubles. It must be the same as the box dimensionality. |
v | The array of doubles defining the point. |
tp | The topology for each variable. |
s | [Output] -1 if the lower limit of the interval is violated and +1 if the upper limit is violated. |
b | The box. |
- Returns
- The dimension along which the point is out of the box.
Definition at line 421 of file box.c.
References ANGLE_ACCURACY, Tbox::is, LowerLimit(), M_2PI, M_PI, NO_UINT, PI2PI, TOPOLOGY_R, and UpperLimit().
Checks if a point (defined by an array of doubles) is included in a (sub-)box. The (sub-)box is selected using an array of flags.
The difference with PointInBox is that v only need to include as many elements as TRUE elements in the used array. Moreover, here the point is defined as a Tvector and not as an array of doubles. The Tvector is used to facilitate the queries from the sample structures that store the configurations in the form of vectors.
- 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 check. If the given pointer is NULL, all intervals are used. |
v | The vector defining the point. |
tol | Tolerance in the comparisons. |
b | The box. |
- Returns
- TRUE if the point is inside the (sub-)box.
- See Also
- PointInBox, Tvector, Tsample
Definition at line 521 of file box.c.
References GetVectorElement(), Tbox::is, IsInside(), and TRUE.
Computes the distance from a point to the center of a (sub-)box. The (sub-)box is selected using an array of flags.
The point is described using an vector of doubles with one entry for each one of the dimensions to be checked. The Tvector is used to facilitate the queries from the sample structures that store the configurations in the form of vectors.
- 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 check. If the given pointer is NULL, all intervals are used. |
v | The vector defining the point. |
b | The box. |
- Returns
- The distance of the point to the center of the (sub-)box.
- See Also
- Tvector
Definition at line 542 of file box.c.
References GetVectorElement(), IntervalCenter(), Tbox::is, and Tbox::n.
Returns TRUE if the input box is (amost) punctual along the selected dimensions. A punctual interval is an interval whose size is below epsilon.
- 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 check. If the given pointer is NULL, all intervals are used. |
epsilon | The threshold to decide when an interval is punctual. |
b | The box. |
- Returns
- TRUE if the all selected ranges in the (sub-)box have size below epsilon.
Definition at line 566 of file box.c.
References IntervalSize(), Tbox::is, and TRUE.
Returns TRUE if the the first box is fully included in the second 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 check. If the given pointer is NULL, all intervals are used. |
b1 | The small box, the one to be fully sourrounded by b2. |
b2 | The box that is to include b1. |
- Returns
- TRUE b1 is fully included in b2.
Definition at line 586 of file box.c.
References IntervalInclusion(), Tbox::is, and Tbox::n.
Referenced by ReduceBox().
Determines the largest box side, among the sub-set of intervals selected via the array of booleans used.
- 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 box. |
- Returns
- The box size.
Definition at line 607 of file box.c.
References GetBoxMaxDim(), IntervalSize(), Tbox::is, and Tbox::n.
Referenced by HeapOfBoxesMaxSize(), ListOfBoxesMaxSize(), MaxReduction(), MaxWorldReduction(), MPI_SolveCuikSystem(), PostProcessBox(), ReduceBox(), ReduceBoxEquationWise(), and SolveCuikSystem().
unsigned int GetBoxLevel |
( |
Tbox * |
b | ) |
|
void RandomPointInBox |
( |
boolean * |
used, |
|
|
double * |
c, |
|
|
Tbox * |
b |
|
) |
| |
Computes a random point along the selected dimensions.
- 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. |
c | Space where to store the random point (should be allocated by the caller with, at least, space for the point along the selected dimensions). |
b | The box. |
Definition at line 682 of file box.c.
References Tbox::is, Tbox::n, and randomInInterval().
Referenced by RandomPointInPolytope(), and RRTSample().
void GetBoxCenter |
( |
boolean * |
used, |
|
|
double * |
c, |
|
|
Tbox * |
b |
|
) |
| |
Computes the box center along the selected dimensions.
- 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. |
c | Space where to store the center (should be allocated by the caller with, at least, space for the center along the selected dimensions). |
b | The box. |
Definition at line 697 of file box.c.
References IntervalCenter(), Tbox::is, and Tbox::n.
Referenced by LoadSamples(), main(), and MoveWorld().
Determines the distance between the cener of two (sub-)boxes determined using the array used.
- 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. |
b1 | One of the boxes. |
b2 | The other box. |
- Returns
- The (sub-)box center distance.
Definition at line 715 of file box.c.
References Error(), IntervalCenter(), Tbox::is, and Tbox::n.
double SquaredDistancePointToBox |
( |
double |
t2, |
|
|
double * |
p, |
|
|
Tbox * |
b |
|
) |
| |
Computes the square of the minimum distance from a point to a box.
- Parameters
-
t2 | Threshold. Only poits closer than 't' to the box are relevant. Use INF if all points must be considered. Using a threshold accelerates the computation. This value is a squared distance!. |
p | The point. |
b | The box. |
- Returns
- The minimum distance between the input parameters.
- See Also
- DistancePointToBox
Definition at line 738 of file box.c.
References DistanceToInterval(), Tbox::is, and Tbox::n.
Referenced by DistancePointToBox().
double DistancePointToBox |
( |
double * |
p, |
|
|
Tbox * |
b |
|
) |
| |
double SquaredDistanceToBoxDimensionTopology |
( |
unsigned int |
dim, |
|
|
double |
p, |
|
|
unsigned int * |
tp, |
|
|
Tbox * |
b |
|
) |
| |
Squared distance of a value to the interval defining a box along a given dimension.
- Parameters
-
dim | The dimension. |
p | The point. |
tp | The topology of the space where the box and the point are defined. |
b | The box. |
- Returns
- The squared distance from the value to the interval.
Definition at line 758 of file box.c.
References ANGLE_ACCURACY, Tbox::is, LowerLimit(), M_2PI, M_PI, PI2PI, TOPOLOGY_R, and UpperLimit().
double SquaredDistancePointToBoxTopology |
( |
double |
t, |
|
|
double * |
p, |
|
|
unsigned int * |
tp, |
|
|
Tbox * |
b |
|
) |
| |
Computes the minimum squared distance from a point to a box but considering a possible special topology for the input box and the input point.
- Parameters
-
t | Threshold. Only poits closer than 't' to the box are relevant. Use INF if all points must be considered. Using a threshold accelerates the computation. |
p | The point. |
tp | The topology of the space where the box and the point are defined. |
b | The box. |
- Returns
- The minimum distance between the input parameters.
Definition at line 833 of file box.c.
References ANGLE_ACCURACY, Tbox::is, LowerLimit(), M_2PI, M_PI, Tbox::n, PI2PI, TOPOLOGY_R, and UpperLimit().
Referenced by DistancePointToBoxTopology().
double DistancePointToBoxTopology |
( |
double * |
p, |
|
|
unsigned int * |
tp, |
|
|
Tbox * |
b |
|
) |
| |
Determines the volume of a box (i.e., the product of the box sides), for a sub-set of intervals selected via the array of booleans used.
- 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 box. |
- Returns
- The box volume.
Definition at line 956 of file box.c.
References IntervalSize(), Tbox::is, and Tbox::n.
Referenced by HeapOfBoxesVolume(), ListOfBoxesVolume(), MPI_SolveCuikSystem(), PolytopeMaxVolume(), PostProcessBox(), ReduceBox(), ReduceBoxEquationWise(), and SolveCuikSystem().
Determines the sum of the sides of the box, for a sub-set of intervals selected via the array of booleans used.
This function is used to determine if a box shrinks in any of its sides and it provides information even if the box is 0-size along any of its dimensions, while GetBoxVolume does not. Intuitively, GetBoxVolume corresponds to the determinant and GetBoxSumSide to the trace of a matrix. They provide different norms useful for different purposes.
- 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 box. |
- Returns
- The sum of the sides.
Definition at line 974 of file box.c.
References IntervalSize(), Tbox::is, and Tbox::n.
Referenced by IncrementalSampleCuikSystemInBox().
unsigned int GetBoxNIntervals |
( |
Tbox * |
b | ) |
|
Returns the box dimensionality, i.e., the number of intervals defining the box.
- Parameters
-
- Returns
- The box dimensionality.
Definition at line 992 of file box.c.
References Tbox::n.
Referenced by AnimateWorld(), CropEquation(), CuikNewtonInBox(), ErrorInInequalities(), ErrorInSolution(), GetFirstOrderApproximationToEquation(), InitAtlasRRT(), InitBTree(), InitRRT(), InitSampleFromBox(), LinearizeBilinealMonomialEquation(), LinearizeCircleEquation(), LinearizeGeneralEquation(), LinearizeParabolaEquation(), LinearizeSaddleEquation(), LinearizeSphereEquation(), LoadCSState(), LoadRRT(), LoadSamples(), main(), MoveWorld(), PointInSystemBox(), SetSimplexBounds(), and UpdateSplitWeight().
Returns dimension of the (sub-)box along which the box has maximum size.
- 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 box. |
- Returns
- The dimension of the box with maximal size. If the box is dimension-less this function returns NO_UINT.
Definition at line 1000 of file box.c.
References IntervalSize(), Tbox::is, Tbox::n, and NO_UINT.
Referenced by GetBoxSize(), and GetBoxSplitDim().
unsigned int GetBoxSplitDim |
( |
boolean * |
used, |
|
|
Tbox * |
b |
|
) |
| |
Computes the box dimension for which it is better to split the box. Right now this function is an alias to GetBoxMaxDim.
- 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 box. |
- Returns
- The best split dimension for the given box.
- See Also
- GetBoxMaxDim
Definition at line 1030 of file box.c.
References GetBoxMaxDim().
void SplitBox |
( |
unsigned int |
n, |
|
|
double |
r, |
|
|
Tbox * |
b1, |
|
|
Tbox * |
b2, |
|
|
Tbox * |
b |
|
) |
| |
Splits a given box in two sub-boxes. This can be seen as a constructor method, that is, the two sub-boxes are created (or initilized) inside this function.
If the dimension for which we want to split the box is larger than the box dimensionality this functions generates an error.
If the cut point is outside th box (i.e., r is below 0 or larger than 1) this functions generates an error.
- Parameters
-
n | The dimension |
r | A double in (0,1) defining the cut point along dimension n given in relative to the box size along this dimension. |
b1 | The first resulting box. This is a copy of b but for dimension n where this box only includes the lower part of the original interval. |
b2 | The second resulting box.This is a copy of b but for dimension n where this box only includes the upper part of the original interval. |
b | The original box to split. |
Definition at line 1040 of file box.c.
References Error(), Tbox::is, Tbox::level, LowerLimit(), Tbox::n, NEW, NewInterval(), PointInInterval(), and UpperLimit().
Referenced by PostProcessBox().
void ScaleBox |
( |
double |
max_upper, |
|
|
Tbox * |
b |
|
) |
| |
Scales a box for all its dimensions with the given scale factor.
- Parameters
-
max_upper | The scale factor |
b | The box to scale. |
Definition at line 1085 of file box.c.
References IntervalScale(), Tbox::is, and Tbox::n.
void AddMargin2Box |
( |
double |
m, |
|
|
Tbox * |
b |
|
) |
| |
boolean CmpBoxDepthFirst |
( |
void * |
b1, |
|
|
void * |
b2, |
|
|
void * |
userData |
|
) |
| |
Returns TRUE if box b1 is to be explored first in depth first.
This is to be used as a LessThan operator in a heap of boxes.
- Parameters
-
b1 | The first box. |
b2 | The second box. |
userData | The pointer to the data to pass to the LessThan operator as a third parameter. In this particular LessThan this parameter is not used. |
- Returns
- TRUE if the first parameter is to be explored before than the second one when in depth first mode.
- See Also
- box_heap.h, Theap.
Definition at line 1105 of file box.c.
Referenced by MPI_SolveCuikSystem(), and SolveCuikSystem().
boolean CmpBoxBreadthFirst |
( |
void * |
b1, |
|
|
void * |
b2, |
|
|
void * |
userData |
|
) |
| |
Returns TRUE if box b1 is to be explored first in breadth first.
This is to be used as a LessThan operator in a heap of boxes.
- Parameters
-
b1 | The first box. |
b2 | The second box. |
userData | The pointer to the data to pass to the LessThan operator as a third parameter. In this particular LessThan this parameter is not used. |
- Returns
- TRUE if the first parameter is to be explored before than the second one when in breadth first mode.
- See Also
- box_heap.h, Theap.
Definition at line 1110 of file box.c.
Referenced by MPI_SolveCuikSystem(), and SolveCuikSystem().
void PrintBox |
( |
FILE * |
f, |
|
|
Tbox * |
b |
|
) |
| |
Writes a box in file f, that can be stdout. The ouput is of the form {n [l1,u1]...[ln,un]} where n is the dimensionality of the box and [lx,ux] are the intervals defining the box.
All along CuikSuite print/read funtions are used to print/read in ASCII format and save/load are equivalen funcitions in binary format.
- Parameters
-
f | The stream where to write. |
b | The box to write. |
Definition at line 1118 of file box.c.
References Tbox::is, Tbox::n, and PrintInterval().
Referenced by IncrementalSampleCuikSystemInBox(), main(), MPI_SolveCuikSystem(), MPI_TreatBox(), NewtonInWorld(), PostProcessBox(), ReduceBox(), ReduceBoxEquationWise(), SampleCuikSystemInBox(), SavePolytope(), SaveSamplesInt(), and SolveCuikSystem().
void PrintBoxSubset |
( |
FILE * |
f, |
|
|
boolean * |
used, |
|
|
char ** |
varNames, |
|
|
Tbox * |
b |
|
) |
| |
Writes a box in file f, that can be stdout. The ouput is of the form {n v1:[l1,u1]...vn:[ln,un]} where n is the dimensionality of the box vx is the name of the variable for dimension x and [lx,ux] is the corresponding interval. The variable names are only printed if vars is not NULL.
All along CuikSuite print/read funtions are used to print/read in ASCII format and save/load are equivalen funcitions in binary format.
- 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 print. If the given pointer is NULL, all intervals are used. |
varNames | The name for variables. |
b | The box to write. |
Definition at line 1138 of file box.c.
References Tbox::is, Tbox::n, PRINT_VARIABLE_NAME, and PrintInterval().
Referenced by AdjustBioWorldGeometry(), IncrementalSampleCuikSystemInBox(), main(), on_cuikmove_save(), PostProcessBox(), PrintHeapOfBoxes(), and PrintListOfBoxes().
int ReadBox |
( |
FILE * |
f, |
|
|
Tbox * |
b |
|
) |
| |
Read a box from file f. The format of the boxes in the file is the same as that printed by PrintBox or PrintBoxSubset.
This function can be seen as a constructor, i.e., it generates a new box.
- Parameters
-
f | The stream from which to read the box. |
b | The box to read. |
- Returns
- EOF if the file finishes before the box could be read.
Definition at line 1172 of file box.c.
References Error(), InitBox(), NEW, and NewInterval().
Referenced by LoadPolytope(), main(), and ReadListOfBoxes().
void SaveBox |
( |
FILE * |
f, |
|
|
Tbox * |
b |
|
) |
| |
void LoadBox |
( |
FILE * |
f, |
|
|
Tbox * |
b |
|
) |
| |
void DeleteBox |
( |
void * |
b | ) |
|
Deletes a previously generated box (either via InitBox, ReadBox, CopyBox,...).
- Parameters
-
Definition at line 1259 of file box.c.
Referenced by AdjustBioWorldGeometry(), ComputeSplitDim(), CropEquation(), CSRemoveLCVars(), CuikNewton(), CuikNewtonInBox(), CutPolytopeWithFace(), DeleteAtlas(), DeleteAtlasRRT(), DeleteBioWorld(), DeleteCP(), DeleteListOfBoxes(), DeletePolytope(), DeleteRRT(), GetSolutionPointFromLinkTransforms(), GradientSmooth(), IncrementalSampleCuikSystem(), IncrementalSampleCuikSystemInBox(), InitHeapOfBoxes(), ListOfBoxesCluster(), main(), MaxReduction(), MergeBoxes(), MoveWorldDOF(), MPI_SolveCuikSystem(), MPI_TreatBox(), NewtonInWorld(), on_cuikmove_save(), PostProcessBox(), RandomSmooth(), ReduceBox(), ReduceBoxEquationWise(), RegenerateSolution(), RegenerateSolutionPoint(), SampleCuikSystem(), SampleCuikSystemInBox(), SaveSamplesInt(), SetPolytopeBB(), ShortcutSmooth(), SimplifyCuikSystem(), SolveCuikSystem(), and WorldErrorFromDOFs().
|
Follow us!