Class gaussian2d_t¶
Defined in File gaussian2d.hpp
Nested Relationships¶
Nested Types¶
Class Documentation¶
-
class gaussian2d_t¶
2D Gaussian distribution. Correctly handles the singular case where the standard deviation is 0 and the distribution becomes a Dirac.
Public Functions
-
inline constexpr gaussian2d_t(vec2_t sigma = {1, 1}, dir2_t x = {1, 0}, vec2_t mu = {0, 0})¶
Construct a new 2D Gaussian distribution.
- Parameters:
sigma – standard deviation
x – direction of the x-component of
sigma
mu – mean
-
gaussian2d_t(const gaussian2d_t&) noexcept = default¶
-
gaussian2d_t &operator=(const gaussian2d_t&) noexcept = default¶
-
inline constexpr gaussian2d_t scaled(f_t s) const noexcept¶
Creates a distribution with its mean and stddev scaled by a constant.
-
inline constexpr gaussian2d_t scaled(f_t mean_scale, f_t sigma_scale) const noexcept¶
Creates a distribution with its mean and stddev scaled by constants.
-
inline constexpr auto mean() const noexcept¶
The mean of the Gaussian distribution.
-
inline constexpr auto std_dev() const noexcept¶
The standard deviations of the Gaussian distribution.
-
inline constexpr auto recp_std_dev() const noexcept¶
The reciprocal standard deviations of the Gaussian distribution.
-
inline constexpr mat2_t frame_mat() const noexcept¶
The local frame (first/second std_dev aligns with the x/y-axis) in form of a 2D rotation matrix.
-
inline auto invSigma() const noexcept¶
The inverse of the Gaussian covariance matrix (Sigma).
-
inline constexpr sample_ret_t sample(sampler::sampler_t &sampler) const noexcept¶
Samples a Gaussian distributed point.
-
template<bool equal_means = false, bool no_diracs = false>
inline f_t integrate(const gaussian2d_t &g) const noexcept¶ Integrates this Gaussian distribution over the support of another Gaussian distribution.
- Parameters:
equal_means – Assume that both distributions have equal means, and optimize accordingly.
no_diracs – Assume that both distributions are not Diracs. Allows to skip a few tests.
-
f_t integrate_triangle(vec2_t a, vec2_t b, vec2_t c) const noexcept¶
Integrates the Gaussian over the support of a triangle defined via its 3 2D vertices. Expensive. Works with arbitrary triangles, accuracy usually within 1-3% rel. err.
-
inline constexpr bool is_dirac() const noexcept¶
Returns true if the distribution is degenerate (a Dirac delta)
-
struct sample_ret_t¶
-
inline constexpr gaussian2d_t(vec2_t sigma = {1, 1}, dir2_t x = {1, 0}, vec2_t mu = {0, 0})¶