Points: Add method PointKernel::moveGeometry

This allows to more efficiently transform a point cloud if only a translation but no rotation is needed
This commit is contained in:
wmayer
2025-05-05 16:18:07 +02:00
committed by Ladislav Michl
parent c6c356e389
commit b8384700da
2 changed files with 16 additions and 0 deletions

View File

@@ -99,6 +99,21 @@ void PointKernel::transformGeometry(const Base::Matrix4D& rclMat)
#endif
}
void PointKernel::moveGeometry(const Base::Vector3d& vec)
{
Base::Vector3f offset = Base::toVector<float>(vec);
std::vector<value_type>& kernel = getBasicPoints();
#ifdef _MSC_VER
Concurrency::parallel_for_each(kernel.begin(), kernel.end(), [offset](value_type& value) {
value += offset;
});
#else
QtConcurrent::blockingMap(kernel, [offset](value_type& value) {
value += offset;
});
#endif
}
Base::BoundBox3d PointKernel::getBoundBox() const
{
Base::BoundBox3d bnd;

View File

@@ -106,6 +106,7 @@ public:
double Accuracy,
uint16_t flags = 0) const override;
void transformGeometry(const Base::Matrix4D& rclMat) override;
void moveGeometry(const Base::Vector3d& vec);
Base::BoundBox3d getBoundBox() const override;
/** @name I/O */