Loading...
Searching...
No Matches
GfRange1d Class Reference

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

#include <range1d.h>

Public Types

typedef double MinMaxType
 Helper typedef.
 
typedef MinMaxType ScalarType
 

Public Member Functions

void SetEmpty ()
 Sets the range to an empty interval.
 
 GfRange1d ()
 The default constructor creates an empty range.
 
 GfRange1d (double min, double max)
 This constructor initializes the minimum and maximum points.
 
GF_API GfRange1d (class GfRange1f const &other)
 Implicitly convert from GfRange1f.
 
double GetMin () const
 Returns the minimum value of the range.
 
double GetMax () const
 Returns the maximum value of the range.
 
double GetSize () const
 Returns the size of the range.
 
double GetMidpoint () const
 Returns the midpoint of the range, that is, 0.5*(min+max).
 
void SetMin (double min)
 Sets the minimum value of the range.
 
void SetMax (double max)
 Sets the maximum value of the range.
 
bool IsEmpty () const
 Returns whether the range is empty (max < min).
 
void ExtendBy (double point)
 Modifies the range if necessary to surround the given value.
 
void ExtendBy (const GfRange1d &range)
 Modifies the range if necessary to surround the given range.
 
bool Contains (double point) const
 Returns true if the point is located inside the range.
 
bool Contains (const GfRange1d &range) const
 Returns true if the range is located entirely inside the range.
 
bool IsInside (double point) const
 Returns true if the point is located inside the range.
 
bool IsInside (const GfRange1d &range) const
 Returns true if the range is located entirely inside the range.
 
bool IsOutside (const GfRange1d &range) const
 Returns true if the range is located entirely outside the range.
 
const GfRange1dUnionWith (const GfRange1d &b)
 Extend this to include b.
 
const GfRange1dUnionWith (double b)
 Extend this to include b.
 
const GfRange1dUnion (const GfRange1d &b)
 Extend this to include b.
 
const GfRange1dUnion (double b)
 Extend this to include b.
 
const GfRange1dIntersectWith (const GfRange1d &b)
 Modifies this range to hold its intersection with b and returns the result.
 
const GfRange1dIntersection (const GfRange1d &b)
 Modifies this range to hold its intersection with b and returns the result.
 
GfRange1doperator+= (const GfRange1d &b)
 unary sum.
 
GfRange1doperator-= (const GfRange1d &b)
 unary difference.
 
GfRange1doperator*= (double m)
 unary multiply.
 
GfRange1doperator/= (double m)
 unary division.
 
GfRange1d operator+ (const GfRange1d &b) const
 binary sum.
 
GfRange1d operator- (const GfRange1d &b) const
 binary difference.
 
bool operator== (const GfRange1d &b) const
 The min and max points must match exactly for equality.
 
bool operator!= (const GfRange1d &b) const
 
GF_API bool operator== (const GfRange1f &other) const
 Compare this range to a GfRange1f.
 
GF_API bool operator!= (const GfRange1f &other) const
 
GF_API double GetDistanceSquared (double p) const
 Compute the squared distance from a point to the range.
 

Static Public Member Functions

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

Static Public Attributes

static const size_t dimension = 1
 

Friends

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

Detailed Description

Basic type: 1-dimensional floating point range.

This class represents a 1-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 61 of file range1d.h.

Member Typedef Documentation

◆ MinMaxType

typedef double MinMaxType

Helper typedef.

Definition at line 66 of file range1d.h.

◆ ScalarType

typedef MinMaxType ScalarType

Definition at line 69 of file range1d.h.

Constructor & Destructor Documentation

◆ GfRange1d() [1/3]

GfRange1d ( )
inline

The default constructor creates an empty range.

Definition at line 79 of file range1d.h.

◆ GfRange1d() [2/3]

GfRange1d ( double  min,
double  max 
)
inline

This constructor initializes the minimum and maximum points.

Definition at line 84 of file range1d.h.

◆ GfRange1d() [3/3]

GF_API GfRange1d ( class GfRange1f const &  other)

Implicitly convert from GfRange1f.

Member Function Documentation

◆ Contains() [1/2]

bool Contains ( const GfRange1d 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 139 of file range1d.h.

◆ Contains() [2/2]

bool Contains ( double  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 132 of file range1d.h.

◆ ExtendBy() [1/2]

void ExtendBy ( const GfRange1d range)
inline

Modifies the range if necessary to surround the given range.

Deprecated:
Use UnionWith() instead.

Definition at line 128 of file range1d.h.

◆ ExtendBy() [2/2]

void ExtendBy ( double  point)
inline

Modifies the range if necessary to surround the given value.

Deprecated:
Use UnionWith() instead.

Definition at line 124 of file range1d.h.

◆ GetDistanceSquared()

GF_API double GetDistanceSquared ( double  p) const

Compute the squared distance from a point to the range.

◆ GetIntersection()

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

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

Definition at line 206 of file range1d.h.

◆ GetMax()

double GetMax ( ) const
inline

Returns the maximum value of the range.

Definition at line 98 of file range1d.h.

◆ GetMidpoint()

double 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 106 of file range1d.h.

◆ GetMin()

double GetMin ( ) const
inline

Returns the minimum value of the range.

Definition at line 95 of file range1d.h.

◆ GetSize()

double GetSize ( ) const
inline

Returns the size of the range.

Definition at line 101 of file range1d.h.

◆ GetUnion()

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

Returns the smallest GfRange1d which contains both a and b.

Definition at line 166 of file range1d.h.

◆ Intersection() [1/2]

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

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

Deprecated:
Use GetIntersection() instead.

Definition at line 215 of file range1d.h.

◆ Intersection() [2/2]

const GfRange1d & Intersection ( const GfRange1d b)
inline

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

Deprecated:
Use IntersectWith() instead.

Definition at line 230 of file range1d.h.

◆ IntersectWith()

const GfRange1d & IntersectWith ( const GfRange1d b)
inline

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

Definition at line 221 of file range1d.h.

◆ IsEmpty()

bool IsEmpty ( ) const
inline

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

Definition at line 118 of file range1d.h.

◆ IsInside() [1/2]

bool IsInside ( const GfRange1d 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 154 of file range1d.h.

◆ IsInside() [2/2]

bool IsInside ( double  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 146 of file range1d.h.

◆ IsOutside()

bool IsOutside ( const GfRange1d 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 161 of file range1d.h.

◆ operator!=() [1/2]

bool operator!= ( const GfRange1d b) const
inline

Definition at line 306 of file range1d.h.

◆ operator!=() [2/2]

bool operator!= ( const GfRange1f other) const
inline

Definition at line 352 of file range1d.h.

◆ operator*=()

GfRange1d & operator*= ( double  m)
inline

unary multiply.

Definition at line 249 of file range1d.h.

◆ operator+()

GfRange1d operator+ ( const GfRange1d b) const
inline

binary sum.

Definition at line 267 of file range1d.h.

◆ operator+=()

GfRange1d & operator+= ( const GfRange1d b)
inline

unary sum.

Definition at line 235 of file range1d.h.

◆ operator-()

GfRange1d operator- ( const GfRange1d b) const
inline

binary difference.

Definition at line 273 of file range1d.h.

◆ operator-=()

GfRange1d & operator-= ( const GfRange1d b)
inline

unary difference.

Definition at line 242 of file range1d.h.

◆ operator/=()

GfRange1d & operator/= ( double  m)
inline

unary division.

Definition at line 262 of file range1d.h.

◆ operator==() [1/2]

bool operator== ( const GfRange1d b) const
inline

The min and max points must match exactly for equality.

Definition at line 302 of file range1d.h.

◆ operator==() [2/2]

bool operator== ( const GfRange1f other) const
inline

Compare this range to a GfRange1f.

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

Definition at line 346 of file range1d.h.

◆ SetEmpty()

void SetEmpty ( )
inline

Sets the range to an empty interval.

Definition at line 73 of file range1d.h.

◆ SetMax()

void SetMax ( double  max)
inline

Sets the maximum value of the range.

Definition at line 115 of file range1d.h.

◆ SetMin()

void SetMin ( double  min)
inline

Sets the minimum value of the range.

Definition at line 112 of file range1d.h.

◆ Union() [1/3]

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

Returns the smallest GfRange1d which contains both a and b.

Deprecated:
Use GetUnion() instead.

Definition at line 189 of file range1d.h.

◆ Union() [2/3]

const GfRange1d & Union ( const GfRange1d b)
inline

Extend this to include b.

Deprecated:
Use UnionWith() instead.

Definition at line 195 of file range1d.h.

◆ Union() [3/3]

const GfRange1d & Union ( double  b)
inline

Extend this to include b.

Deprecated:
Use UnionWith() instead.

Definition at line 201 of file range1d.h.

◆ UnionWith() [1/2]

const GfRange1d & UnionWith ( const GfRange1d b)
inline

Extend this to include b.

Definition at line 174 of file range1d.h.

◆ UnionWith() [2/2]

const GfRange1d & UnionWith ( double  b)
inline

Extend this to include b.

Definition at line 181 of file range1d.h.

Friends And Related Function Documentation

◆ hash_value

size_t hash_value ( const GfRange1d r)
friend

hash.

Definition at line 297 of file range1d.h.

◆ operator* [1/2]

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

scalar multiply.

Definition at line 285 of file range1d.h.

◆ operator* [2/2]

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

scalar multiply.

Definition at line 278 of file range1d.h.

◆ operator/

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

scalar divide.

Definition at line 292 of file range1d.h.

Member Data Documentation

◆ dimension

const size_t dimension = 1
static

Definition at line 68 of file range1d.h.


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