OpenWalnut  1.4.0
Public Types | Public Member Functions | Private Types | Private Attributes
WHistogram2D Class Reference

Uniform two dimensional histogram for double values. More...

#include <WHistogram2D.h>

+ Inheritance diagram for WHistogram2D:

List of all members.

Public Types

typedef boost::shared_ptr
< WHistogram2D
SPtr
 Convenience type for a shared_ptr on this type.

Public Member Functions

 WHistogram2D (double minX, double maxX, double minY, double maxY, size_t bucketsX, size_t bucketsY)
 Creates a two dimensional histogram field, bounded by the given limits, containing the demanded number of buckets in each dimension.
 ~WHistogram2D ()
 Cleans up!
 WHistogram2D (const WHistogram2D &other)
 Copy constructor, performing a deep copy.
virtual size_t operator() (SizeArray index) const
 Get the count of the specified bucket.
virtual size_t operator() (size_t i, size_t j) const
 Convenience function to easier access the buckets for 2D.
virtual double getBucketSize (SizeArray index) const
 Return the measure of one specific bucket.
virtual boost::array
< std::pair< double, double >, 2 > 
getIntervalForIndex (SizeArray index) const
 Returns the actual (right-open) interval in each dimension associated with the given index.
void insert (TArray values)
 Given a value the corresponding bucket is determined and incremented by one.
void insert (double x, double y)
 Shorthand to overloaded insert function where each dimension can be overhanded separately.
WGETexture2D::RPtr getTexture ()
 Copy-convert this into a texture.
WGETexture2D::RPtr getSphereTexture ()
 Copy-convert this into a spherical texture.

Private Types

typedef Eigen::Matrix< size_t,
Eigen::Dynamic, Eigen::Dynamic > 
BinType
 Shorthand for data structure storing bucket information.

Private Attributes

BinType m_bins
 Storing the bucket counts, how often a value occurs.
TArray m_intervalWidth
 For each dimension this stores the uniform interval width.

Detailed Description

Uniform two dimensional histogram for double values.

The terms bin and bucket are interchangeable. For the first dimensional part often the analouge X-dimension is used and for the second, Y-dimension.

Definition at line 42 of file WHistogram2D.h.


Member Typedef Documentation

typedef Eigen::Matrix< size_t, Eigen::Dynamic, Eigen::Dynamic > WHistogram2D::BinType [private]

Shorthand for data structure storing bucket information.

In 2D this is a matrix.

Definition at line 146 of file WHistogram2D.h.

typedef boost::shared_ptr< WHistogram2D > WHistogram2D::SPtr

Convenience type for a shared_ptr on this type.

Definition at line 48 of file WHistogram2D.h.


Constructor & Destructor Documentation

WHistogram2D::WHistogram2D ( double  minX,
double  maxX,
double  minY,
double  maxY,
size_t  bucketsX,
size_t  bucketsY 
)

Creates a two dimensional histogram field, bounded by the given limits, containing the demanded number of buckets in each dimension.

Parameters:
minXMinimal bound for X-values.
maxXMaximal bound for X-values.
minYMinimal bound for Y-values.
maxYMaximal bound for Y-values.
bucketsXNumber of buckets in X direction.
bucketsYNumber of buckets in Y direction.

Definition at line 34 of file WHistogram2D.cpp.

References m_bins, m_intervalWidth, and WHistogramND< 2 >::reset().

Cleans up!

Definition at line 47 of file WHistogram2D.cpp.

Copy constructor, performing a deep copy.

Parameters:
otherThe other instance to copy from.

Definition at line 51 of file WHistogram2D.cpp.

References m_bins.


Member Function Documentation

double WHistogram2D::getBucketSize ( SizeArray  index) const [virtual]

Return the measure of one specific bucket.

For one dimensional Histograms this is the width of the bucket, for two dimensions this is the area, for three dims this is the volume, etc.

Parameters:
indexthe measure for this bucket is queried.
Returns:
the size of a bucket.

Implements WHistogramND< 2 >.

Definition at line 68 of file WHistogram2D.cpp.

References m_intervalWidth.

boost::array< std::pair< double, double >, 2 > WHistogram2D::getIntervalForIndex ( SizeArray  index) const [virtual]

Returns the actual (right-open) interval in each dimension associated with the given index.

Parameters:
indexfor this bucket the intervals will be returned
Returns:
the right-open interval in each dimension.

Implements WHistogramND< 2 >.

Definition at line 73 of file WHistogram2D.cpp.

References m_intervalWidth, and WHistogramND< 2 >::m_min.

Copy-convert this into a spherical texture.

Spherical means hereby, that buckets representing areas near the poles have scaled counters.

Returns:
osg::ref_ptr to the two-dimensional spherical texture.

Definition at line 168 of file WHistogram2D.cpp.

References m_bins, and WHistogramND< 2 >::m_buckets.

Copy-convert this into a texture.

Returns:
osg::ref_ptr to the two-dimensional texture.

Definition at line 123 of file WHistogram2D.cpp.

References m_bins, and WHistogramND< 2 >::m_buckets.

void WHistogram2D::insert ( TArray  values)
void WHistogram2D::insert ( double  x,
double  y 
)

Shorthand to overloaded insert function where each dimension can be overhanded separately.

See also:
insert()
Parameters:
xvalue for the first dimension.
yvalue for the second dimension.

Definition at line 117 of file WHistogram2D.cpp.

References insert().

size_t WHistogram2D::operator() ( SizeArray  index) const [virtual]

Get the count of the specified bucket.

Parameters:
indexin each dimension
Returns:
elements in the bucket.

Implements WHistogramND< 2 >.

Definition at line 57 of file WHistogram2D.cpp.

References m_bins.

Referenced by operator()().

size_t WHistogram2D::operator() ( size_t  i,
size_t  j 
) const [virtual]

Convenience function to easier access the buckets for 2D.

Parameters:
iX-index
jY-index
Returns:
elements in the bucket.

Definition at line 62 of file WHistogram2D.cpp.

References operator()().


Member Data Documentation

Storing the bucket counts, how often a value occurs.

Definition at line 151 of file WHistogram2D.h.

Referenced by getSphereTexture(), getTexture(), insert(), operator()(), and WHistogram2D().

For each dimension this stores the uniform interval width.

Definition at line 156 of file WHistogram2D.h.

Referenced by getBucketSize(), getIntervalForIndex(), insert(), and WHistogram2D().


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