15#include "./concepts.h"
24 template <
typename DataPo
int>
26 const typename DataPoint::VectorType
_vCenter,
30 using Scalar =
typename DataPoint::Scalar;
31 using VectorType =
typename DataPoint::VectorType;
33 VectorType
vNormal = VectorType::Random().normalized();
39 Eigen::internal::random<Scalar>(Scalar(0.), Scalar(1. - MIN_NOISE));
46 Eigen::internal::random<Scalar>(Scalar(0.), Scalar(1. - MIN_NOISE));
51 const float reverse = Eigen::internal::random<float>(0.f, 1.f);
60 template <
typename VectorType>
63 using Scalar =
typename VectorType::Scalar;
65 const Scalar
theta = Eigen::internal::random<Scalar>(0, Scalar(2. *
EIGEN_PI));
68 const Scalar
r =
_radius * std::sqrt(Eigen::internal::random<Scalar>(0, 1));
79 template <
typename DataPo
int>
81 const typename DataPoint::VectorType& ,
82 const typename DataPoint::Scalar&
_width,
83 const typename DataPoint::Scalar&
_height,
88 using Scalar =
typename DataPoint::Scalar;
89 using VectorType =
typename DataPoint::VectorType;
91 const Scalar
u = Eigen::internal::random<Scalar>(-
_width / Scalar(2),
_width / Scalar(2));
92 const Scalar
v = Eigen::internal::random<Scalar>(-
_height / Scalar(2),
_height / Scalar(2));
99 VectorType::Random().normalized() * Eigen::internal::random<Scalar>(0., 1. - MIN_NOISE);
106 template <
typename DataPo
int>
108 const typename DataPoint::VectorType
_vNormal,
109 const typename DataPoint::Scalar
_radius,
113 using Scalar =
typename DataPoint::Scalar;
114 using VectorType =
typename DataPoint::VectorType;
124 vRandom = VectorType::Random().normalized();
135 Eigen::internal::random<Scalar>(Scalar(0), Scalar(1. - MIN_NOISE));
143 Scalar
rotationAngle = Eigen::internal::random<Scalar>(Scalar(-M_PI / 16.), Scalar(M_PI / 16.));
149 rotationAngle = Eigen::internal::random<Scalar>(Scalar(-M_PI / 16.), Scalar(M_PI / 16.));
158 const float reverse = Eigen::internal::random<float>(0.f, 1.f);
169 template <
typename Scalar>
176 template <
typename Scalar>
178 Scalar
_e, Scalar
_f)
184 template <
typename VectorType>
186 const typename VectorType::Scalar
_b)
188 return VectorType((
_a *
in.x()), (
_b *
in.y()), -1.).normalized();
191 template <IsPo
intNormal DataPo
int>
193 typename DataPoint::Scalar
_c,
typename DataPoint::Scalar
_d,
194 typename DataPoint::Scalar
_e,
typename DataPoint::Scalar
_f)
196 static constexpr typename DataPoint::Scalar
two{2};
197 auto& pos = in.pos();
198 in.normal() =
typename DataPoint::VectorType(two * _a * pos.x() + _c * pos.y() + _d,
199 two * _b * pos.y() + _c * pos.x() + _d, -1.)
208 template <
typename DataPo
int>
210 const typename DataPoint::Scalar
_b,
211 const typename DataPoint::Scalar
_s,
const bool _bAddNoise =
true)
213 using Scalar =
typename DataPoint::Scalar;
214 using VectorType =
typename DataPoint::VectorType;
219 const Scalar x = Eigen::internal::random<Scalar>(-
_s,
_s),
y = Eigen::internal::random<Scalar>(-
_s,
_s);
226 VectorType::Random().normalized() * Eigen::internal::random<Scalar>(Scalar(0), Scalar(1. - MIN_NOISE));
234 template <
typename DataPo
int>
236 typename DataPoint::Scalar
_c,
typename DataPoint::Scalar
_d,
237 typename DataPoint::Scalar
_e,
typename DataPoint::Scalar
_f,
240 using Scalar =
typename DataPoint::Scalar;
241 using VectorType =
typename DataPoint::VectorType;
255 VectorType::Random().normalized() * Eigen::internal::random<Scalar>(Scalar(0), Scalar(1. - MIN_NOISE));
261 template <
typename DataPo
int,
typename Params>
262 [[nodiscard]] DataPoint
getPointOnParaboloid(
const Params& _params,
typename DataPoint::Scalar _s,
263 bool _bAddNoise =
true)
265 return getPointOnParaboloid<DataPoint>(_params(0), _params(1), _params(2), _params(3), _params(4), _params(5),
270 template <
typename DataPo
int>
273 using Scalar =
typename DataPoint::Scalar;
274 using VectorType =
typename DataPoint::VectorType;
275 const VectorType n = VectorType::Random().normalized();
276 const VectorType
p = n * Eigen::internal::random<Scalar>(MIN_NOISE, MAX_NOISE);
277 return {
p, (n + VectorType::Random() * Scalar(0.1)).
normalized()};
Aggregator class used to declare specialized structures using CRTP.
VectorType getParaboloidNormal(const VectorType &in, const typename VectorType::Scalar _a, const typename VectorType::Scalar _b)
Generate z value using the equation z = ax^2 + by^2.
Scalar getParaboloidZ(const Scalar _x, const Scalar _y, const Scalar _a, const Scalar _b)
Generate z value using the equation z = ax^2 + by^2.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
DataPoint getPointOnPlane(const typename DataPoint::VectorType _vPosition, const typename DataPoint::VectorType _vNormal, const typename DataPoint::Scalar _radius, const bool _bAddPositionNoise=true, const bool _bAddNormalNoise=true, const bool _bReverseNormals=false)
Generate points on a plane.
DataPoint getPointOnParaboloid(const typename DataPoint::Scalar _a, const typename DataPoint::Scalar _b, const typename DataPoint::Scalar _s, const bool _bAddNoise=true)
Generate point samples on the primitive z = ax^2 + by^2.
DataPoint getRandomPoint()
Generate a random points.
DataPoint getPointOnSphere(const typename DataPoint::Scalar _radius, const typename DataPoint::VectorType _vCenter, const bool _bAddPositionNoise=true, const bool _bAddNormalNoise=true, const bool _bReverseNormals=false)
Generate points on a sphere.
DataPoint getPointOnRectangularPlane(const typename DataPoint::VectorType &_vPosition, const typename DataPoint::VectorType &, const typename DataPoint::Scalar &_width, const typename DataPoint::Scalar &_height, const typename DataPoint::VectorType &_localxAxis, const typename DataPoint::VectorType &_localyAxis, const bool _bAddPositionNoise=true)
Generate points on a plane without normals.
VectorType getPointOnCircle(typename VectorType::Scalar _radius, VectorType _vCenter)
Sample points on a circle in the xy plane.