MeshLib C++ Docs
Loading...
Searching...
No Matches
MRHistogram.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRHeapBytes.h"
4
5namespace MR
6{
9
13{
14public:
15 Histogram() = default;
16
18 MRMESH_API Histogram( float min, float max, size_t size );
19
21 MRMESH_API void addSample( float sample, size_t count = 1 );
23 MRMESH_API void addHistogram( const Histogram& hist );
24
26 MRMESH_API const std::vector<size_t>& getBins() const;
27
29 MRMESH_API float getMin() const;
31 MRMESH_API float getMax() const;
32
34 MRMESH_API size_t getBinId( float sample ) const;
36 MRMESH_API std::pair<float, float> getBinMinMax( size_t binId ) const;
37
39 [[nodiscard]] size_t heapBytes() const { return MR::heapBytes( bins_ ); }
40
41private:
42 std::vector<size_t> bins_;
43 float min_{0.0f};
44 float max_{0.0f};
45 float binSize_{0.0f};
46};
47}
Definition MRHistogram.h:13
size_t heapBytes(const BitSet &bs)
returns the amount of memory given BitSet occupies on heap
Definition MRBitSet.h:313
MRMESH_API void addSample(float sample, size_t count=1)
Adds sample to corresponding bin.
ImVec2 size(const ViewportRectangle &rect)
Definition MRViewport.h:32
size_t heapBytes() const
returns the amount of memory this object occupies on heap
Definition MRHistogram.h:39
MRMESH_API float getMin() const
Gets minimum value of histogram.
MRMESH_API const std::vector< size_t > & getBins() const
Gets bins.
MRMESH_API std::pair< float, float > getBinMinMax(size_t binId) const
Gets minimum and maximum of diapason inherited by bin.
MRMESH_API float getMax() const
Gets maximum value of histogram.
MRMESH_API Histogram(float min, float max, size_t size)
Initialize histogram with minimum and maximum values, and number of bins.
MRMESH_API size_t getBinId(float sample) const
Gets id of bin that inherits sample.
Histogram()=default
MRMESH_API void addHistogram(const Histogram &hist)
Adds bins of input hist to this.
only for bindings generation
Definition MRCameraOrientationPlugin.h:8