Loading...
Searching...
No Matches
GfRange2d Class Reference

Basic type: 2-dimensional floating point range. More...

#include <range2d.h>

Public Types

typedef GfVec2d MinMaxType
 Helper typedef.
 
typedef GfVec2d::ScalarType ScalarType
 

Public Member Functions

void SetEmpty ()
 Sets the range to an empty interval.
 
 GfRange2d ()
 The default constructor creates an empty range.
 
 GfRange2d (const GfVec2d &min, const GfVec2d &max)
 This constructor initializes the minimum and maximum points.
 
GF_API GfRange2d (class GfRange2f const &other)
 Implicitly convert from GfRange2f.
 
const GfVec2dGetMin () const
 Returns the minimum value of the range.
 
const GfVec2dGetMax () const
 Returns the maximum value of the range.
 
GfVec2d GetSize () const
 Returns the size of the range.
 
GfVec2d GetMidpoint () const
 Returns the midpoint of the range, that is, 0.5*(min+max).
 
void SetMin (const GfVec2d &min)
 Sets the minimum value of the range.
 
void SetMax (const GfVec2d &max)
 Sets the maximum value of the range.
 
bool IsEmpty () const
 Returns whether the range is empty (max < min).
 
void ExtendBy (const GfVec2d &point)
 Modifies the range if necessary to surround the given value.
 
void ExtendBy (const GfRange2d &range)
 Modifies the range if necessary to surround the given range.
 
bool Contains (const GfVec2d &point) const
 Returns true if the point is located inside the range.
 
bool Contains (const GfRange2d &range) const
 Returns true if the range is located entirely inside the range.
 
bool IsInside (const GfVec2d &point) const
 Returns true if the point is located inside the range.
 
bool IsInside (const GfRange2d &range) const
 Returns true if the range is located entirely inside the range.
 
bool IsOutside (const GfRange2d &range) const
 Returns true if the range is located entirely outside the range.
 
const GfRange2dUnionWith (const GfRange2d &b)
 Extend this to include b.
 
const GfRange2dUnionWith (const GfVec2d &b)
 Extend this to include b.
 
const GfRange2dUnion (const GfRange2d &b)
 Extend this to include b.
 
const GfRange2dUnion (const GfVec2d &b)
 Extend this to include b.
 
const GfRange2dIntersectWith (const GfRange2d &b)
 Modifies this range to hold its intersection with b and returns the result.
 
const GfRange2dIntersection (const GfRange2d &b)
 Modifies this range to hold its intersection with b and returns the result.
 
GfRange2doperator+= (const GfRange2d &b)
 unary sum.
 
GfRange2doperator-= (const GfRange2d &b)
 unary difference.
 
GfRange2doperator*= (double m)
 unary multiply.
 
GfRange2doperator/= (double m)
 unary division.
 
GfRange2d operator+ (const GfRange2d &b) const
 binary sum.
 
GfRange2d operator- (const GfRange2d &b) const
 binary difference.
 
bool operator== (const GfRange2d &b) const
 The min and max points must match exactly for equality.
 
bool operator!= (const GfRange2d &b) const
 
GF_API bool operator== (const GfRange2f &other) const
 Compare this range to a GfRange2f.
 
GF_API bool operator!= (const GfRange2f &other) const
 
GF_API double GetDistanceSquared (const GfVec2d &p) const
 Compute the squared distance from a point to the range.
 
GF_API GfVec2d GetCorner (size_t i) const
 Returns the ith corner of the range, in the following order: SW, SE, NW, NE.
 
GF_API GfRange2d GetQuadrant (size_t i) const
 Returns the ith quadrant of the range, in the following order: SW, SE, NW, NE.
 

Static Public Member Functions

static GfRange2d GetUnion (const GfRange2d &a, const GfRange2d &b)
 Returns the smallest GfRange2d which contains both a and b.
 
static GfRange2d Union (const GfRange2d &a, const GfRange2d &b)
 Returns the smallest GfRange2d which contains both a and b.
 
static GfRange2d GetIntersection (const GfRange2d &a, const GfRange2d &b)
 Returns a GfRange2d that describes the intersection of a and b.
 
static GfRange2d Intersection (const GfRange2d &a, const GfRange2d &b)
 Returns a GfRange2d that describes the intersection of a and b.
 

Static Public Attributes

static const size_t dimension = GfVec2d::dimension
 
static GF_API const GfRange2d UnitSquare
 The unit square.
 

Friends

GfRange2d operator* (double m, const GfRange2d &r)
 scalar multiply.
 
GfRange2d operator* (const GfRange2d &r, double m)
 scalar multiply.
 
GfRange2d operator/ (const GfRange2d &r, double m)
 scalar divide.
 
