Mathematics class CATMathBox2D

Usage: you must use this class as is. You should never derive it.


public class CATMathBox2D

Class representing a 2D box, parallel to the canonical axis.
Role:
The box is defined by two CATMathPoint, the first (XMin, YMin) called the low extremity, and the other one ((XMax, YMax)) called the high extremity.
A box can be seen as a set. If one of the cooordinates of the low extremity is greater than the corresponding coordinate of the high extremity, the box is empty. In other words, a box is not empty if XMin < XMax and YMin < YMax .


Constructor and Destructor Index


o CATMathBox2D()
Constructs an empty CATMathBox2D.
o CATMathBox2D(CATMathBox2D&)
Copy Constructor.
o CATMathBox2D(double,double,double,double)
Constructs a CATMathBox2D from its extremities.
o CATMathBox2D(CATMathPoint2D&,CATMathPoint2D&,CATBoolean)
Constructs a CATMathBox2D from two CATMathPoint2D.

Method Index


o AddInside(CATMathBox2D&)
Replaces this CATMathBox2D by its union with another CATMathBox2D.
o AddInside(CATMathPoint2D&)
Modifies this CATMathBox2D by forcing a CATMathPoint to belong to the CATMathBox 2D.
o GetExtremities(double&,double&,double&,double&)
Retrieves the extremities of this CATMathBox2D.
o GetHigh(CATMathPoint2D&)
Retrieves the high extremity of this CATMathBox2D.
o GetLow(CATMathPoint2D&)
Retrieves the low extremity of this CATMathBox2D.
o Inflate(double)
Modifies this CATMathBox2D by adding a given thickness on each direction.
o IsContaining(CATMathPoint2D&)
Returns TRUE if this CATMathBox2D is containing a CATMathPoint2D.
o IsEmpty()
Tests whether this CATMathBox2D is empty.
o IsIntersecting(CATMathBox2D&,double)
Returns TRUE if this CATMathBox2D is intersecting an another one, with a given tolerance.
o IsIntersecting(CATMathPoint2D&,CATMathPoint2D&)
Returns TRUE if this CATMathBox2D is intersecting the segment [iP1,iP2].
o Project(CATMathPoint2D&)
Projects a CATMathPoint2D on this CATMathBox2D.
o SetExtremities(double,double,double,double)
Sets the extremities of this CATMathBox2D.
o SetHigh(CATMathPoint2D&)
Modifies the high extremity of this CATMathBox2D.
o SetLow(CATMathPoint2D&)
Modifies the low extremity of this CATMathBox2D.
o SetToEmpty()
Resets this CATMathBox2D to an empty one.
o SetToIntersection(CATMathBox2D&,CATMathBox2D&)
Replaces this CATMathBox2D with the intersection of two other CATMathBox2D.
o SetToIntersection(CATMathBox2D&,CATMathBox2D&,double)
Replaces this CATMathBox2D with the intersection of two other CATMathBox2D with a given tolerance.
o SetToUnion(CATMathBox2D&,CATMathBox2D&)
Replaces this CATMathBox2D with the union of two other CATMathBox2D.

Constructor and Destructor


o CATMathBox2D
public CATMathBox2D()
Constructs an empty CATMathBox2D.
o CATMathBox2D
public CATMathBox2D( const CATMathBox2D& iBox)
Copy Constructor.
o CATMathBox2D
public CATMathBox2D( const double iXMin,
const double iXMax,
const double iYMin,
const double iYMax)
Constructs a CATMathBox2D from its extremities.
No verification is performed.
o CATMathBox2D
public CATMathBox2D( const CATMathPoint2D& iLowPoint,
const CATMathPoint2D& iHighPoint,
const CATBoolean iCheck=1)
Constructs a CATMathBox2D from two CATMathPoint2D.
Parameters:
iCheck
FALSE
The two CATMathPoint2D are assumed to be the lowest one and the highest one. This can create an empty box if it is not the case.
TRUE
It creates the smallest box that contains the two CATMathPoint2D (default mode).

