3#include "sparse_point_cloud.hpp"
4#include "dense_point_cloud.hpp"
5#include "sparse_components_pointers_3d.hpp"
6#include "polygon_3d.hpp"
25 : pointCloud_(pointCloud)
26 , components_(pointCloud->PointComponents<T>())
28 CVB_CALL_CAPI_CHECKED(CVC3DPointCloudGetPolygonTable(pointCloud_->Handle(), polygonTable_, numPolygons_));
32 Mesh& operator=(
const Mesh&)
noexcept =
delete;
48 auto pointCloud = Internal::DoResCallShareOut<SparsePointCloud>([&](
void*& handle)
50 return CVB_CALL_CAPI(CVC3DLoadFileTyped(fileName.c_str(),
static_cast<CExports::cvbval_t
>(PointTypeAsFlags()), handle));
52 return std::make_shared<Mesh<T>>(pointCloud, PrivateTag{});
69 auto pMesh = std::make_shared<Mesh<T>>(pointCloud, PrivateTag{});
94 auto ptr = IndexTablePtrAt(index);
96 std::generate_n(std::back_inserter(points), *ptr, [
this, ptr, i = 0]()
mutable
99 return components_.PointAt(*(ptr + i));
112 auto ptr = IndexTablePtrAt(index);
114 std::generate_n(std::back_inserter(indices), *ptr, [ptr, i = 0]()
mutable
129 return components_.NumPoints();
140 return components_.PointAt(index);
150 return pointCloud_->CalculateBoundingBox();
162 CVB_CALL_CAPI_CHECKED(CVC3DRasterMeshToDensePointCloud(pointCloud_->Handle(),
163 *
reinterpret_cast<const CExports::CVC3DMatrix*
>(&cameraRotation),
164 *
reinterpret_cast<CExports::CVC3DVector*
>(&cameraTranslation),
180 return Internal::DoResCallShareOut<DensePointCloud>([&](
void*& handle)
182 return CVB_CALL_CAPI(CVC3DCreateRasterMeshToDensePointCloud(pointCloud_->Handle(),
183 *
reinterpret_cast<const CExports::CVC3DMatrix*
>(&cameraRotation),
184 *
reinterpret_cast<CExports::CVC3DVector*
>(&cameraTranslation),
194 CExports::cvbuint32_t* IndexTablePtrAt(
std::size_t index)
const noexcept
196 auto ptr = polygonTable_;
198 ptr = IncrementTablePtr(ptr);
202 static CExports::cvbuint32_t* IncrementTablePtr(CExports::cvbuint32_t* ptr)
noexcept
204 return ptr + *ptr + 1;
210 SparseComponentsPointers3D<T> components_;
211 CExports::cvbuint32_t* polygonTable_ =
nullptr;
212 CExports::cvbint64_t numPolygons_ = 0;
3D rectangle in the X, Y and Z domain.
Definition: cuboid.hpp:19
A dense Cartesian 3D point cloud object.
Definition: decl_dense_point_cloud.hpp:31
Double precision 3x3 matrix class.
Definition: matrix_3d.hpp:60
3D mesh object consisting of polygons.
Definition: mesh.hpp:20
T PointAt(std::size_t index) const noexcept
Gets the point at the specified index.
Definition: mesh.hpp:138
std::size_t NumPolygons() const noexcept
Get the number of polygons in this mesh.
Definition: mesh.hpp:81
Polygon3D< T > PolygonAt(std::size_t index) const
Gets polygons for this mesh.
Definition: mesh.hpp:92
DensePointCloudPtr RasterDensePointCloud(const Matrix3D &cameraRotation, Vector3D< double > cameraTranslation, double xResIncrement, double yResIncrement)
Rasters this mesh into a dense point cloud and stores the result.
Definition: mesh.hpp:178
static MeshPtr< T > FromFile(const String &fileName)
Loads a mesh from file.
Definition: mesh.hpp:45
void RasterDensePointCloudToDst(const Matrix3D &cameraRotation, Vector3D< double > cameraTranslation, DensePointCloud &denseCloud)
Rasters this mesh into a dense point cloud and stores the result.
Definition: mesh.hpp:160
static MeshPtr< T > FromPointCloud(const SparsePointCloudPtr &pointCloud)
Creates a mesh from a point cloud containing mesh information.
Definition: mesh.hpp:67
Cuboid CalculateBoundingBox() const
Calculates the minimum and maximum extent of the mesh.
Definition: mesh.hpp:148
std::vector< std::uint32_t > PolygonIndicesAt(std::size_t index) const
Gets point indices for a polygon.
Definition: mesh.hpp:110
std::size_t NumPoints() const noexcept
Get the number of points in the mesh.
Definition: mesh.hpp:127
Multi-purpose 3D vector class.
Definition: point_3d.hpp:22
void * Handle() const noexcept
Returns C-API style handle to Node Object.
Definition: decl_point_cloud.hpp:768
A polygon in 3D space.
Definition: polygon_3d.hpp:29
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24
PointCloudFlags
Flags for creating point clouds.
Definition: core_3d.hpp:90
std::shared_ptr< SparsePointCloud > SparsePointCloudPtr
Convenience shared pointer for SparsePointCloud.
Definition: core_3d.hpp:48