ACF $AcfVersion:0$
Public Member Functions | Static Public Member Functions | List of all members
istd::TRange< ValueType > Class Template Reference

Implementation of a abstract range defined by two values - minimum and maximum. More...

#include <TRange.h>

Public Member Functions

 TRange ()
 Constructs an empty range object.
 
 TRange (const TRange &range)
 Copy constructor.
 
 TRange (ValueType minValue, ValueType maxValue)
 Constructs a range object from two numbers.
 
bool IsValid () const
 Return true if the bottom value is smaller or equal then the top value.
 
bool IsEmpty () const
 Return true if the bottom value is equal to the top value.
 
bool IsValidNonEmpty () const
 Return true if the range is valid and it is not empty.
 
ValueType GetMinValue () const
 Get the bottom value.
 
ValueType & GetMinValueRef ()
 Get reference to the bottom value.
 
void SetMinValue (ValueType minValue)
 Set the bottom value.
 
ValueType GetAbsMinValue () const
 Get the minimum by the absolute value.
 
ValueType GetAbsMaxValue () const
 Get the maximum by the absolute value.
 
ValueType GetMaxValue () const
 Get the top value.
 
ValueType & GetMaxValueRef ()
 Get reference to the top value.
 
void SetMaxValue (ValueType maxValue)
 Set the top value.
 
void Reset ()
 Set this range to be empty.
 
ValueType GetLength () const
 Get length of this range.
 
TRange GetValidated () const
 Get validated range, if it was invalid.
 
void GetValidated (TRange &result) const
 Get validated range, if it was invalid.
 
void Validate ()
 Force this range to be valid.
 
bool Contains (ValueType value) const
 Returns true, if value is in range between top and bottom.
 
bool Contains (const TRange &range) const
 Returns true, if this range is inside of the range.
 
bool IsIntersectedBy (const TRange &range) const
 Check if this range is intersected by other range.
 
bool IsOutsideOf (const TRange &range) const
 Check if this range is outside of the given range.
 
TRange GetTranslated (ValueType offset) const
 Get translated position range.
 
void Translate (ValueType offset)
 Translated position of this range.
 
TRange GetIntersection (const TRange &range) const
 Get intersection with the second range.
 
void Intersection (const TRange &range)
 Set this range to be intersection of two ranges.
 
TRange GetUnion (const TRange &range) const
 Get union with the second range.
 
TRange GetUnion (double value) const
 Get union with the second range.
 
void Unite (const TRange &range)
 Set this range to be union of two ranges.
 
void Unite (double value)
 Set this range to be union of two ranges.
 
TRange GetExpanded (const TRange &range) const
 Get expanded range using the second range.
 
void Expand (const TRange &range)
 Set this range to be expanded.
 
ValueType GetDistance (ValueType value) const
 Get distance from value to range.
 
ValueType GetNearestInside (ValueType value) const
 Get nearest value belonging to range.
 
ValueType GetClipped (ValueType value) const
 Get value clipped to the range.
 
TRange GetClipped (const TRange &range) const
 Get range clipped to the current range.
 
ValueType GetValueFromAlpha (double alpha) const
 Get value based on 'alpha' factor.
 
double GetAlphaFromValue (ValueType value) const
 Get value based on 'alpha' factor.
 
ValueType GetMappedTo (ValueType value, const TRange &range) const
 Returns the value, that corresponds the input value inputValue in the other range range.
 
TRange GetApply (const TRange &range) const
 Get a combined range.
 
TRange GetInvertApply (const TRange &range) const
 
TRange GetInverted () const
 
void SetInterpolated (const TRange &first, const TRange &second, double alpha)
 Set this range to be linear interpolated using two other ranges and adjast alpha value.
 
TRangeoperator= (const TRange &range)
 
bool operator== (const TRange &range) const
 
bool operator!= (const TRange &range) const
 
TRange operator* (double value) const
 
TRange operator/ (double value) const
 
TRangeoperator*= (double value)
 
TRangeoperator/= (double value)
 

Static Public Member Functions

static const TRangeGetNull ()
 Return null range.
 
static const TRangeGetInvalid ()
 Return invalid range.
 
static TRange GetValid (ValueType value1, ValueType value2)
 Return always valid range.
 

Detailed Description

template<typename ValueType>
class istd::TRange< ValueType >

Implementation of a abstract range defined by two values - minimum and maximum.

