43 #include <pcl/geometry/mesh_base.h>
59 template <
class MeshTraitsT>
68 using Ptr = shared_ptr<Self>;
142 add_triangle_[0] = idx_v_0;
143 add_triangle_[1] = idx_v_1;
144 add_triangle_[2] = idx_v_2;
146 return (this->
addFaceImplBase(add_triangle_, face_data, edge_data, half_edge_data));
170 if (vertices.size() != 4) {
215 if (idx_face_0.isValid()) {
216 return (std::make_pair(idx_face_0, idx_face_1));
218 if (idx_face_1.isValid()) {
220 idx_v_0, idx_v_1, idx_v_2, face_data);
221 return (std::make_pair(idx_face_1, idx_face_0));
228 idx_face_0 = this->
addFace(idx_v_1, idx_v_2, idx_v_3, face_data);
229 idx_face_1 = this->
addFace(idx_v_0, idx_v_1, idx_v_3, face_data);
231 if (idx_face_0.isValid()) {
232 return (std::make_pair(idx_face_0, idx_face_1));
234 if (idx_face_1.isValid()) {
236 idx_v_1, idx_v_2, idx_v_3, face_data);
237 return (std::make_pair(idx_face_1, idx_face_0));
240 if (!IsManifold::value) {
246 idx_v_0, idx_v_1, inner_he_atp_[0], is_new_atp_[0],
IsManifold()) ||
248 idx_v_1, idx_v_2, inner_he_atp_[1], is_new_atp_[1],
IsManifold()) ||
250 idx_v_2, idx_v_3, inner_he_atp_[2], is_new_atp_[2],
IsManifold()) ||
252 idx_v_3, idx_v_0, inner_he_atp_[3], is_new_atp_[3],
IsManifold())) {
257 if (!is_new_atp_[0] && is_new_atp_[1] && !is_new_atp_[2] && is_new_atp_[3]) {
258 return (this->connectTrianglePair(inner_he_atp_[0],
268 if (is_new_atp_[0] && !is_new_atp_[1] && is_new_atp_[2] && !is_new_atp_[3]) {
269 return (this->connectTrianglePair(inner_he_atp_[1],
285 MeshBase<TriangleMesh<MeshTraitsT>, MeshTraitsT, pcl::geometry::TriangleMeshTag>;
289 addFaceImpl(const VertexIndices& vertices,
290 const FaceData& face_data,
291 const EdgeData& edge_data,
292 const HalfEdgeData& half_edge_data)
294 if (vertices.size() == 3)
295 return (this->
addFaceImplBase(vertices, face_data, edge_data, half_edge_data));
358 inner_he_abc.reserve(3);
359 inner_he_abc.push_back(idx_he_ab);
360 inner_he_abc.push_back(idx_he_bc);
361 inner_he_abc.push_back(idx_he_ca);
364 inner_he_acd.reserve(3);
365 inner_he_acd.push_back(idx_he_ac);
366 inner_he_acd.push_back(idx_he_cd);
367 inner_he_acd.push_back(idx_he_da);
372 return (std::make_pair(idx_f_abc, idx_f_acd));
386 std::vector<bool> is_new_atp_;
Base class for the half-edge mesh.
void setOutgoingHalfEdgeIndex(const VertexIndex &idx_vertex, const HalfEdgeIndex &idx_outgoing_half_edge)
Set the outgoing half-edge index to a given vertex.
HalfEdgeIndex getNextHalfEdgeIndex(const HalfEdgeIndex &idx_half_edge) const
Get the next half-edge index to a given half-edge.
std::integral_constant< bool, !std::is_same< VertexData, pcl::geometry::NoData >::value > HasVertexData
pcl::geometry::IncomingHalfEdgeAroundVertexCirculator< const Self > IncomingHalfEdgeAroundVertexCirculator
pcl::geometry::OuterHalfEdgeAroundFaceCirculator< const Self > OuterHalfEdgeAroundFaceCirculator
HalfEdgeIndex getOppositeHalfEdgeIndex(const HalfEdgeIndex &idx_half_edge) const
Get the opposite half-edge index to a given half-edge.
std::vector< EdgeIndex > EdgeIndices
FaceIndex connectFace(const HalfEdgeIndices &inner_he, const FaceData &face_data)
Add a face to the mesh and connect it to the half-edges.
bool checkTopology1(const VertexIndex &idx_v_a, const VertexIndex &idx_v_b, HalfEdgeIndex &idx_he_ab, std::vector< bool >::reference is_new_ab, std::true_type) const
Check if the edge between the two vertices can be added.
pcl::geometry::FaceIndex FaceIndex
typename MeshTraitsT::EdgeData EdgeData
std::vector< FaceIndex > FaceIndices
typename MeshTraitsT::HalfEdgeData HalfEdgeData
pcl::PointCloud< VertexData > VertexDataCloud
HalfEdgeIndex getPrevHalfEdgeIndex(const HalfEdgeIndex &idx_half_edge) const
Get the previous half-edge index to a given half-edge.
pcl::geometry::FaceAroundFaceCirculator< const Self > FaceAroundFaceCirculator
FaceIndex addFaceImplBase(const VertexIndices &vertices, const FaceData &face_data, const EdgeData &edge_data, const HalfEdgeData &half_edge_data)
General implementation of addFace.
typename MeshTraitsT::VertexData VertexData
pcl::geometry::FaceAroundVertexCirculator< const Self > FaceAroundVertexCirculator
std::vector< HalfEdgeIndex > HalfEdgeIndices
std::integral_constant< bool, !std::is_same< EdgeData, pcl::geometry::NoData >::value > HasEdgeData
std::integral_constant< bool, !std::is_same< FaceData, pcl::geometry::NoData >::value > HasFaceData
pcl::PointCloud< FaceData > FaceDataCloud
pcl::geometry::VertexIndex VertexIndex
FaceIndex addFace(const VertexIndices &vertices, const FaceData &face_data=FaceData(), const EdgeData &edge_data=EdgeData(), const HalfEdgeData &half_edge_data=HalfEdgeData())
Add a face to the mesh.
void connectPrevNext(const HalfEdgeIndex &idx_he_ab, const HalfEdgeIndex &idx_he_bc)
Connect the next and prev indices of the two half-edges with each other.
pcl::geometry::VertexAroundFaceCirculator< const Self > VertexAroundFaceCirculator
typename MeshTraitsT::IsManifold IsManifold
pcl::PointCloud< HalfEdgeData > HalfEdgeDataCloud
typename MeshTraitsT::FaceData FaceData
pcl::geometry::InnerHalfEdgeAroundFaceCirculator< const Self > InnerHalfEdgeAroundFaceCirculator
std::vector< VertexIndex > VertexIndices
pcl::geometry::VertexAroundVertexCirculator< const Self > VertexAroundVertexCirculator
pcl::geometry::EdgeIndex EdgeIndex
HalfEdgeIndex addEdge(const VertexIndex &idx_v_a, const VertexIndex &idx_v_b, const HalfEdgeData &he_data, const EdgeData &edge_data)
Add an edge between the two given vertices and connect them with the vertices.
std::integral_constant< bool, !std::is_same< HalfEdgeData, pcl::geometry::NoData >::value > HasHalfEdgeData
pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator< const Self > OutgoingHalfEdgeAroundVertexCirculator
pcl::geometry::HalfEdgeIndex HalfEdgeIndex
pcl::PointCloud< EdgeData > EdgeDataCloud
Half-edge mesh that can only store triangles.
typename Base::EdgeData EdgeData
typename Base::InnerHalfEdgeAroundFaceCirculator InnerHalfEdgeAroundFaceCirculator
typename Base::HalfEdgeDataCloud HalfEdgeDataCloud
shared_ptr< const Self > ConstPtr
typename Base::VertexDataCloud VertexDataCloud
FaceIndex addFace(const VertexIndex &idx_v_0, const VertexIndex &idx_v_1, const VertexIndex &idx_v_2, const FaceData &face_data=FaceData(), const EdgeData &edge_data=EdgeData(), const HalfEdgeData &half_edge_data=HalfEdgeData())
Add a triangle to the mesh.
typename Base::HasFaceData HasFaceData
FaceIndexPair addTrianglePair(const VertexIndices &vertices, const FaceData &face_data=FaceData(), const EdgeData &edge_data=EdgeData(), const HalfEdgeData &half_edge_data=HalfEdgeData())
Add two triangles for the four given input vertices.
typename Base::MeshTag MeshTag
typename Base::VertexData VertexData
typename Base::VertexAroundVertexCirculator VertexAroundVertexCirculator
typename Base::VertexAroundFaceCirculator VertexAroundFaceCirculator
typename Base::EdgeIndex EdgeIndex
typename Base::HalfEdgeData HalfEdgeData
typename Base::IsManifold IsManifold
typename Base::HasVertexData HasVertexData
typename Base::OuterHalfEdgeAroundFaceCirculator OuterHalfEdgeAroundFaceCirculator
typename Base::IncomingHalfEdgeAroundVertexCirculator IncomingHalfEdgeAroundVertexCirculator
FaceIndexPair addTrianglePair(const VertexIndex &idx_v_0, const VertexIndex &idx_v_1, const VertexIndex &idx_v_2, const VertexIndex &idx_v_3, const FaceData &face_data=FaceData(), const EdgeData &edge_data=EdgeData(), const HalfEdgeData &half_edge_data=HalfEdgeData())
Add two triangles for the four given input vertices.
typename Base::FaceAroundVertexCirculator FaceAroundVertexCirculator
typename Base::EdgeDataCloud EdgeDataCloud
typename Base::FaceIndices FaceIndices
typename Base::HalfEdgeIndices HalfEdgeIndices
std::pair< FaceIndex, FaceIndex > FaceIndexPair
typename Base::EdgeIndices EdgeIndices
typename Base::HalfEdgeIndex HalfEdgeIndex
typename Base::FaceDataCloud FaceDataCloud
typename Base::FaceAroundFaceCirculator FaceAroundFaceCirculator
typename Base::HasHalfEdgeData HasHalfEdgeData
typename Base::VertexIndex VertexIndex
typename Base::HasEdgeData HasEdgeData
typename Base::FaceIndex FaceIndex
typename Base::OutgoingHalfEdgeAroundVertexCirculator OutgoingHalfEdgeAroundVertexCirculator
TriangleMesh()
Constructor.
typename Base::VertexIndices VertexIndices
typename Base::FaceData FaceData
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Defines functions, macros and traits for allocating and using memory.
Defines all the PCL and non-PCL macros used.
Tag describing the type of the mesh.