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)
27 CVB_CALL_CAPI_CHECKED(CVC3DPointCloudGetPolygonTable(pointCloud_->Handle(), polygonTable_, numPolygons_));
28 components_ = pointCloud_->PointComponents<T>();
32 Mesh& operator=(
const Mesh&) =
delete;
45 auto pointCloud = Internal::DoResCallShareOut<SparsePointCloud>([&](
void*& handle)
47 return CVB_CALL_CAPI(CVC3DLoadFileTyped(fileName.c_str(),
static_cast<CExports::cvbval_t
>(PointTypeAsFlags()), handle));
49 return std::make_shared<Mesh<T>>(pointCloud, PrivateTag{});
66 auto pMesh = std::make_shared<Mesh<T>>(pointCloud, PrivateTag{});
91 auto ptr = IndexTablePtrAt(index);
93 std::generate_n(std::back_inserter(points), *ptr, [
this, ptr, i = 0]()
mutable
96 return components_.PointAt(*(ptr + i));
98 return { std::move(points) };
109 auto ptr = IndexTablePtrAt(index);
111 std::generate_n(std::back_inserter(indices), *ptr, [ptr, i = 0]()
mutable
126 return components_.NumPoints();
137 return components_.PointAt(index);
147 return pointCloud_->CalculateBoundingBox();
159 CVB_CALL_CAPI_CHECKED(CVC3DRasterMeshToDensePointCloud(pointCloud_->Handle(),
160 *
reinterpret_cast<const CExports::CVC3DMatrix*
>(&cameraRotation),
161 *
reinterpret_cast<CExports::CVC3DVector*
>(&cameraTranslation),
177 return Internal::DoResCallShareOut<DensePointCloud>([&](
void*& handle)
179 return CVB_CALL_CAPI(CVC3DCreateRasterMeshToDensePointCloud(pointCloud_->Handle(),
180 *
reinterpret_cast<const CExports::CVC3DMatrix*
>(&cameraRotation),
181 *
reinterpret_cast<CExports::CVC3DVector*
>(&cameraTranslation),
191 CExports::cvbuint32_t* IndexTablePtrAt(
std::size_t index)
const noexcept
193 auto ptr = polygonTable_;
195 ptr = IncrementTablePtr(ptr);
199 static CExports::cvbuint32_t* IncrementTablePtr(CExports::cvbuint32_t* ptr)
noexcept
201 return ptr + *ptr + 1;
207 SparseComponentsPointers3D<T> components_;
208 CExports::cvbuint32_t* polygonTable_ =
nullptr;
209 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:59
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:135
std::size_t NumPolygons() const noexcept
Get the number of polygons in this mesh.
Definition: mesh.hpp:78
Polygon3D< T > PolygonAt(std::size_t index) const
Gets polygons for this mesh.
Definition: mesh.hpp:89
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:175
static MeshPtr< T > FromFile(const String &fileName)
Loads a mesh from file.
Definition: mesh.hpp:42
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:157
static MeshPtr< T > FromPointCloud(const SparsePointCloudPtr &pointCloud)
Creates a mesh from a point cloud containing mesh information.
Definition: mesh.hpp:64
Cuboid CalculateBoundingBox() const
Calculates the minimum and maximum extent of the mesh.
Definition: mesh.hpp:145
std::vector< std::uint32_t > PolygonIndicesAt(std::size_t index) const
Gets point indices for a polygon.
Definition: mesh.hpp:107
std::size_t NumPoints() const noexcept
Get the number of points in the mesh.
Definition: mesh.hpp:124
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:767
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