Jive reference manual
Functions
Box utility functions

Provides a collection of functions dealing with boxes. More...

Functions

void jive::geom::findMinMaxBoxes (int &jmin, int &jmax, const util::Matrix &boxes)
 Finds the boxes with the smallest and largest size. More...
 
double jive::geom::sizeofBox (const util::Vector &box)
 Returns the size of a box. More...
 
double jive::geom::sizeofSmallestBox (const util::Matrix &boxes)
 Returns the size of the smallest box in an array of boxes. More...
 
void jive::geom::getBoxSizes (const util::Vector &sizes, const util::Matrix &boxes)
 Computes the sizes of an array of boxes. More...
 
void jive::geom::getBoxCenter (const util::Vector &center, const util::Vector &box)
 Computes the center of a box. More...
 
void jive::geom::getBoxCenters (const util::Matrix &centers, const util::Matrix &boxes)
 Computes the centers of an array of boxes. More...
 
void jive::geom::makeBox (const util::Vector &box, const util::Vector &center, double size)
 Creates a box given its center and size. More...
 
void jive::geom::makeBoxes (const util::Matrix &boxes, const util::Matrix &centers, double size)
 Creates an array of boxes with a constant size. More...
 
void jive::geom::makeBoxes (const util::Matrix &boxes, const util::Matrix &centers, const util::Vector &sizes)
 Creates an array of boxes with varying sizes. More...
 
void jive::geom::scaleBox (const util::Vector &box, double scale)
 Scales a box. More...
 
void jive::geom::scaleBoxes (const util::Matrix &boxes, double scale)
 Scales an array of boxes with a constant scale factor. More...
 
void jive::geom::scaleBoxes (const util::Matrix &boxes, const util::Vector &scales)
 Scales an array of boxes with varying scale factors. More...
 

Detailed Description

#include <jive/geom/boxes.h>

This header file exports a collection of utility functions operating on boxes. In particular, these functions can be used to:

All these operations, except the first, can be performed both for a single box and for an array of boxes.

See also
BoxManager

Function Documentation

void jive::geom::findMinMaxBoxes ( int &  jmin,
int &  jmax,
const util::Matrix boxes 
)

Returns in the output parameters jmin and jmax the indices of the smallest and largest box, respectively, in the array of boxes boxes. That is, after calling this function, the expression boxes(ALL,jmin) yields the corner points of the smallest box, and boxes(ALL,jmax) yields the corner points of the largest box.

If boxes is empty, then jmin and jmax are undefined.

Parameters
jmin- an integer reference in which the index of the smallest box is to be stored.
jmax- an integer reference in which the index of the largest box is to be stored.
boxes- an array of boxes (stored column wise).
Precondition
boxes.size(0) % 2 == 0
See also
sizeofBox()
double jive::geom::sizeofBox ( const util::Vector box)

Returns the Euclidean distance between the two corner points of the box box.

Parameters
box- a vector containing the corner points of a box.
Precondition
box.size() % 2 == 0
Returns
The size of the box box.
double jive::geom::sizeofSmallestBox ( const util::Matrix boxes)

Returns the size of the largest box in an array of boxes.

Returns the size of the smallest box in the array of boxes boxes. If boxes is empty, the return value is undefined.

Parameters
boxes- an array of boxes (stored column wise).
Precondition
boxes.size(0) % 2 == 0
Returns
The size of the smallest box in boxes.
See also
findMinMaxBoxes(), sizeofBox()

Returns the size of the largest box in the array of boxes boxes. If boxes is empty, the return value is undefined.

Parameters
boxes- an array of boxes (stored column wise).
Precondition
boxes.size(0) % 2 == 0
Returns
The size of the largest box in boxes.
See also
findMinMaxBoxes(), sizeofBox()
void jive::geom::getBoxSizes ( const util::Vector sizes,
const util::Matrix boxes 
)

Returns in the output vector sizes the sizes of the boxes stored in the input matrix boxes. That is, sizes[j] is set to the size of the box stored in boxes(ALL,j).

