13 #include <unordered_map>
14 #include <unordered_set>
56 inline virtual unsigned size()
const override {
57 return static_cast<unsigned>(vertices_.size());
75 const Eigen::Matrix4d &transformation)
override;
77 bool relative =
true)
override;
79 const Eigen::Vector3d ¢er)
override;
81 const Eigen::Vector3d ¢er)
override;
91 return vertices_.size() > 0 &&
92 vertex_normals_.size() == vertices_.size();
97 return vertices_.size() > 0 &&
98 vertex_colors_.size() == vertices_.size();
103 for (
size_t i = 0; i < vertex_normals_.size(); i++) {
104 vertex_normals_[i].normalize();
105 if (std::isnan(vertex_normals_[i](0))) {
106 vertex_normals_[i] = Eigen::Vector3d(0.0, 0.0, 1.0);
116 ResizeAndPaintUniformColor(vertex_colors_, vertices_.size(),
color);
127 const char *
name =
"ecvMeshBase")
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
Hierarchical CLOUDVIEWER Object.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
std::function< void(GenericTriangle &)> genericTriangleAction
Generic function to apply to a triangle (used by foreach)
A generic triangle interface.
virtual Eigen::Vector3d GetCenter() const override
Returns the center of the geometry coordinates.
virtual void placeIteratorAtBeginning() override
Places the mesh iterator at the beginning.
virtual Eigen::Vector3d GetMinBound() const override
Returns min bounds for geometry coordinates.
ecvMeshBase & PaintUniformColor(const Eigen::Vector3d &color)
Assigns each vertex in the TriangleMesh the same color.
ecvMeshBase(const char *name="ecvMeshBase")
Default Constructor.
virtual bool IsEmpty() const override
virtual ecvMeshBase & Scale(const double s, const Eigen::Vector3d ¢er) override
Apply scaling to the geometry coordinates. Given a scaling factor , and center , a given point is tr...
ecvMeshBase(const std::vector< Eigen::Vector3d > &vertices, const char *name="ecvMeshBase")
virtual bool isSerializable() const override
Returns whether object is serializable of not.
virtual unsigned size() const override
Returns the number of triangles.
bool HasVertices() const
Returns True if the mesh contains vertices.
virtual ecvMeshBase & Rotate(const Eigen::Matrix3d &R, const Eigen::Vector3d ¢er) override
Apply rotation to the geometry coordinates and normals. Given a rotation matrix , and center ,...
bool HasVertexColors() const
Returns True if the mesh contains vertex colors.
virtual ecvMeshBase & Translate(const Eigen::Vector3d &translation, bool relative=true) override
Apply translation to the geometry coordinates.
std::tuple< std::shared_ptr< ccMesh >, std::vector< size_t > > ComputeConvexHull() const
Function that computes the convex hull of the triangle mesh using qhull.
virtual void getBoundingBox(CCVector3 &bbMin, CCVector3 &bbMax) override
Returns the mesh bounding-box.
virtual cloudViewer::GenericTriangle * _getNextTriangle() override
Returns the next triangle (relatively to the global iterator position)
bool HasVertexNormals() const
Returns True if the mesh contains vertex normals.
ecvMeshBase & NormalizeNormals()
Normalize vertex normals to length 1.
virtual CV_CLASS_ENUM getClassID() const override
Returns class ID.
virtual void forEach(genericTriangleAction action) override
Fast iteration mechanism.
ecvMeshBase operator+(const ecvMeshBase &mesh) const
virtual ccBBox getOwnBB(bool withGLFeatures=false) override
Returns the entity's own bounding-box.
virtual ecvMeshBase & Transform(const Eigen::Matrix4d &transformation) override
Apply transformation (4x4 matrix) to the geometry coordinates.
virtual Eigen::Vector3d GetMaxBound() const override
Returns max bounds for geometry coordinates.
virtual ecvOrientedBBox GetOrientedBoundingBox() const override
virtual ecvMeshBase & clear()
std::vector< Eigen::Vector3d > vertex_normals_
Vertex normals.
virtual ccBBox GetAxisAlignedBoundingBox() const override
Returns an axis-aligned bounding box of the geometry.
std::vector< Eigen::Vector3d > vertices_
Vertex coordinates.
std::vector< Eigen::Vector3d > vertex_colors_
RGB colors of vertices.
ecvMeshBase & operator+=(const ecvMeshBase &mesh)
Helper functions for the ml ops.
Generic file read and write utility for python interface.