83 Range(
const T& Min,
const T& Max );
150 template<
typename T2 >
180 template <
typename T2>
187 template <
typename T>
190 stream << range.
lower() <<
" " << range.
upper();
252 inline Range<T>::Range(
const Vec2& vec ) : mMin( static_cast<T>( vec[0] ) ), mMax( static_cast<T>( vec[1] ) )
259 mMax(
std::numeric_limits<T>::infinity() ) {}
329 return mMin == -std::numeric_limits<T>::infinity() && mMax == std::numeric_limits<T>::infinity();
335 return std::isinf(mMin) || std::isinf(mMax);
347 this->mMax = rhs.mMax;
349 this->mMin = rhs.mMin;
357 template<
typename T2 >
360 return Range< T >( mMin * (T)rhs, mMax * (T)rhs );
368 if ( x <= lhs.mMin ) {
370 ret.
excess() = lhs.mMin - x;
371 }
else if ( x >= lhs.mMax ) {
373 ret.
excess() = x - lhs.mMax;
383 if ( x < lhs.mMin ) {
385 }
else if ( x > lhs.mMax ) {
395 return (x >= lhs.mMin) && (x <= lhs.mMax) ;
401 return ( inside(r.
lower()) || inside(r.
upper())
This class will store a computed violation of a range.
RangeViolation()
Default constructor. sign=0, v=0.
A range object has a min and max value of a given type and provides services to tell whether a value ...
Range(const Vec2 &vec)
Cast operator from Vec2.
Range(const T &Min, const T &Max)
Standard creation: set min and max.
Range(const Range &rhs)
Copy constructor.
bool inside(const T &x) const
Range & operator=(const Range &rhs)
Assignment operator.
friend std::ostream & operator<<(std::ostream &stream, const Range< T > &range)
Range(const T &x)
Set min=-x and max=x.
Range(const Range &rhs, const T &value, size_t i)
RangeViolation< T > excess(const T &x) const
Compute all the details of range violation: parity is +1 when violating the upper limit,...
Range operator*(const T2 &rhs) const
int outside(const T &x) const
void setUpper(T upper)
Set the upper bound for the range.
void setLower(T lower)
Set the lower bound for the range.
Range()
Default constructor. Set min/max to -/+ infinity.
bool overlap(const Range< T > &r) const
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Range< Real32 > RangeReal32
Range< UInt > RangeUInt
A short hand for ranges of unsigned integer numbers.
RangeViolation< Real > RangeViolationReal
RangeViolation< UInt > RangeViolationUInt
std::ostream & operator<<(std::ostream &os, const agx::AddedMassInteraction::Matrix6x6 &m)
Range< Real > RangeReal
A short hand for ranges of floating point numbers.
RangeViolation< Real32 > RangeViolationReal32
void swap(agx::Name &lhs, agx::Name &rhs)