Definition at line 21 of file TRange.h.

Constructor & Destructor Documentation

◆ TRange() [1/3]

template<typename ValueType >
istd::TRange< ValueType >::TRange ( )

Constructs an empty range object.

IsEmpty() will return true for this object.

Definition at line 296 of file TRange.h.

◆ TRange() [2/3]

template<typename ValueType >
istd::TRange< ValueType >::TRange ( const TRange< ValueType > &  range)

Copy constructor.

Definition at line 304 of file TRange.h.

◆ TRange() [3/3]

template<typename ValueType >
istd::TRange< ValueType >::TRange ( ValueType  minValue,
ValueType  maxValue 
)

Constructs a range object from two numbers.

Definition at line 312 of file TRange.h.

Member Function Documentation

◆ Contains() [1/2]

template<typename ValueType >
bool istd::TRange< ValueType >::Contains ( const TRange< ValueType > &  range) const
inline

Returns true, if this range is inside of the range.

Definition at line 451 of file TRange.h.

References istd::TRange< ValueType >::IsValid().

◆ Contains() [2/2]

template<typename ValueType >
bool istd::TRange< ValueType >::Contains ( ValueType  value) const
inline

Returns true, if value is in range between top and bottom.

This range must be valid.

Definition at line 442 of file TRange.h.

Referenced by i2d::CRect::IsInside(), and i2d::CRect::IsInside().

◆ Expand()

template<typename ValueType >
void istd::TRange< ValueType >::Expand ( const TRange< ValueType > &  range)
inline

Set this range to be expanded.

Expanding operation calculate simple sum for each components separately.

Definition at line 592 of file TRange.h.

Referenced by i2d::CRect::Expand().

◆ GetAbsMaxValue()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetAbsMaxValue ( ) const

Get the maximum by the absolute value.

Definition at line 372 of file TRange.h.

◆ GetAbsMinValue()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetAbsMinValue ( ) const

Get the minimum by the absolute value.

Definition at line 362 of file TRange.h.

◆ GetAlphaFromValue()

template<typename ValueType >
double istd::TRange< ValueType >::GetAlphaFromValue ( ValueType  value) const
inline

Get value based on 'alpha' factor.

Parameters
alphaalpha factor. If it is 0, minimum range value will be returned. If it is 1, maximum range value will be returned. Rest values are linear interpolated.

Definition at line 668 of file TRange.h.

◆ GetApply()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetApply ( const TRange< ValueType > &  range) const

Get a combined range.

It calculates combined range. Range [0, 1] is neutral element of this operation.

Definition at line 690 of file TRange.h.

◆ GetClipped() [1/2]

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetClipped ( const TRange< ValueType > &  range) const

◆ GetClipped() [2/2]

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetClipped ( ValueType  value) const

Get value clipped to the range.

Definition at line 630 of file TRange.h.

Referenced by icmm::TColorGradient< GradientFunction >::GetValueAt().

◆ GetDistance()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetDistance ( ValueType  value) const
inline

Get distance from value to range.

Distance is the smallest absolute value difference of given value and the values belonging to range.

Definition at line 600 of file TRange.h.

◆ GetExpanded()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetExpanded ( const TRange< ValueType > &  range) const
inline

Get expanded range using the second range.

Expanding operation calculate simple sum for each components separately.

Definition at line 585 of file TRange.h.

◆ GetIntersection()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetIntersection ( const TRange< ValueType > &  range) const
inline

Get intersection with the second range.

Definition at line 490 of file TRange.h.

◆ GetInvalid()

template<typename ValueType >
const TRange< ValueType > & istd::TRange< ValueType >::GetInvalid ( )
inlinestatic

Return invalid range.

Definition at line 853 of file TRange.h.

◆ GetInvertApply()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetInvertApply ( const TRange< ValueType > &  range) const

Definition at line 701 of file TRange.h.

◆ GetInverted()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetInverted ( ) const

Definition at line 721 of file TRange.h.

◆ GetLength()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetLength ( ) const
inline

Get length of this range.

Length is difference between top and bottom values.

Definition at line 411 of file TRange.h.

Referenced by i2d::CRect::GetCenter(), i2d::CRect::GetHeight(), istd::TRange< ValueType >::GetMappedTo(), i2d::CRect::GetRectangle(), imath::CSampledFunction::GetSamplingStep(), i2d::CRect::GetSize(), and i2d::CRect::GetWidth().

