Open CASCADE Technology  7.4.1.dev
Public Member Functions
Bnd_Range Class Reference

This class describes a range in 1D space restricted by two real values. A range can be void indicating there is no point included in the range. More...

#include <Bnd_Range.hxx>

Public Member Functions

 Bnd_Range ()
 Default constructor. Creates VOID range. More...
 
 Bnd_Range (const Standard_Real theMin, const Standard_Real theMax)
 Constructor. Never creates VOID range. More...
 
void Common (const Bnd_Range &theOther)
 Replaces <this> with common-part of <this> and theOther. More...
 
Standard_Boolean Union (const Bnd_Range &theOther)
 Joins *this and theOther to one interval. Replaces *this to the result. Returns false if the operation cannot be done (e.g. input arguments are empty or separated). More...
 
void Split (const Standard_Real theVal, NCollection_List< Bnd_Range > &theList, const Standard_Real thePeriod=0.0) const
 Splits <this> to several sub-ranges by theVal value (e.g. range [3, 15] will be split by theVal==5 to the two ranges: [3, 5] and [5, 15]). New ranges will be pushed to theList (theList must be initialized correctly before calling this method). If thePeriod != 0.0 then at least one boundary of new ranges (if <*this> intersects theVal+k*thePeriod) will be equal to theVal+thePeriod*k, where k is an integer number (k = 0, +/-1, +/-2, ...). (let thePeriod in above example be 4 ==> we will obtain four ranges: [3, 5], [5, 9], [9, 13] and [13, 15]. More...
 
Standard_Integer IsIntersected (const Standard_Real theVal, const Standard_Real thePeriod=0.0) const
 Checks if <this> intersects values like theVal+k*thePeriod, where k is an integer number (k = 0, +/-1, +/-2, ...). Returns: 0 - if <this> does not intersect the theVal+k*thePeriod. 1 - if <this> intersects theVal+k*thePeriod. 2 - if myFirst or/and myLast are equal to theVal+k*thePeriod. More...
 
void Add (const Standard_Real theParameter)
 Extends <this> to include theParameter. More...
 
void Add (const Bnd_Range &theRange)
 Extends this range to include both ranges. More...
 
Standard_Boolean GetMin (Standard_Real &thePar) const
 Obtain MIN boundary of <this>. If <this> is VOID the method returns false. More...
 
Standard_Boolean GetMax (Standard_Real &thePar) const
 Obtain MAX boundary of <this>. If <this> is VOID the method returns false. More...
 
Standard_Boolean GetBounds (Standard_Real &theFirstPar, Standard_Real &theLastPar) const
 Obtain first and last boundary of <this>. If <this> is VOID the method returns false. More...
 
Standard_Boolean GetIntermediatePoint (const Standard_Real theLambda, Standard_Real &theParameter) const
 Obtain theParameter satisfied to the equation (theParameter-MIN)/(MAX-MIN) == theLambda. More...
 
Standard_Real Delta () const
 Returns range value (MAX-MIN). Returns negative value for VOID range. More...
 
Standard_Boolean IsVoid () const
 Is <this> initialized. More...
 
void SetVoid ()
 Initializes <this> by default parameters. Makes <this> VOID. More...
 
void Enlarge (const Standard_Real theDelta)
 Extends this to the given value (in both side) More...
 
Bnd_Range Shifted (const Standard_Real theVal) const
 Returns the copy of <*this> shifted by theVal. More...
 
void Shift (const Standard_Real theVal)
 Shifts <*this> by theVal. More...
 
void TrimFrom (const Standard_Real theValLower)
 Trims the First value in range by the given lower limit. Marks range as Void if the given Lower value is greater than range Max. More...
 
void TrimTo (const Standard_Real theValUpper)
 Trim the Last value in range by the given Upper limit. Marks range as Void if the given Upper value is smaller than range Max. More...
 
Standard_Boolean IsOut (Standard_Real theValue) const
 Returns True if the value is out of this range. More...
 
Standard_Boolean IsOut (const Bnd_Range &theRange) const
 Returns True if the given range is out of this range. More...
 
Standard_Boolean operator== (const Bnd_Range &theOther) const
 Returns TRUE if theOther is equal to <*this> More...
 
void DumpJson (Standard_OStream &theOStream, Standard_Integer theDepth=-1) const
 Dumps the content of me into the stream. More...
 

Detailed Description

This class describes a range in 1D space restricted by two real values. A range can be void indicating there is no point included in the range.

Constructor & Destructor Documentation

◆ Bnd_Range() [1/2]

Bnd_Range::Bnd_Range ( )
inline

Default constructor. Creates VOID range.

◆ Bnd_Range() [2/2]

Bnd_Range::Bnd_Range ( const Standard_Real  theMin,
const Standard_Real  theMax 
)
inline

Constructor. Never creates VOID range.

Member Function Documentation

◆ Add() [1/2]

void Bnd_Range::Add ( const Standard_Real  theParameter)
inline

Extends <this> to include theParameter.

◆ Add() [2/2]

void Bnd_Range::Add ( const Bnd_Range theRange)
inline

Extends this range to include both ranges.

See also
use method ::Union() to check if two ranges overlap method merging

◆ Common()

void Bnd_Range::Common ( const Bnd_Range theOther)

Replaces <this> with common-part of <this> and theOther.

◆ Delta()

Standard_Real Bnd_Range::Delta ( ) const
inline

Returns range value (MAX-MIN). Returns negative value for VOID range.

◆ DumpJson()

void Bnd_Range::DumpJson ( Standard_OStream theOStream,
Standard_Integer  theDepth = -1 
) const

Dumps the content of me into the stream.

◆ Enlarge()

void Bnd_Range::Enlarge ( const Standard_Real  theDelta)
inline

Extends this to the given value (in both side)

◆ GetBounds()

Standard_Boolean Bnd_Range::GetBounds ( Standard_Real theFirstPar,
Standard_Real theLastPar 
) const
inline

Obtain first and last boundary of <this>. If <this> is VOID the method returns false.

◆ GetIntermediatePoint()

Standard_Boolean Bnd_Range::GetIntermediatePoint ( const Standard_Real  theLambda,
Standard_Real theParameter 
) const
inline

Obtain theParameter satisfied to the equation (theParameter-MIN)/(MAX-MIN) == theLambda.

  • theLambda == 0 –> MIN boundary will be returned;
  • theLambda == 0.5 –> Middle point will be returned;
  • theLambda == 1 –> MAX boundary will be returned;
  • theLambda < 0 –> the value less than MIN will be returned;
  • theLambda > 1 –> the value greater than MAX will be returned. If <this> is VOID the method returns false.

◆ GetMax()

Standard_Boolean Bnd_Range::GetMax ( Standard_Real thePar) const
inline

Obtain MAX boundary of <this>. If <this> is VOID the method returns false.

◆ GetMin()

Standard_Boolean Bnd_Range::GetMin ( Standard_Real thePar) const
inline

Obtain MIN boundary of <this>. If <this> is VOID the method returns false.

◆ IsIntersected()

Standard_Integer Bnd_Range::IsIntersected ( const Standard_Real  theVal,
const Standard_Real  thePeriod = 0.0 
) const

Checks if <this> intersects values like theVal+k*thePeriod, where k is an integer number (k = 0, +/-1, +/-2, ...). Returns: 0 - if <this> does not intersect the theVal+k*thePeriod. 1 - if <this> intersects theVal+k*thePeriod. 2 - if myFirst or/and myLast are equal to theVal+k*thePeriod.

ATTENTION!!! If (myFirst == myLast) then this function will return only either 0 or 2.

◆ IsOut() [1/2]

Standard_Boolean Bnd_Range::IsOut ( Standard_Real  theValue) const
inline

Returns True if the value is out of this range.

◆ IsOut() [2/2]

Standard_Boolean Bnd_Range::IsOut ( const Bnd_Range theRange) const
inline

Returns True if the given range is out of this range.

◆ IsVoid()

Standard_Boolean Bnd_Range::IsVoid ( ) const
inline

Is <this> initialized.

◆ operator==()

Standard_Boolean Bnd_Range::operator== ( const Bnd_Range theOther) const
inline

Returns TRUE if theOther is equal to <*this>

◆ SetVoid()

void Bnd_Range::SetVoid ( )
inline

Initializes <this> by default parameters. Makes <this> VOID.

◆ Shift()

void Bnd_Range::Shift ( const Standard_Real  theVal)
inline

Shifts <*this> by theVal.

◆ Shifted()

Bnd_Range Bnd_Range::Shifted ( const Standard_Real  theVal) const
inline

Returns the copy of <*this> shifted by theVal.

◆ Split()

void Bnd_Range::Split ( const Standard_Real  theVal,
NCollection_List< Bnd_Range > &  theList,
const Standard_Real  thePeriod = 0.0 
) const

Splits <this> to several sub-ranges by theVal value (e.g. range [3, 15] will be split by theVal==5 to the two ranges: [3, 5] and [5, 15]). New ranges will be pushed to theList (theList must be initialized correctly before calling this method). If thePeriod != 0.0 then at least one boundary of new ranges (if <*this> intersects theVal+k*thePeriod) will be equal to theVal+thePeriod*k, where k is an integer number (k = 0, +/-1, +/-2, ...). (let thePeriod in above example be 4 ==> we will obtain four ranges: [3, 5], [5, 9], [9, 13] and [13, 15].

◆ TrimFrom()

void Bnd_Range::TrimFrom ( const Standard_Real  theValLower)
inline

Trims the First value in range by the given lower limit. Marks range as Void if the given Lower value is greater than range Max.

◆ TrimTo()

void Bnd_Range::TrimTo ( const Standard_Real  theValUpper)
inline

Trim the Last value in range by the given Upper limit. Marks range as Void if the given Upper value is smaller than range Max.

◆ Union()

Standard_Boolean Bnd_Range::Union ( const Bnd_Range theOther)

Joins *this and theOther to one interval. Replaces *this to the result. Returns false if the operation cannot be done (e.g. input arguments are empty or separated).

See also
use method ::Add() to merge two ranges unconditionally

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