3#include "sparse_point_cloud.hpp"
4#include "dense_point_cloud.hpp"
5#include "sparse_components_pointers_3d.hpp"
6#include "polygon_3d.hpp"
27 : pointCloud_(pointCloud)
28 , components_(pointCloud->PointComponents<T>())
30 CVB_CALL_CAPI_CHECKED(CVC3DPointCloudGetPolygonTable(pointCloud_->Handle(), polygonTable_, numPolygons_));
33 Mesh(
const Mesh &) =
delete;
34 Mesh &operator=(
const Mesh &)
noexcept =
delete;
35 Mesh(Mesh &&)
noexcept =
default;
36 Mesh &operator=(Mesh &&) =
default;
50 auto pointCloud = Internal::DoResCallShareOut<SparsePointCloud>([&](
void *&handle) {
52 CVC3DLoadFileTyped(fileName.c_str(),
static_cast<CExports::cvbval_t
>(PointTypeAsFlags()), handle));
96 auto ptr = IndexTablePtrAt(index);
100 return components_.PointAt(*(ptr + i));
113 auto ptr = IndexTablePtrAt(index);
129 return components_.NumPoints();
140 return components_.PointAt(index);
150 return pointCloud_->CalculateBoundingBox();
163 CVB_CALL_CAPI_CHECKED(CVC3DRasterMeshToDensePointCloud(
164 pointCloud_->Handle(), *
reinterpret_cast<const CExports::CVC3DMatrix *
>(&cameraRotation),
165 *
reinterpret_cast<CExports::CVC3DVector *
>(&cameraTranslation),
nullptr, denseCloud.
Handle()));
178 double xResIncrement,
double yResIncrement)
180 return Internal::DoResCallShareOut<DensePointCloud>([&](
void *&handle) {
181 return CVB_CALL_CAPI(CVC3DCreateRasterMeshToDensePointCloud(
182 pointCloud_->Handle(), *
reinterpret_cast<const CExports::CVC3DMatrix *
>(&cameraRotation),
183 *
reinterpret_cast<CExports::CVC3DVector *
>(&cameraTranslation), xResIncrement, yResIncrement,
nullptr,
189 CExports::cvbuint32_t *IndexTablePtrAt(
std::size_t index)
const noexcept
191 auto ptr = polygonTable_;
193 ptr = IncrementTablePtr(ptr);
197 static CExports::cvbuint32_t *IncrementTablePtr(CExports::cvbuint32_t *ptr)
noexcept
199 return ptr + *ptr + 1;
205 SparseComponentsPointers3D<T> components_;
206 CExports::cvbuint32_t *polygonTable_ =
nullptr;
207 CExports::cvbint64_t numPolygons_ = 0;
211 inline Cvb::
PointCloudFlags Mesh<Cvb::Point3D<
float>>::PointTypeAsFlags() noexcept
T back_inserter(T... args)
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:30
Double precision 3x3 matrix class.
Definition matrix_3d.hpp:54
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:83
Polygon3D< T > PolygonAt(std::size_t index) const
Gets polygons for this mesh.
Definition mesh.hpp:94
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:177
static MeshPtr< T > FromFile(const String &fileName)
Loads a mesh from file.
Definition mesh.hpp:47
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:69
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:111
std::size_t NumPoints() const noexcept
Get the number of points in the mesh.
Definition mesh.hpp:127
void * Handle() const noexcept
Returns C-API style handle to Node Object.
Definition decl_point_cloud.hpp:773
A polygon in 3D space.
Definition polygon_3d.hpp:28
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
PointCloudFlags
Flags for creating point clouds.
Definition core_3d.hpp:90
@ Float
Definition core_3d.hpp:94
@ XYZW
Definition core_3d.hpp:109
@ Double
Definition core_3d.hpp:99
@ XYZ
Definition core_3d.hpp:104
Point3D< T > Vector3D
Alias for Point3D.
Definition point_3d.hpp:363
std::string String
String for wide characters or unicode characters.
Definition string.hpp:49
std::shared_ptr< SparsePointCloud > SparsePointCloudPtr
Convenience shared pointer for SparsePointCloud.
Definition core_3d.hpp:48
std::shared_ptr< Mesh< T > > MeshPtr
Convenience shared pointer for Mesh.
Definition core_3d.hpp:86
std::shared_ptr< DensePointCloud > DensePointCloudPtr
Convenience shared pointer for DensePointCloud.
Definition core_3d.hpp:44