ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
WeibullDistribution.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // Local
11 #include "GenericDistribution.h"
12 
13 namespace cloudViewer {
14 
16 
19 public:
22 
24 
30  WeibullDistribution(ScalarType a, ScalarType b, ScalarType valueShift = 0);
31 
33 
37  bool getParameters(ScalarType& a, ScalarType& b) const;
38 
40 
44  bool getOtherParameters(ScalarType& mu, ScalarType& sigma2) const;
45 
47  double computeMode() const;
49  double computeSkewness() const;
50 
52 
57  bool setParameters(ScalarType a, ScalarType b, ScalarType valueShift = 0);
58 
60 
62  void setValueShift(ScalarType vs);
63 
65  inline ScalarType getValueShift() const { return m_valueShift; }
66 
67  // inherited methods (see GenericDistribution)
68  bool computeParameters(const ScalarContainer& values) override;
69  double computeP(ScalarType x) const override;
70  double computePfromZero(ScalarType x) const override;
71  double computeP(ScalarType x1, ScalarType x2) const override;
72  double computeChi2Dist(const GenericCloud* cloud,
73  unsigned numberOfClasses,
74  int* histo = nullptr) override;
75  const char* getName() const override { return "Weibull"; }
76 
77 protected:
79 
83  virtual bool setChi2ClassesPositions(unsigned numberOfClasses);
84 
86 
89  std::vector<ScalarType> chi2ClassesPositions;
90 
94  ScalarType m_a;
96  ScalarType m_b;
98  ScalarType m_valueShift;
99 
101  ScalarType m_mu;
103  ScalarType m_sigma2;
104 
106 
108  static double ComputeG(const ScalarContainer& values,
109  double a,
110  ScalarType valueShift,
111  double valueRange);
113  static double FindGRoot(const ScalarContainer& values,
114  ScalarType valueShift,
115  double valueRange);
116 };
117 
118 } // namespace cloudViewer
#define CV_CORE_LIB_API
Definition: CVCoreLibWin.h:15
A generic class to handle a probability distribution.
std::vector< ScalarType > ScalarContainer
Scalar values container.
The Weibull statistical parametric distribution.
bool parametersDefined
Parameters validity.
ScalarType getValueShift() const
Returns the distribution value shift.
ScalarType m_a
Weibull distribution parameter a (k)
ScalarType m_sigma2
Normal distribution equivalent parameter: variance.
ScalarType m_mu
Normal distribution equivalent parameter: mean.
ScalarType m_valueShift
Weibull distribution parameter 'value shift'.
ScalarType m_b
Weibull distribution parameter b (lambda)
std::vector< ScalarType > chi2ClassesPositions
Chi2 classes limits.
const char * getName() const override
Returns distribution name.
Generic file read and write utility for python interface.