library of assembled shared sources

http://lass.cocamware.com

lass::prim::StrictMinMax Struct Reference
[MinMaxPolicy]

MinMaxPolicy enforcing strict rules for the minima and maxima. More...

#include <min_max_policy.h>


Static Public Member Functions

template<typename PointType >
static void setMin (PointType &oMin, const PointType &iMax, const PointType &iMin)
 set value oMin to iMin
Exceptions:
throw error if iMin it is in conflict with iMax.

template<typename PointType >
static void setMax (const PointType &iMin, PointType &oMax, const PointType &iMax)
 set value oMax to iMax
Exceptions:
throw error if iMax it is in conflict with iMin.

template<typename PointType >
static void checkMinMax (const PointType &iMin, const PointType &iMax)
 check if iMin and iMax are valid minima and maxima.


Detailed Description

MinMaxPolicy enforcing strict rules for the minima and maxima.

Author:
Bram de Greve
Date:
2003
The strict policy will throw exceptions if the client misbehaves to the AABB. This policy demands that you set correct minima and maxima, it demands that the minimum is indeed a minimum. An very good example of misbehaviour would be to swap minimum and maximum. But not all component values of the minimum have to be greater than the maximum. To throw an exception, it's sufficient to have only one component value of the minimum to be greater than the corresponding component value of the maximum. This can lead to subtle errors. an example:

  Aabb3D<int, StrictMinMax> aabb(Point3D<int>(1, 2, 3), Point3D<int>(4, 5, 6));
  aabb.min() = Point3D<int>(5, 5, 5);

The above example will throw an exception. The first line is correct, it constructs an AABB of which the maximum is indeed larger than the minimum. It's in the second line. Here, we try to adjust the minimum of the AABB by setting it to 3D point (5, 5, 5). The z coordinate is no problem: 5 is indeed less that 6. The y coordinate isn't a problem either: 5 is not greater than 5. It's the x coordinate that causes the trouble: 5 is greater than 4. Bang! an exception is thrown.

The rest of the class are implementation details for the AABB and should not be called by the client (you :). In short we can say of this policy: make sure that minima are minima and maxima maxima.

Definition at line 118 of file min_max_policy.h.


Member Function Documentation

template<typename PointType >
static void lass::prim::StrictMinMax::setMin ( PointType &  oMin,
const PointType &  iMax,
const PointType &  iMin 
) [inline, static]

set value oMin to iMin

Exceptions:
throw error if iMin it is in conflict with iMax.

Definition at line 124 of file min_max_policy.h.

References LASS_THROW_EX, and lass::prim::pointwiseMin().

template<typename PointType >
static void lass::prim::StrictMinMax::setMax ( const PointType &  iMin,
PointType &  oMax,
const PointType &  iMax 
) [inline, static]

set value oMax to iMax

Exceptions:
throw error if iMax it is in conflict with iMin.

Definition at line 138 of file min_max_policy.h.

References LASS_THROW_EX, and lass::prim::pointwiseMin().

template<typename PointType >
static void lass::prim::StrictMinMax::checkMinMax ( const PointType &  iMin,
const PointType &  iMax 
) [inline, static]

check if iMin and iMax are valid minima and maxima.

Exceptions:
throw error if iMin and iMax are inconsistent.

Definition at line 152 of file min_max_policy.h.

References LASS_THROW_EX, and lass::prim::pointwiseMin().


The documentation for this struct was generated from the following file:

Generated on Mon Nov 10 14:22:13 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo