OpenWalnut
1.4.0
|
Uniform two dimensional histogram for double values. More...
#include <WHistogram2D.h>
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. |
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.
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.
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.
minX | Minimal bound for X-values. |
maxX | Maximal bound for X-values. |
minY | Minimal bound for Y-values. |
maxY | Maximal bound for Y-values. |
bucketsX | Number of buckets in X direction. |
bucketsY | Number 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.
WHistogram2D::WHistogram2D | ( | const WHistogram2D & | other | ) |
Copy constructor, performing a deep copy.
other | The other instance to copy from. |
Definition at line 51 of file WHistogram2D.cpp.
References m_bins.
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.
index | the measure for this bucket is queried. |
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.
index | for this bucket the intervals will be returned |
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.
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.
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 | ) |
Given a value the corresponding bucket is determined and incremented by one.
values | The value to count into specific bucket. |
Definition at line 86 of file WHistogram2D.cpp.
References wlimits::DBL_EPS, m_bins, WHistogramND< 2 >::m_buckets, m_intervalWidth, WHistogramND< 2 >::m_max, WHistogramND< 2 >::m_min, and wlog::warn().
Referenced by insert(), WHistogram2DTest::testInsert(), WHistogram2DTest::testInsertAlmostMax(), WHistogram2DTest::testInsertMax(), WHistogram2DTest::testInsertMin(), WHistogram2DTest::testInsertOnIntervalBorder(), and WHistogram2DTest::testInsertOutOfBounds().
void WHistogram2D::insert | ( | double | x, |
double | y | ||
) |
Shorthand to overloaded insert function where each dimension can be overhanded separately.
x | value for the first dimension. |
y | value for the second dimension. |
Definition at line 117 of file WHistogram2D.cpp.
References insert().
Get the count of the specified bucket.
index | in each dimension |
Implements WHistogramND< 2 >.
Definition at line 57 of file WHistogram2D.cpp.
References m_bins.
Referenced by operator()().
Convenience function to easier access the buckets for 2D.
i | X-index |
j | Y-index |
Definition at line 62 of file WHistogram2D.cpp.
References operator()().
BinType WHistogram2D::m_bins [private] |
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().
TArray WHistogram2D::m_intervalWidth [private] |
For each dimension this stores the uniform interval width.
Definition at line 156 of file WHistogram2D.h.
Referenced by getBucketSize(), getIntervalForIndex(), insert(), and WHistogram2D().