◆ GetMappedTo()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetMappedTo ( ValueType  value,
const TRange< ValueType > &  range 
) const
inline

Returns the value, that corresponds the input value inputValue in the other range range.

It is the same as range.GetValueFromAlpha(GetAlphaFromValue(value)).

Parameters
valuevalue definde in this range. If it is equal to minimum value in this range, it will be mapped to minimum value of range. If it is equal to maximum value in this range, it will be mapped to maximum value of range. Rest values are linear interpolated.
Note
This value must be in current range.

Definition at line 679 of file TRange.h.

References istd::TRange< ValueType >::GetLength(), and istd::TRange< ValueType >::GetMinValue().

◆ GetMaxValue()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetMaxValue ( ) const
inline

◆ GetMaxValueRef()

template<typename ValueType >
ValueType & istd::TRange< ValueType >::GetMaxValueRef ( )
inline

Get reference to the top value.

Definition at line 389 of file TRange.h.

Referenced by iser::CPrimitiveTypesSerializer::SerializeRange().

◆ GetMinValue()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetMinValue ( ) const
inline

◆ GetMinValueRef()

template<typename ValueType >
ValueType & istd::TRange< ValueType >::GetMinValueRef ( )
inline

Get reference to the bottom value.

Definition at line 348 of file TRange.h.

Referenced by iser::CPrimitiveTypesSerializer::SerializeRange().

◆ GetNearestInside()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetNearestInside ( ValueType  value) const
inline

Get nearest value belonging to range.

Definition at line 615 of file TRange.h.

◆ GetNull()

template<typename ValueType >
const TRange< ValueType > & istd::TRange< ValueType >::GetNull ( )
inlinestatic

Return null range.

Definition at line 845 of file TRange.h.

◆ GetTranslated()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetTranslated ( ValueType  offset) const
inline

Get translated position range.

Translation adds the offset value to minimal and mavimal values.

Definition at line 475 of file TRange.h.

◆ GetUnion() [1/2]

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetUnion ( const TRange< ValueType > &  range) const

Get union with the second range.

Definition at line 517 of file TRange.h.

References istd::TRange< ValueType >::IsValid().

◆ GetUnion() [2/2]

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetUnion ( double  value) const

Get union with the second range.

Definition at line 534 of file TRange.h.

◆ GetValid()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetValid ( ValueType  value1,
ValueType  value2 
)
inlinestatic

Return always valid range.

Definition at line 836 of file TRange.h.

◆ GetValidated() [1/2]

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetValidated ( ) const
inline

Get validated range, if it was invalid.

Range is invalid if set min value is bigger than set max value. It returns range with smaller range value as minimum and bigger one as maximum.

Definition at line 418 of file TRange.h.

◆ GetValidated() [2/2]

template<typename ValueType >
void istd::TRange< ValueType >::GetValidated ( TRange< ValueType > &  result) const
inline

Get validated range, if it was invalid.

Range is invalid if set min value is bigger than set max value. It returns range with smaller range value as minimum and bigger one as maximum.

Definition at line 427 of file TRange.h.

References istd::TRange< ValueType >::SetMaxValue(), and istd::TRange< ValueType >::SetMinValue().

◆ GetValueFromAlpha()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetValueFromAlpha ( double  alpha) const
inline

Get value based on 'alpha' factor.

Parameters
alphaalpha factor. If it is 0, minimum range value will be returned. If it is 1, maximum range value will be returned. Rest values are linear interpolated.

Definition at line 661 of file TRange.h.

Referenced by imath::CSampledFunction::GetSampleCoordinate().

◆ Intersection()

template<typename ValueType >
void istd::TRange< ValueType >::Intersection ( const TRange< ValueType > &  range)

Set this range to be intersection of two ranges.

Definition at line 502 of file TRange.h.

Referenced by i2d::CRect::Intersection().

◆ IsEmpty()

template<typename ValueType >
bool istd::TRange< ValueType >::IsEmpty ( ) const
inline

Return true if the bottom value is equal to the top value.

Definition at line 327 of file TRange.h.

Referenced by i2d::CRect::IsEmpty(), istd::TRanges< ValueType >::TRanges(), and istd::TRanges< ValueType >::Union().

◆ IsIntersectedBy()