Parameters
sizes- a vector in which the sizes of the boxes are to be stored.
boxes- an array of boxes (stored column wise).
Precondition
boxes.size(0) % 2 == 0 &&
boxes.size(1) == sizes.size()
See also
sizeofBox()
void jive::geom::getBoxCenter ( const util::Vector center,
const util::Vector box 
)

Returns in the output vector center the coordinates of the center of the box box.

Parameters
center- a vector in which the center coordinates are to be stored.
box- a vector containing the corner points of a box.
Precondition
box.size() == 2 * center.size()
See also
getBoxCenters()
void jive::geom::getBoxCenters ( const util::Matrix centers,
const util::Matrix boxes 
)

Returns in the output matrix centers the coordinates of the centers of the boxes stored in the input matrix boxes. To be precise, centers(ALL,j) will contain the center coordinates of the box stored in boxes(ALL,j).

Parameters
centers- a matrix in which the center coordinates are to be stored.
boxes- an array of boxes (stored column wise).
Precondition
boxes.size(0) == 2 * centers.size(0) &&
bodes.size(1) == centers.size(1)
void jive::geom::makeBox ( const util::Vector box,
const util::Vector center,
double  size 
)

Returns in the output vector box the corner points of a square box with center center and size size.

Parameters
box- a vector in which the corner points of the box are to be stored.
center- the center of the box to be created.
size- the size of the box to be created.
Precondition
box.size() == 2 * center.size() &&
size >= 0.0
See also
makeBoxes()
void jive::geom::makeBoxes ( const util::Matrix boxes,
const util::Matrix centers,
double  size 
)

Returns in the output matrix boxes an array of square boxes with centers centers and size size. To be precise, boxes(ALL,j) will contain the corner points of a square box with center centers(ALL,j) and size size.

Parameters
boxes- a matrix in which the boxes are to be stored.
centers- the centers of the boxes to be created.
size- the size of the boxes to be created.
Precondition
boxes.size(0) == 2 * centers.size(0) &&
boxes.size(1) == centers.size(1) &&
size >= 0.0
void jive::geom::makeBoxes ( const util::Matrix boxes,
const util::Matrix centers,
const util::Vector sizes 
)

Returns in output matrix boxes an array of square boxes with centers centers and sizes sizes. To be precise, boxes(ALL,j) will contain the corner points of a square box with center centers(ALL,j) and size sizes[j].

Parameters
boxes- a matrix in which the boxes are to be stored.
centers- the centers of the boxes to be created.
sizes- the sizes of the boxes to be created.
Precondition
boxes.size(0) == 2 * centers.size(0) &&
boxes.size(1) == centers.size(1) &&
sizes.size() == centers.size(1) &&
testall( sizes >= 0.0 )
void jive::geom::scaleBox ( const util::Vector box,
double  scale 
)

Scales the box stored in the vector box in such a way that its center remains the same and that its size has been multiplied by scale.

Parameters
box- a vector containing the corner points of the box to be scaled.
scale- the factor with which the box is to be scaled.
Precondition
box.size() % 2 == 0 && scale >= 0.0
void jive::geom::scaleBoxes ( const util::Matrix boxes,
double  scale 
)

Scales the boxes stored column-wise in the matrix boxes in such a way that their centers remain the same and that their sizes have been multiplied by scale.

Parameters
boxes- an array of boxes (stored column wise).
scale- the factor with which the boxes are to be scaled.
Precondition
boxes.size(0) % 2 == 0 && scale >= 0.0
void jive::geom::scaleBoxes ( const util::Matrix boxes,
const util::Vector scales 
)

Scales the boxes stored column-wise in the matrix boxes in such a way that their centers remain the same and that their sizes have been multiplied by the scale factors stored in the vector scales. That is, the box stored in boxes(ALL,j) will be scaled with the factor scales[j].

Parameters
boxes- an array of boxes (stored column wise).
scales- a vector containing the scale factors.
Precondition
boxes.size(0) % 2 == 0 &&
scales.size() == boxes.size(1) &&
testall( scales >= 0.0 )