29#ifndef CPPSRC_CORE_INCLUDE_COVERAGECONTROL_BIVARIATE_NORMAL_DISTRIBUTION_H_
30#define CPPSRC_CORE_INCLUDE_COVERAGECONTROL_BIVARIATE_NORMAL_DISTRIBUTION_H_
85 double const scale = 1) {
87 sigma_ =
Point2(sigma, sigma);
104 double const rho,
double const scale = 1) {
105 assert(rho_ < (1 -
kEps));
107 is_circular_ =
false;
139 return Point2((in_point - mean_) / sigma_.x());
141 Point2 translated = in_point - mean_;
142 Point2 normalized(translated.x() / sigma_.x(), translated.y() / sigma_.y());
144 (normalized.x() - rho_ * normalized.y()) / (std::sqrt(1 - rho_ * rho_)),
149 Point2f mean_f = mean_.cast<
float>();
150 Point2f sigma_f = sigma_.cast<
float>();
151 float rho_f =
static_cast<float>(rho_);
152 if (is_circular_ or std::abs(rho_f) <
kEpsf) {
153 return Point2f((in_point_f - mean_f) / sigma_f.x());
155 Point2f translated = in_point_f - mean_f;
156 Point2f normalized(translated.x() / sigma_f.x(),
157 translated.y() / sigma_f.y());
159 (normalized.x() - rho_f * normalized.y()) / (sqrt(1 - rho_f * rho_f)),
173 return scale_ * std::erfc(transformed_point.x() *
kOneBySqrt2) *
174 std::erfc(transformed_point.y() *
kOneBySqrt2) / 4.;
178 float scale_f =
static_cast<float>(scale_);
180 return scale_f * std::erfc(transformed_point.x() *
kOneBySqrt2f) *
Class for Bivariate Normal Distribution.
double GetScale() const
Returns the scale of the distribution.
double GetRho() const
Returns the correlation coefficient of the distribution.
Point2 GetMean() const
Returns the mean of the distribution.
BivariateNormalDistribution()
Default constructor.
Point2f TransformPoint(Point2f const &in_point_f) const
Point2 GetSigma() const
Returns the standard deviation of the distribution.
Point2 TransformPoint(Point2 const &in_point) const
Transforms a point from general distribution to standard distribution.
BivariateNormalDistribution(Point2 const &mean, Point2 const &sigma, double const rho, double const scale=1)
Constructor for general distribution.
double IntegrateQuarterPlane(Point2 const &point) const
Integrates the distribution over a quarter plane The function integrates the distribution over a quar...
BivariateNormalDistribution(Point2 const &mean, double const &sigma, double const scale=1)
Constructor for standard distribution.
float IntegrateQuarterPlane(Point2f const &point) const
Constants for the CoverageControl library.
Namespace for the CoverageControl library.
Contains typedefs for the library.