7#ifndef PXR_BASE_GF_MULTI_INTERVAL_H
8#define PXR_BASE_GF_MULTI_INTERVAL_H
15#include "pxr/base/gf/api.h"
21PXR_NAMESPACE_OPEN_SCOPE
32 typedef std::set<GfInterval> Set;
33 typedef Set::const_iterator const_iterator;
34 typedef Set::const_iterator iterator;
46 GF_API
bool operator==(
const GfMultiInterval &that)
const {
return _set == that._set; }
47 GF_API
bool operator!=(
const GfMultiInterval &that)
const {
return !(*
this == that); }
48 GF_API
bool operator<(
const GfMultiInterval &that)
const {
return _set < that._set; }
49 GF_API
bool operator>=(
const GfMultiInterval &that)
const {
return !(*
this < that); }
50 GF_API
bool operator>(
const GfMultiInterval &that)
const {
return (that < *
this); }
51 GF_API
bool operator<=(
const GfMultiInterval &that)
const {
return !(that < *
this); }
56 GF_API
size_t Hash()
const;
66 GF_API
bool IsEmpty()
const {
return _set.empty(); }
69 GF_API
size_t GetSize()
const {
return _set.size(); }
91 GF_API
void Clear() { _set.clear(); }
108 GF_API
void Intersect(
const GfInterval & i );
121 GF_API const_iterator begin()
const {
return _set.begin(); }
122 GF_API const_iterator end()
const {
return _set.end(); }
155 void _AssertInvariants()
const;
164PXR_NAMESPACE_CLOSE_SCOPE
A basic mathematical interval class.
static GfInterval GetFullInterval()
Returns the full interval (-inf, inf).
GfMultiInterval represents a subset of the real number line as an ordered set of non-intersecting GfI...
GF_API const_iterator GetPriorNonContainingInterval(double x) const
Returns an iterator identifying the last (highest) interval whose maximum value is < x.
GF_API const_iterator GetNextNonContainingInterval(double x) const
Returns an iterator identifying the first (lowest) interval whose minimum value is > x.
GF_API void Add(const GfInterval &i)
Add the given interval to the multi-interval.
void swap(GfMultiInterval &other)
Swap two multi-intervals.
GF_API GfMultiInterval GetComplement() const
Return the complement of this set.
GF_API void Clear()
Clear the multi-interval.
GF_API const_iterator lower_bound(double x) const
Returns an iterator identifying the first (lowest) interval whose minimum value is >= x.
GF_API bool Contains(double d) const
Returns true if the multi-interval contains the given value.
GF_API const_iterator upper_bound(double x) const
Returns an iterator identifying the first (lowest) interval whose minimum value is > x.
GF_API void ArithmeticAdd(const GfInterval &i)
Uses the given interval to extend the multi-interval in the interval arithmetic sense.
GF_API GfMultiInterval(const std::vector< GfInterval > &intervals)
Constructs an multi-interval containing the given input intervals.
GF_API const_iterator GetContainingInterval(double x) const
Returns an iterator identifying the interval that contains x.
GF_API bool Contains(const GfMultiInterval &s) const
Returns true if the multi-interval contains all the intervals in the given multi-interval.
GF_API bool IsEmpty() const
Returns true if the multi-interval is empty.
GF_API void Remove(const GfMultiInterval &s)
Remove the given multi-interval from this multi-interval.
GF_API void Add(const GfMultiInterval &s)
Add the given multi-interval to the multi-interval.
GF_API GfInterval GetBounds() const
Returns an interval bounding the entire multi-interval.
GF_API void Remove(const GfInterval &i)
Remove the given interval from this multi-interval.
GF_API size_t GetSize() const
Returns the number of intervals in the set.
static GfMultiInterval GetFullInterval()
Returns the full interval (-inf, inf).
GF_API GfMultiInterval(const GfInterval &i)
Constructs an multi-interval with the single given interval.
GF_API size_t Hash() const
Hash value.
GF_API bool Contains(const GfInterval &i) const
Returns true if the multi-interval contains the given interval.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].