size_t hash_value (const GfRange2d &r)
 hash.
 

Detailed Description

Basic type: 2-dimensional floating point range.

This class represents a 2-dimensional range (or interval) All operations are component-wise and conform to interval mathematics. An empty range is one where max < min. The default empty is [FLT_MAX,-FLT_MAX]

Definition at line 63 of file range2d.h.

Member Typedef Documentation

◆ MinMaxType

Helper typedef.

Definition at line 68 of file range2d.h.

◆ ScalarType

typedef GfVec2d::ScalarType ScalarType

Definition at line 71 of file range2d.h.

Constructor & Destructor Documentation

◆ GfRange2d() [1/3]

GfRange2d ( )
inline

The default constructor creates an empty range.

Definition at line 81 of file range2d.h.

◆ GfRange2d() [2/3]

GfRange2d ( const GfVec2d min,
const GfVec2d max 
)
inline

This constructor initializes the minimum and maximum points.

Definition at line 86 of file range2d.h.

◆ GfRange2d() [3/3]

GF_API GfRange2d ( class GfRange2f const &  other)

Implicitly convert from GfRange2f.

Member Function Documentation

◆ Contains() [1/2]

bool Contains ( const GfRange2d range) const
inline

Returns true if the range is located entirely inside the range.

As with all operations of this type, the ranges are assumed to include their extrema.

Definition at line 142 of file range2d.h.

◆ Contains() [2/2]

bool Contains ( const GfVec2d point) const
inline

Returns true if the point is located inside the range.

As with all operations of this type, the range is assumed to include its extrema.

Definition at line 134 of file range2d.h.

◆ ExtendBy() [1/2]

void ExtendBy ( const GfRange2d range)
inline

Modifies the range if necessary to surround the given range.

Deprecated:
Use UnionWith() instead.

Definition at line 130 of file range2d.h.

◆ ExtendBy() [2/2]

void ExtendBy ( const GfVec2d point)
inline

Modifies the range if necessary to surround the given value.

Deprecated:
Use UnionWith() instead.

Definition at line 126 of file range2d.h.

◆ GetCorner()

GF_API GfVec2d GetCorner ( size_t  i) const

Returns the ith corner of the range, in the following order: SW, SE, NW, NE.

◆ GetDistanceSquared()

GF_API double GetDistanceSquared ( const GfVec2d p) const

Compute the squared distance from a point to the range.

◆ GetIntersection()

static GfRange2d GetIntersection ( const GfRange2d a,
const GfRange2d b 
)
inlinestatic

Returns a GfRange2d that describes the intersection of a and b.

Definition at line 210 of file range2d.h.

◆ GetMax()

const GfVec2d & GetMax ( ) const
inline

Returns the maximum value of the range.

Definition at line 100 of file range2d.h.

◆ GetMidpoint()

GfVec2d GetMidpoint ( ) const
inline

Returns the midpoint of the range, that is, 0.5*(min+max).

Note: this returns zero in the case of default-constructed ranges, or ranges set via SetEmpty().

Definition at line 108 of file range2d.h.

◆ GetMin()

const GfVec2d & GetMin ( ) const
inline

Returns the minimum value of the range.

Definition at line 97 of file range2d.h.

◆ GetQuadrant()

GF_API GfRange2d GetQuadrant ( size_t  i) const

Returns the ith quadrant of the range, in the following order: SW, SE, NW, NE.

◆ GetSize()

GfVec2d GetSize ( ) const
inline

Returns the size of the range.

Definition at line 103 of file range2d.h.

◆ GetUnion()

static GfRange2d GetUnion ( const GfRange2d a,
const GfRange2d b 
)
inlinestatic

Returns the smallest GfRange2d which contains both a and b.

Definition at line 170 of file range2d.h.

◆ Intersection() [1/2]

static GfRange2d Intersection ( const GfRange2d a,
const GfRange2d b 
)
inlinestatic

Returns a GfRange2d that describes the intersection of a and b.

Deprecated:
Use GetIntersection() instead.

Definition at line 219 of file range2d.h.

◆ Intersection() [2/2]

const GfRange2d & Intersection ( const GfRange2d b)
inline

Modifies this range to hold its intersection with b and returns the result.

Deprecated:
Use IntersectWith() instead.

Definition at line 234 of file range2d.h.

◆ IntersectWith()

const GfRange2d & IntersectWith ( const GfRange2d b)
inline

Modifies this range to hold its intersection with b and returns the result.

Definition at line 225 of file range2d.h.

◆ IsEmpty()

bool IsEmpty ( ) const
inline

Returns whether the range is empty (max < min).

Definition at line 120 of file range2d.h.

◆ IsInside() [1/2]