template<typename ValueType >
bool istd::TRange< ValueType >::IsIntersectedBy ( const TRange< ValueType > &  range) const
inline

Check if this range is intersected by other range.

Some range is intersected by another, if intercestion of this two ranges is not empty.

Definition at line 461 of file TRange.h.

◆ IsOutsideOf()

template<typename ValueType >
bool istd::TRange< ValueType >::IsOutsideOf ( const TRange< ValueType > &  range) const
inline

Check if this range is outside of the given range.

Definition at line 468 of file TRange.h.

Referenced by i2d::CRect::IsOutside().

◆ IsValid()

template<typename ValueType >
bool istd::TRange< ValueType >::IsValid ( ) const
inline

Return true if the bottom value is smaller or equal then the top value.

Definition at line 320 of file TRange.h.

Referenced by istd::TRange< ValueType >::Contains(), istd::TRange< ValueType >::GetUnion(), i2d::CRect::Intersection(), i2d::CRect::IsValid(), and istd::TRange< ValueType >::Unite().

◆ IsValidNonEmpty()

template<typename ValueType >
bool istd::TRange< ValueType >::IsValidNonEmpty ( ) const
inline

Return true if the range is valid and it is not empty.

Definition at line 334 of file TRange.h.

Referenced by i2d::CRect::IsValidNonEmpty().

◆ operator!=()

template<typename ValueType >
bool istd::TRange< ValueType >::operator!= ( const TRange< ValueType > &  range) const
inline

Definition at line 758 of file TRange.h.

◆ operator*()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::operator* ( double  value) const
inline

Definition at line 776 of file TRange.h.

◆ operator*=()

template<typename ValueType >
TRange< ValueType > & istd::TRange< ValueType >::operator*= ( double  value)
inline

Definition at line 807 of file TRange.h.

◆ operator/()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::operator/ ( double  value) const
inline

Definition at line 788 of file TRange.h.

◆ operator/=()

template<typename ValueType >
TRange< ValueType > & istd::TRange< ValueType >::operator/= ( double  value)
inline

Definition at line 817 of file TRange.h.

◆ operator=()

template<typename ValueType >
TRange< ValueType > & istd::TRange< ValueType >::operator= ( const TRange< ValueType > &  range)
inline

Definition at line 766 of file TRange.h.

◆ operator==()

template<typename ValueType >
bool istd::TRange< ValueType >::operator== ( const TRange< ValueType > &  range) const
inline

Definition at line 751 of file TRange.h.

◆ Reset()

template<typename ValueType >
void istd::TRange< ValueType >::Reset ( )

Set this range to be empty.

Definition at line 403 of file TRange.h.

Referenced by i2d::CRect::Reset().

◆ SetInterpolated()

template<typename ValueType >
void istd::TRange< ValueType >::SetInterpolated ( const TRange< ValueType > &  first,
const TRange< ValueType > &  second,
double  alpha 
)

Set this range to be linear interpolated using two other ranges and adjast alpha value.

Definition at line 741 of file TRange.h.

◆ SetMaxValue()

template<typename ValueType >
void istd::TRange< ValueType >::SetMaxValue ( ValueType  maxValue)
inline

◆ SetMinValue()

template<typename ValueType >
void istd::TRange< ValueType >::SetMinValue ( ValueType  minValue)
inline

◆ Translate()

template<typename ValueType >
void istd::TRange< ValueType >::Translate ( ValueType  offset)
inline

Translated position of this range.

Translation adds the offset value to minimal and mavimal values.

Definition at line 482 of file TRange.h.

◆ Unite() [1/2]

template<typename ValueType >
void istd::TRange< ValueType >::Unite ( const TRange< ValueType > &  range)

Set this range to be union of two ranges.

Definition at line 546 of file TRange.h.

References istd::TRange< ValueType >::IsValid().

Referenced by i2d::CRect::GetUnion(), and i2d::CRect::Union().

◆ Unite() [2/2]

template<typename ValueType >
void istd::TRange< ValueType >::Unite ( double  value)

Set this range to be union of two ranges.

Definition at line 566 of file TRange.h.

◆ Validate()

template<typename ValueType >
void istd::TRange< ValueType >::Validate ( )
inline

Force this range to be valid.

Range is invalid if set min value is bigger than set max value. It set smaller range value as minimum and bigger one as maximum.

Definition at line 435 of file TRange.h.


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