Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Box< Float > Class Template Reference

#include <Box.h>

Inheritance diagram for Box< Float >:

Inheritance graph
[legend]
Collaboration diagram for Box< Float >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class Float>
class Box< Float >

An interval vector class.

A box is an axis aligned region of space represented by a vector of intervals. A generalized Box can be of any dimension. Specialized classes exist for 3D and 4D regions.

Definition at line 22 of file Box.h.

Public Member Functions

 Box ()
 Constructors.

 Box (int n)
 Construct a Box of size n.

 Box (int n, Float x)
 Construct a Box of size n with initial values x.

 Box (TNT::Vector< Float > x)
 Construct a Box from a TNT vector of doubles.

Box< Float > & operator *= (const Interval< Float > &c)
 Math operators.

Box< Float > & operator/= (const Interval< Float > &c)
 Divide the Box by an Interval.

Box< Float > & operator+= (const Interval< Float > &c)
 Add an Interval to each element of the Box.

Float width (int &dim)
 Also returns which side was longest.

Float width ()
 Convenience function to find the maximum length of the sides of the box.

Interval< Float > length ()
 This method is poorly named, but we need some equivalent to "length" of a vector.

Interval< Float > lengthSquared ()
 This method is poorly named, but we need some equivalent to "lengthSquared" of a vector.

Box< Float > normalize ()
 We need some equivalent to "normalize" for a standard vector.

Box< Float > unionWith (Box< Float > &b)
 Parts of Boxes.

void subdivide (Box< Float > &IX1, Box< Float > &IX2)
 Subdivide a box nearly in half along widest dimension.

TNT::Vector< Float > center ()
 Return the 'center' of the box as a TNT Vector.

void print ()
 Basic output.


Private Attributes

RandomStream rs
 A stream of random numbers.


Constructor & Destructor Documentation

template<class Float>
Box< Float >::Box  ) 
 

Constructors.

Used for parameter specifications.

Definition at line 16 of file Box.cpp.

template<class Float>
Box< Float >::Box int  n  ) 
 

Construct a Box of size n.

Parameters:
n The dimensionality of the Box.

Definition at line 24 of file Box.cpp.

template<class Float>
Box< Float >::Box int  n,
Float  x
 

Construct a Box of size n with initial values x.

Parameters:
n The dimensionality of the Box.
x The initial values for all dimensions of the Box.

Definition at line 33 of file Box.cpp.

template<class Float>
Box< Float >::Box TNT::Vector< Float >  x  ) 
 

Construct a Box from a TNT vector of doubles.

This is a convenience operator to convert a TNT vector to a Box.

Parameters:
x The TNT::Vector to transform into Box.

Definition at line 42 of file Box.cpp.


Member Function Documentation

template<class Float>
TNT::Vector< Float > Box< Float >::center  ) 
 

Return the 'center' of the box as a TNT Vector.

Returns:
A TNT::Vector of the 'center' of the Box.

Definition at line 226 of file Box.cpp.

Referenced by Newton::AddRoot(), Implicit::grad(), Implicit::hess(), Implicit::proc(), ADF::proc(), and Newton::SameRoot().

template<class Float>
Interval< Float > Box< Float >::length  ) 
 

This method is poorly named, but we need some equivalent to "length" of a vector.

So given a Box such as [ [xlo,xhi],[ylo,yhi],[zlo,zhi] ] we want to return an Interval which gives the closest/and furthest distance from the origin to the interval.

Returns:
An interval of the [closest,furthest] points of the Box.

Definition at line 128 of file Box.cpp.

References Interval< Type >::sqrt().

Referenced by RBF::gradphi().

template<class Float>
Interval< Float > Box< Float >::lengthSquared  ) 
 

This method is poorly named, but we need some equivalent to "lengthSquared" of a vector.

So given a Box such as [ [xlo,xhi],[ylo,yhi],[zlo,zhi] ] we want to return an Interval which gives the closest/and furthest distance from the origin to the interval, squared.

Returns:
An interval of the [closest,furthest]^2 points of the Box.

Definition at line 143 of file Box.cpp.

References Infinite< Type >::max(), Infinite< Type >::min(), and Infinite< Type >::pow().

template<class Float>
Box< Float > Box< Float >::normalize  ) 
 

We need some equivalent to "normalize" for a standard vector.

So, we divide each element of the Box by it's "length" and set the box equal to these new elements.

Returns:
The 'normal' of the box = Box / 'length of Box'

Definition at line 166 of file Box.cpp.

template<class Float>
Box< Float > & Box< Float >::operator *= const Interval< Float > &  c  ) 
 

Math operators.

Each element of the box is multiplied by the scalar. Amazingly, TNT doesn't have this operator.

Parameters:
c An Interval to multiply with each element of this box.

Definition at line 55 of file Box.cpp.

template<class Float>
Box< Float > & Box< Float >::operator+= const Interval< Float > &  c  ) 
 

Add an Interval to each element of the Box.

Parameters:
c An Interval to add to each element of this box.

Definition at line 80 of file Box.cpp.

template<class Float>
Box< Float > & Box< Float >::operator/= const Interval< Float > &  c  ) 
 

Divide the Box by an Interval.

Each element of the box is divided by the scalar.

Parameters:
c An Interval to divide into each element of this box.

Definition at line 68 of file Box.cpp.

template<class Float>
void Box< Float >::print  ) 
 

Basic output.

Appends a <CR/LF> to the end.

Definition at line 242 of file Box.cpp.

template<class Float>
void Box< Float >::subdivide Box< Float > &  IX1,
Box< Float > &  IX2
 

Subdivide a box nearly in half along widest dimension.

The two new 'halves' of the Box are returned in IX1 and IX2.

Parameters:
IX1 Left half of interval
IX2 Right half of interval
Note:
Actual subdivision happens randomly between 45% and 55% of the width. A random breaking point (hopefully) avoids problems where the split point happens to be exactly the solution point.

Definition at line 199 of file Box.cpp.

References RandomStream::next(), Box< Float >::rs, and Box< Float >::width().

template<class Float>
Box< Float > Box< Float >::unionWith Box< Float > &  b  ) 
 

Parts of Boxes.

Parameters:
b A box to union with the current box.
Returns:
A new box enclosing the two original boxes.

Definition at line 179 of file Box.cpp.

template<class Float>
Float Box< Float >::width  ) 
 

Convenience function to find the maximum length of the sides of the box.

See also:
width(int &dim)
Returns:
The size of the widest dimension.

Definition at line 114 of file Box.cpp.

Referenced by Box< Float >::subdivide().

template<class Float>
Float Box< Float >::width int &  dim  ) 
 

Also returns which side was longest.

This method takes a 'dummy' parameter which gets set to the side (index) with the largest dimension upon return.

Parameters:
dim Returns the widest dimension.
Returns:
The size of widest dimension.

Definition at line 95 of file Box.cpp.

Referenced by Newton::INewton().


Member Data Documentation

template<class Float>
RandomStream Box< Float >::rs [private]
 

A stream of random numbers.

Definition at line 25 of file Box.h.

Referenced by Box< Float >::subdivide().


The documentation for this class was generated from the following files:
Generated on Mon Jun 28 15:02:04 2004 for Advanced Surface Library by doxygen 1.3.4