SFCGAL  2.3.0
Public Member Functions | List of all members
SFCGAL::detail::Interval Class Reference

Represents an interval. More...

#include <Interval.h>

Public Member Functions

 Interval ()
 default constructor (empty interval) More...
 
 Interval (const double &value)
 collapsed interval constructor More...
 
 Interval (const double &value1, const double &value2)
 constructor with two values More...
 
 Interval (const Interval &other)
 copy constructor More...
 
auto operator= (const Interval &other) -> Interval &
 assign operator More...
 
bool isEmpty () const
 indicates if the interval is empty More...
 
const double & lower () const
 return the lower value More...
 
const double & upper () const
 return the upper value More...
 
double width () const
 return the width of the interval More...
 
void expandBy (const double &expandAmount)
 expand the interval More...
 
void expandToInclude (const Interval &other)
 expand the interval to include an other interval. More...
 
void expandToInclude (const double &value)
 expand the interval to include a value More...
 
bool intersects (const Interval &other) const
 test if this intersects other More...
 
bool operator== (const Interval &other) const
 compare two intervals More...
 
bool operator!= (const Interval &other) const
 compare two intervals More...
 

Detailed Description

Represents an interval.

Constructor & Destructor Documentation

SFCGAL::detail::Interval::Interval ( )

default constructor (empty interval)

SFCGAL::detail::Interval::Interval ( const double &  value)

collapsed interval constructor

Parameters
valueThe single value for collapsed interval
SFCGAL::detail::Interval::Interval ( const double &  value1,
const double &  value2 
)

constructor with two values

Parameters
value1First boundary value
value2Second boundary value
SFCGAL::detail::Interval::Interval ( const Interval &  other)
default

copy constructor

Parameters
otherThe interval to copy from

Member Function Documentation

void SFCGAL::detail::Interval::expandBy ( const double &  expandAmount)

expand the interval

Warning
no effect if isEmpty()
Parameters
expandAmountThe amount to expand by
void SFCGAL::detail::Interval::expandToInclude ( const Interval &  other)

expand the interval to include an other interval.

Warning
no effect if other.isEmpty()
Parameters
otherThe interval to include
void SFCGAL::detail::Interval::expandToInclude ( const double &  value)

expand the interval to include a value

Warning
no effect if value is NaN
Parameters
valueThe value to include
auto SFCGAL::detail::Interval::intersects ( const Interval &  other) const

test if this intersects other

Parameters
otherThe interval to test intersection with
Returns
True if intervals intersect
auto SFCGAL::detail::Interval::isEmpty ( ) const

indicates if the interval is empty

Returns
True if the interval is empty
const double& SFCGAL::detail::Interval::lower ( ) const
inline

return the lower value

Returns
The lower boundary of the interval
auto SFCGAL::detail::Interval::operator!= ( const Interval &  other) const

compare two intervals

Warning
false for empty intervals
Parameters
otherThe interval to compare with
Returns
True if intervals are not equal
auto SFCGAL::detail::Interval::operator= ( const Interval &  other) -> Interval &
default

assign operator

Parameters
otherThe interval to assign from
Returns
Reference to this interval
auto SFCGAL::detail::Interval::operator== ( const Interval &  other) const

compare two intervals

Warning
true for empty intervals
Parameters
otherThe interval to compare with
Returns
True if intervals are equal
const double& SFCGAL::detail::Interval::upper ( ) const
inline

return the upper value

Returns
The upper boundary of the interval
double SFCGAL::detail::Interval::width ( ) const
inline

return the width of the interval

Returns
The width (upper - lower) of the interval