#include <opennurbs_point.h>

Public Member Functions

 ON_Interval ()
 The default constructor creates ON_Interval::EmptyInterval (ON_UNSET_VALUE,ON_UNSET_VALUE) More...
 
 ON_Interval (const ON_Interval &)=default
 
 ON_Interval (double t0, double t1)
 
 ~ON_Interval ()=default
 
void Destroy ()
 
bool Includes (double t, bool bTestOpenInterval=false) const
 Test a value t to see if it is inside the interval. More...
 
bool Includes (const ON_Interval &other, bool bProperSubSet=false) const
 Test an interval to see if it is contained in this interval. More...
 
bool Intersection (const ON_Interval &)
 
bool Intersection (const ON_Interval &, const ON_Interval &)
 
bool IsDecreasing () const
 
bool IsEmptyInterval () const
 
bool IsEmptySet () const
 
bool IsIncreasing () const
 
bool IsInterval () const
 
bool IsSingleton () const
 
bool IsValid () const
 
double Length () const
 
bool MakeIncreasing ()
 
double Max () const
 
double Mid () const
 
double Min () const
 
double NormalizedParameterAt (double interval_parameter) const
 Convert interval value, or pair of values, to normalized parameter. More...
 
ON_Interval NormalizedParameterAt (ON_Interval interval_parameter) const
 
bool operator!= (const ON_Interval &rhs) const
 
ON_Intervaloperator= (const ON_Interval &)=default
 
bool operator== (const ON_Interval &rhs) const
 
double & operator[] (int)
 
double operator[] (int) const
 
double & operator[] (unsigned int)
 
double operator[] (unsigned int) const
 
double ParameterAt (double normalized_parameter) const
 Convert normalized parameter to interval value, or pair of values. More...
 
ON_Interval ParameterAt (ON_Interval normalized_interval) const
 
void Reverse ()
 Changes interval to [-m_t[1],-m_t[0]]. More...
 
void Set (double t0, double t1)
 Sets interval to [t0,t1] More...
 
void Swap ()
 Swaps m_t[0] and m_t[1]. More...
 
bool Union (const ON_Interval &)
 
bool Union (double t)
 
bool Union (int count, const double *t)
 
bool Union (const ON_Interval &, const ON_Interval &)
 

Static Public Member Functions

static int Compare (const ON_Interval &lhs, const ON_Interval &rhs)
 A well ordered dictionary compare function that is nan aware and can be used for robust sorting. More...
 
static bool IntervalsOverlap (const ON_Interval &A, const ON_Interval &B)
 Test a pair of interval to see if they have a non-empty intersection. More...
 

Public Attributes

double m_t [2]
 Interval = (m_t[0], m_t[1]) More...
 

Static Public Attributes

static const ON_Interval EmptyInterval
 
static const ON_Interval Nan
 
static const ON_Interval ZeroToOne
 
static const ON_Interval ZeroToTwoPi
 

Constructor & Destructor Documentation

◆ ON_Interval() [1/3]

ON_Interval::ON_Interval ( )

The default constructor creates ON_Interval::EmptyInterval (ON_UNSET_VALUE,ON_UNSET_VALUE)

◆ ~ON_Interval()

ON_Interval::~ON_Interval ( )
default

◆ ON_Interval() [2/3]

ON_Interval::ON_Interval ( const ON_Interval )
default

◆ ON_Interval() [3/3]

ON_Interval::ON_Interval ( double  t0,
double  t1 
)

Member Function Documentation

◆ Compare()

static int ON_Interval::Compare ( const ON_Interval lhs,
const ON_Interval rhs 
)
static

A well ordered dictionary compare function that is nan aware and can be used for robust sorting.

◆ Destroy()

void ON_Interval::Destroy ( )

◆ Includes() [1/2]

bool ON_Interval::Includes ( double  t,
bool  bTestOpenInterval = false 
) const

Test a value t to see if it is inside the interval.

Parameters
t[in] value to test
bTestOpenInterval[in] If false, t is tested to see if it satisfies min <= t <= max. If true, t is tested to see if it satisfies min < t < max.
Returns
true if t is in the interval and false if t is not in the interval.

◆ Includes() [2/2]

bool ON_Interval::Includes ( const ON_Interval other,
bool  bProperSubSet = false 
) const

Test an interval to see if it is contained in this interval.

Parameters
other[in] interval to test
bProperSubSet[in] if true, then the test is for a proper subinterval.
Returns
If bProperSubSet is false, then the result is true when this->Min() <= other.Min() and other.Max() <= this->Max(). If bProperSubSet is true, then the result is true when this->Min() <= other.Min() and other.Max() <= this->Max() and at least one of the inequalites is strict.

◆ Intersection() [1/2]

bool ON_Interval::Intersection ( const ON_Interval )

◆ Intersection() [2/2]

bool ON_Interval::Intersection ( const ON_Interval ,
const ON_Interval  
)

◆ IntervalsOverlap()

static bool ON_Interval::IntervalsOverlap ( const ON_Interval A,
const ON_Interval B 
)
static

Test a pair of interval to see if they have a non-empty intersection.

Parameters
A[in] interval to test
B[in] interval to test
Returns
true if the intersection is non-empty, including if the intersection is a single point. false otherwise.

◆ IsDecreasing()

bool ON_Interval::IsDecreasing ( ) const

◆ IsEmptyInterval()

bool ON_Interval::IsEmptyInterval ( ) const

◆ IsEmptySet()

bool ON_Interval::IsEmptySet ( ) const

◆ IsIncreasing()

bool ON_Interval::IsIncreasing ( ) const

◆ IsInterval()

bool ON_Interval::IsInterval ( ) const

◆ IsSingleton()

bool ON_Interval::IsSingleton ( ) const

◆ IsValid()

bool ON_Interval::IsValid ( ) const

◆ Length()

double ON_Interval::Length ( ) const

◆ MakeIncreasing()

bool ON_Interval::MakeIncreasing ( )

◆ Max()

double ON_Interval::Max ( ) const

◆ Mid()

double ON_Interval::Mid ( ) const

◆ Min()

double ON_Interval::Min ( ) const

◆ NormalizedParameterAt() [1/2]

double ON_Interval::NormalizedParameterAt ( double  interval_parameter) const

Convert interval value, or pair of values, to normalized parameter.

Parameters
interval_parameter[in] value in interval
Returns
Normalized parameter x so that min*(1.0-x) + max*x = interval_parameter.
See also
ON_Interval::ParameterAt

◆ NormalizedParameterAt() [2/2]

ON_Interval ON_Interval::NormalizedParameterAt ( ON_Interval  interval_parameter) const

◆ operator!=()

bool ON_Interval::operator!= ( const ON_Interval rhs) const
Returns
True if (lhs.m_t[0] != rhs.m_t[0]) or (lhs.m_t[1] != rhs.m_t[1]) and no values are nans.

◆ operator=()

ON_Interval& ON_Interval::operator= ( const ON_Interval )
default

◆ operator==()

bool ON_Interval::operator== ( const ON_Interval rhs) const
Returns
True if (lhs.m_t[0] == rhs.m_t[0]) and (lhs.m_t[1] === rhs.m_t[1]).

◆ operator[]() [1/4]

double& ON_Interval::operator[] ( int  )

◆ operator[]() [2/4]

double ON_Interval::operator[] ( int  ) const

◆ operator[]() [3/4]

double& ON_Interval::operator[] ( unsigned  int)

◆ operator[]() [4/4]

double ON_Interval::operator[] ( unsigned  int) const

◆ ParameterAt() [1/2]

double ON_Interval::ParameterAt ( double  normalized_parameter) const

Convert normalized parameter to interval value, or pair of values.

Parameters
normalized_parameter[in]
Returns
Interval parameter min*(1.0-normalized_parameter) + max*normalized_parameter
See also
ON_Interval::NormalizedParameterAt

◆ ParameterAt() [2/2]

ON_Interval ON_Interval::ParameterAt ( ON_Interval  normalized_interval) const

◆ Reverse()

void ON_Interval::Reverse ( )

Changes interval to [-m_t[1],-m_t[0]].

◆ Set()

void ON_Interval::Set ( double  t0,
double  t1 
)

Sets interval to [t0,t1]

Parameters
t0[in]
t1[in]
See also
ON_Interval::ON_Interval( double, double )

◆ Swap()

void ON_Interval::Swap ( )

Swaps m_t[0] and m_t[1].

◆ Union() [1/4]

bool ON_Interval::Union ( const ON_Interval )

◆ Union() [2/4]

bool ON_Interval::Union ( double  t)

◆ Union() [3/4]

bool ON_Interval::Union ( int  count,
const double *  t 
)

◆ Union() [4/4]

bool ON_Interval::Union ( const ON_Interval ,
const ON_Interval  
)

Member Data Documentation

◆ EmptyInterval

const ON_Interval ON_Interval::EmptyInterval
static

◆ m_t

double ON_Interval::m_t[2]

Interval = (m_t[0], m_t[1])

◆ Nan

const ON_Interval ON_Interval::Nan
static

◆ ZeroToOne

const ON_Interval ON_Interval::ZeroToOne
static

◆ ZeroToTwoPi

const ON_Interval ON_Interval::ZeroToTwoPi
static