SFCGAL 2.3.0
SFCGAL::detail::Interval Class Reference

Represents an interval. More...

#include <Interval.h>

Public Member Functions

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

Detailed Description

Represents an interval.

Constructor & Destructor Documentation

◆ Interval() [1/4]

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

default constructor (empty interval)

◆ Interval() [2/4]

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

collapsed interval constructor

Parameters
valueThe single value for collapsed interval

◆ Interval() [3/4]

SFCGAL::detail::Interval::Interval ( const double & value1,
const double & value2 )

constructor with two values

Parameters
value1First boundary value
value2Second boundary value

◆ Interval() [4/4]

SFCGAL::detail::Interval::Interval ( const Interval & other)
default

copy constructor

Parameters
otherThe interval to copy from

Member Function Documentation

◆ expandBy()

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

expand the interval

Warning
no effect if isEmpty()
Parameters
expandAmountThe amount to expand by

◆ expandToInclude() [1/2]

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

◆ expandToInclude() [2/2]

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

◆ intersects()

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

◆ isEmpty()

auto SFCGAL::detail::Interval::isEmpty ( ) const

indicates if the interval is empty

Returns
True if the interval is empty

◆ lower()

const double & SFCGAL::detail::Interval::lower ( ) const
inline

return the lower value

Returns
The lower boundary of the interval

◆ operator!=()

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

◆ operator=()

auto SFCGAL::detail::Interval::operator= ( const Interval & other) -> Interval &
default

assign operator

Parameters
otherThe interval to assign from
Returns
Reference to this interval

◆ operator==()

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

◆ upper()

const double & SFCGAL::detail::Interval::upper ( ) const
inline

return the upper value

Returns
The upper boundary of the interval

◆ width()

double SFCGAL::detail::Interval::width ( ) const
inline

return the width of the interval

Returns
The width (upper - lower) of the interval