bool IsInside ( const GfRange2d range) const
inline

Returns true if the range is located entirely inside the range.

As with all operations of this type, the ranges are assumed to include their extrema.

Deprecated:
Use Contains() instead.

Definition at line 157 of file range2d.h.

◆ IsInside() [2/2]

bool IsInside ( const GfVec2d point) const
inline

Returns true if the point is located inside the range.

As with all operations of this type, the range is assumed to include its extrema.

Deprecated:
Use Contains() instead.

Definition at line 149 of file range2d.h.

◆ IsOutside()

bool IsOutside ( const GfRange2d range) const
inline

Returns true if the range is located entirely outside the range.

As with all operations of this type, the ranges are assumed to include their extrema.

Definition at line 164 of file range2d.h.

◆ operator!=() [1/2]

bool operator!= ( const GfRange2d b) const
inline

Definition at line 310 of file range2d.h.

◆ operator!=() [2/2]

bool operator!= ( const GfRange2f other) const
inline

Definition at line 371 of file range2d.h.

◆ operator*=()

GfRange2d & operator*= ( double  m)
inline

unary multiply.

Definition at line 253 of file range2d.h.

◆ operator+()

GfRange2d operator+ ( const GfRange2d b) const
inline

binary sum.

Definition at line 271 of file range2d.h.

◆ operator+=()

GfRange2d & operator+= ( const GfRange2d b)
inline

unary sum.

Definition at line 239 of file range2d.h.

◆ operator-()

GfRange2d operator- ( const GfRange2d b) const
inline

binary difference.

Definition at line 277 of file range2d.h.

◆ operator-=()

GfRange2d & operator-= ( const GfRange2d b)
inline

unary difference.

Definition at line 246 of file range2d.h.

◆ operator/=()

GfRange2d & operator/= ( double  m)
inline

unary division.

Definition at line 266 of file range2d.h.

◆ operator==() [1/2]

bool operator== ( const GfRange2d b) const
inline

The min and max points must match exactly for equality.

Definition at line 306 of file range2d.h.

◆ operator==() [2/2]

bool operator== ( const GfRange2f other) const
inline

Compare this range to a GfRange2f.

The values must match exactly and it does exactly what you might expect when comparing float and double values.

Definition at line 365 of file range2d.h.

◆ SetEmpty()

void SetEmpty ( )
inline

Sets the range to an empty interval.

Definition at line 75 of file range2d.h.

◆ SetMax()

void SetMax ( const GfVec2d max)
inline

Sets the maximum value of the range.

Definition at line 117 of file range2d.h.

◆ SetMin()

void SetMin ( const GfVec2d min)
inline

Sets the minimum value of the range.

Definition at line 114 of file range2d.h.

◆ Union() [1/3]

static GfRange2d Union ( const GfRange2d a,
const GfRange2d b 
)
inlinestatic

Returns the smallest GfRange2d which contains both a and b.

Deprecated:
Use GetUnion() instead.

Definition at line 193 of file range2d.h.

◆ Union() [2/3]

const GfRange2d & Union ( const GfRange2d b)
inline

Extend this to include b.

Deprecated:
Use UnionWith() instead.

Definition at line 199 of file range2d.h.

◆ Union() [3/3]

const GfRange2d & Union ( const GfVec2d b)
inline

Extend this to include b.

Deprecated:
Use UnionWith() instead.

Definition at line 205 of file range2d.h.

◆ UnionWith() [1/2]

const GfRange2d & UnionWith ( const GfRange2d b)
inline

Extend this to include b.

Definition at line 178 of file range2d.h.

◆ UnionWith() [2/2]

const GfRange2d & UnionWith ( const GfVec2d b)
inline

Extend this to include b.

Definition at line 185 of file range2d.h.

Friends And Related Function Documentation

◆ hash_value

size_t hash_value ( const GfRange2d r)
friend

hash.

Definition at line 301 of file range2d.h.

◆ operator* [1/2]

GfRange2d operator* ( const GfRange2d r,
double  m 
)
friend

scalar multiply.

Definition at line 289 of file range2d.h.

◆ operator* [2/2]

GfRange2d operator* ( double  m,
const GfRange2d r 
)
friend

scalar multiply.

Definition at line 282 of file range2d.h.

◆ operator/

GfRange2d operator/ ( const GfRange2d r,
double  m 
)
friend

scalar divide.

Definition at line 296 of file range2d.h.

Member Data Documentation

◆ dimension

const size_t dimension = GfVec2d::dimension
static

Definition at line 70 of file range2d.h.

◆ UnitSquare

GF_API const GfRange2d UnitSquare
static

The unit square.

Definition at line 337 of file range2d.h.


The documentation for this class was generated from the following file: