57 pointCloud.
features = Matrix::Ones(4, numberOfPoints);
66 pointCloud.
addDescriptor(
"normals", Matrix::Constant(3, numberOfPoints, 0));
80 transformator->inPlaceCompute(
transformation.matrix(), pointCloud);
88 for (
Index i{ 0 }; i < 3; ++i)
90 if (axisAlignedPlaneDimensions(i) == 0)
102 const Index numberOfPoints,
108 addEmpty3dPointFields(numberOfPoints, pointCloud);
111 std::random_device randomDevice;
112 std::mt19937 randomNumberGenerator(randomDevice());
113 std::uniform_real_distribution<ScalarType> uniformDistribution(0.0f, 1.0f);
117 for (
Index i{ 0 }; i < numberOfPoints; ++i)
120 const ScalarType theta{ 2.0f * pi * uniformDistribution(randomNumberGenerator) };
121 const ScalarType phi{ std::acos(1.0f - 2.0f * uniformDistribution(randomNumberGenerator)) };
130 pointCloud.
features(0, i) = sinPhi * cosTheta * radius;
131 pointCloud.
features(1, i) = sinPhi * sinTheta * radius;
132 pointCloud.
features(2, i) = cosPhi * radius;
139 normalsView(0, i) = normalVector(0);
140 normalsView(1, i) = normalVector(1);
141 normalsView(2, i) = normalVector(2);
154 const Index numberOfPoints,
160 addEmpty3dPointFields(numberOfPoints, pointCloud);
163 std::random_device randomDevice;
164 std::mt19937 randomNumberGenerator(randomDevice());
165 std::uniform_real_distribution<ScalarType> uniformDistribution(0.0f, 1.0f);
169 for (
Index i{ 0 }; i < numberOfPoints; ++i)
172 const ScalarType phi{ 2.0f * pi * uniformDistribution(randomNumberGenerator) };
173 const ScalarType radiusSample{ radius * sqrt(uniformDistribution(randomNumberGenerator)) };
180 pointCloud.
features(0, i) = cosPhi * radiusSample;
181 pointCloud.
features(1, i) = sinPhi * radiusSample;
185 normalsView(0, i) = 0;
186 normalsView(1, i) = 0;
187 normalsView(2, i) = 1;
211 const ScalarType ratioCaps{ radius / (height + radius) };
213 const Index numberOfPointsBothCaps{
static_cast<Index>(std::round(
static_cast<ScalarType>(numberOfPoints) * ratioCaps * 0.5f)) * 2u };
215 const Index numberOfPointsCap{ numberOfPointsBothCaps / 2u };
217 const Index numberOfPointsBody{ numberOfPoints - numberOfPointsBothCaps };
220 std::random_device randomDevice;
221 std::mt19937 randomNumberGenerator(randomDevice());
222 std::uniform_real_distribution<ScalarType> uniformDistribution(-1.0f, 1.0f);
224 addEmpty3dPointFields(numberOfPointsBody, pointCloud);
229 for (
Index i{ 0 }; i < numberOfPointsBody; ++i)
232 const ScalarType phi{ 2.0f * pi * uniformDistribution(randomNumberGenerator) };
233 const ScalarType z{ height * 0.5f * uniformDistribution(randomNumberGenerator) };
240 pointCloud.
features(0, i) = cosPhi * radius;
241 pointCloud.
features(1, i) = sinPhi * radius;
250 normalsView(0, i) = normalVector(0);
251 normalsView(1, i) = normalVector(1);
252 normalsView(2, i) = normalVector(2);
256 const Quaternion topCapOrientation{ Quaternion::Identity() };
257 const Quaternion bottomCapOrientation{ 0, 1, 0, 0 };
273 const Index numberOfPoints,
279 addEmpty3dPointFields(numberOfPoints, pointCloud);
282 std::random_device randomDevice;
283 std::mt19937 randomNumberGenerator(randomDevice());
284 std::uniform_real_distribution<ScalarType> lengthUniformDistribution(-dimensions(0), dimensions(0));
285 std::uniform_real_distribution<ScalarType> widthUniformDistribution(-dimensions(1), dimensions(1));
286 std::uniform_real_distribution<ScalarType> heightUniformDistribution(-dimensions(2), dimensions(2));
288 const StaticCoordVector normalVector{ computeNormalOfAxisAlignedPlane(dimensions) };
292 for (
Index i{ 0 }; i < numberOfPoints; ++i)
295 pointCloud.
features(0, i) = lengthUniformDistribution(randomNumberGenerator);
296 pointCloud.
features(1, i) = widthUniformDistribution(randomNumberGenerator);
297 pointCloud.
features(2, i) = heightUniformDistribution(randomNumberGenerator);
300 normalsView(0, i) = normalVector(0);
301 normalsView(1, i) = normalVector(1);
302 normalsView(2, i) = normalVector(2);
316 const Index numberOfFaces{ 6 };
317 const Index numberOfPointsPerFace{ numberOfPoints / numberOfFaces };
321 addEmpty3dPointFields(0, pointCloud);
333 const Quaternion faceOrientation{ Quaternion::Identity() };
349 const Index missingPointsLastFace{ numberOfPoints - pointCloud.
getNbPoints() - numberOfPointsPerFace };
351 xyFaceDimensions, numberOfPointsPerFace + missingPointsLastFace, negativeZaxisFaceCenter, faceOrientation));