Methods


o AddInside
public void AddInside( const CATMathBox2D& iBoxToAdd)
Replaces this CATMathBox2D by its union with another CATMathBox2D.
o AddInside
public void AddInside( const CATMathPoint2D& iPoint)
Modifies this CATMathBox2D by forcing a CATMathPoint to belong to the CATMathBox 2D.
o GetExtremities
public INLINE void GetExtremities(double& ioXMin,
double& ioXMax,
double& ioYMin,
double& ioYMax) const
Retrieves the extremities of this CATMathBox2D.
o GetHigh
public void GetHigh(CATMathPoint2D& ioHighPoint) const
Retrieves the high extremity of this CATMathBox2D.
o GetLow
public void GetLow(CATMathPoint2D& ioLowPoint) const
Retrieves the low extremity of this CATMathBox2D.
o Inflate
public void Inflate(double iThickness)
Modifies this CATMathBox2D by adding a given thickness on each direction.
Hence, the low extremity of the box becomes (XMin-iThickness, YMin-iThickness) and the high extremity becomes (XMax+iThickness, YMax+iThickness). An empty CATMathBox2D still remains empty.
o IsContaining
public CATBoolean IsContaining( const CATMathPoint2D& iPoint) const
Returns TRUE if this CATMathBox2D is containing a CATMathPoint2D.
o IsEmpty
public INLINE CATBoolean IsEmpty()const
Tests whether this CATMathBox2D is empty.
Returns:
TRUE if the CATMathBox2D is empty
o IsIntersecting
public CATBoolean IsIntersecting( const CATMathBox2D& iBox,
double iTolerance=0) const
Returns TRUE if this CATMathBox2D is intersecting an another one, with a given tolerance.
Note that if the intersection is a point or a line, the result is true.
o IsIntersecting
public CATBoolean IsIntersecting( const CATMathPoint2D& iP1,
const CATMathPoint2D& iP2) const
Returns TRUE if this CATMathBox2D is intersecting the segment [iP1,iP2].
Note that if the intersection is a point or a line, the result is true.
o Project
public int Project(CATMathPoint2D& ioPoint)
Projects a CATMathPoint2D on this CATMathBox2D.
Returns:
0
The CATMathPoint2D is not modified. It already is inside the CATMathBox2D, or the CATMathBox2D is empty.
1
The CATMathPoint2D is moved to the nearest point of the CATMathBox2D.
2
When the line is included in the plane
o SetExtremities
public INLINE void SetExtremities( const double iXMin,
const double iXMax,
const double iYMin,
const double iYMax)
Sets the extremities of this CATMathBox2D.
No verification is done.
o SetHigh
public void SetHigh( const CATMathPoint2D& iHighPoint)
Modifies the high extremity of this CATMathBox2D.
No verification is done.
o SetLow
public void SetLow( const CATMathPoint2D& iLowPoint)
Modifies the low extremity of this CATMathBox2D.
No verification is done.
o SetToEmpty
public INLINE void SetToEmpty()
Resets this CATMathBox2D to an empty one.
o SetToIntersection
public void SetToIntersection( const CATMathBox2D& iBox1,
const CATMathBox2D& iBox2)
Replaces this CATMathBox2D with the intersection of two other CATMathBox2D.
It can lead to an empty CATMathBox2D.
o SetToIntersection
public void SetToIntersection( const CATMathBox2D& iBox1,
const CATMathBox2D& iBox2,
double iTolerance)
Replaces this CATMathBox2D with the intersection of two other CATMathBox2D with a given tolerance..
It can lead to an empty CATMathBox2D.
o SetToUnion
public void SetToUnion( const CATMathBox2D& iBox1,
const CATMathBox2D& iBox2)
Replaces this CATMathBox2D with the union of two other CATMathBox2D.

This object is included in the file: CATMathBox2D.h
If needed, your Imakefile.mk should include the module: CATMathematics

Copyright © 1999-2014, Dassault Systèmes. All rights reserved.