21 #include <Eigen/Dense>
27 #include <unordered_map>
88 const Eigen::Vector3d ¢er) {
95 if (mesh.
IsEmpty())
return (*
this);
97 size_t add_vert_num = mesh.
vertices_.size();
98 size_t new_vert_num = old_vert_num + add_vert_num;
101 for (
size_t i = 0; i < add_vert_num; i++)
108 for (
size_t i = 0; i < add_vert_num; i++)
114 for (
size_t i = 0; i < add_vert_num; i++)
123 std::tuple<std::shared_ptr<ccMesh>, std::vector<size_t>>
static ccBBox CreateFromPoints(const std::vector< CCVector3 > &points)
static Eigen::Vector3d ComputeMinBound(const std::vector< Eigen::Vector3d > &points)
Compute min bound of a list points.
static Eigen::Vector3d ComputeCenter(const std::vector< Eigen::Vector3d > &points)
Computer center of a list of points.
static void RotateNormals(const Eigen::Matrix3d &R, std::vector< Eigen::Vector3d > &normals)
Rotate all normals with the rotation matrix R.
static void TransformNormals(const Eigen::Matrix4d &transformation, std::vector< Eigen::Vector3d > &normals)
Transforms the normals with the transformation matrix.
static void TranslatePoints(const Eigen::Vector3d &translation, std::vector< Eigen::Vector3d > &points, bool relative)
Apply translation to the geometry coordinates.
static void RotatePoints(const Eigen::Matrix3d &R, std::vector< Eigen::Vector3d > &points, const Eigen::Vector3d ¢er)
Rotate all points with the rotation matrix R.
static void TransformPoints(const Eigen::Matrix4d &transformation, std::vector< Eigen::Vector3d > &points)
Transforms all points with the transformation matrix.
static void ScalePoints(const double scale, std::vector< Eigen::Vector3d > &points, const Eigen::Vector3d ¢er)
Scale the coordinates of all points by the scaling factor scale.
static Eigen::Vector3d ComputeMaxBound(const std::vector< Eigen::Vector3d > &points)
Compute max bound of a list points.
static std::tuple< std::shared_ptr< ccMesh >, std::vector< size_t > > ComputeConvexHull(const std::vector< Eigen::Vector3d > &points)
virtual ecvMeshBase & clear()
virtual Eigen::Vector3d GetMaxBound() const override
Returns max bounds for geometry coordinates.
virtual ecvMeshBase & Transform(const Eigen::Matrix4d &transformation) override
Apply transformation (4x4 matrix) to the geometry coordinates.
ecvMeshBase(const char *name="ecvMeshBase")
Default Constructor.
virtual Eigen::Vector3d GetCenter() const override
Returns the center of the geometry coordinates.
virtual ccBBox getOwnBB(bool withGLFeatures=false) override
Returns the entity's own bounding-box.
virtual void getBoundingBox(CCVector3 &bbMin, CCVector3 &bbMax) override
Returns the mesh bounding-box.
bool HasVertices() const
Returns True if the mesh contains vertices.
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.
ecvMeshBase & operator+=(const ecvMeshBase &mesh)
bool HasVertexNormals() const
Returns True if the mesh contains vertex normals.
ecvMeshBase operator+(const ecvMeshBase &mesh) const
virtual bool IsEmpty() const override
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 ecvOrientedBBox GetOrientedBoundingBox() 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...
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 ,...
std::vector< Eigen::Vector3d > vertex_normals_
Vertex normals.
std::vector< Eigen::Vector3d > vertices_
Vertex coordinates.
std::vector< Eigen::Vector3d > vertex_colors_
RGB colors of vertices.
virtual Eigen::Vector3d GetMinBound() const override
Returns min bounds for geometry coordinates.
virtual ccBBox GetAxisAlignedBoundingBox() const override
Returns an axis-aligned bounding box of the geometry.
static ecvOrientedBBox CreateFromPoints(const std::vector< Eigen::Vector3d > &points)
Generic file read and write utility for python interface.