quad_mesh.h
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2009-2012, Willow Garage, Inc.
* Copyright (c) 2012-, Open Perception, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the copyright holder(s) nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*
*/
#pragma once
#include <pcl/geometry/mesh_base.h>
#include <pcl/memory.h>
#include <pcl/pcl_macros.h>
namespace pcl {
namespace geometry {
/** \brief Tag describing the type of the mesh. */
struct QuadMeshTag {};
/** \brief Half-edge mesh that can only store quads.
* \tparam MeshTraitsT Please have a look at pcl::geometry::DefaultMeshTraits.
* \author Martin Saelzle
* \ingroup geometry
*/
template <class MeshTraitsT>
class QuadMesh
: public pcl::geometry::MeshBase<QuadMesh<MeshTraitsT>, MeshTraitsT, QuadMeshTag> {
public:
using Base = pcl::geometry::MeshBase<QuadMesh<MeshTraitsT>, MeshTraitsT, QuadMeshTag>;
using Self = QuadMesh<MeshTraitsT>;
using Ptr = shared_ptr<Self>;
using ConstPtr = shared_ptr<const Self>;
using VertexData = typename Base::VertexData;
using HalfEdgeData = typename Base::HalfEdgeData;
using EdgeData = typename Base::EdgeData;
using FaceData = typename Base::FaceData;
using IsManifold = typename Base::IsManifold;
using MeshTag = typename Base::MeshTag;
using HasVertexData = typename Base::HasVertexData;
using HasHalfEdgeData = typename Base::HasHalfEdgeData;
using HasEdgeData = typename Base::HasEdgeData;
using HasFaceData = typename Base::HasFaceData;
using VertexDataCloud = typename Base::VertexDataCloud;
using HalfEdgeDataCloud = typename Base::HalfEdgeDataCloud;
using EdgeDataCloud = typename Base::EdgeDataCloud;
using FaceDataCloud = typename Base::FaceDataCloud;
// Indices
using VertexIndex = typename Base::VertexIndex;
using HalfEdgeIndex = typename Base::HalfEdgeIndex;
using EdgeIndex = typename Base::EdgeIndex;
using FaceIndex = typename Base::FaceIndex;
using VertexIndices = typename Base::VertexIndices;
using HalfEdgeIndices = typename Base::HalfEdgeIndices;
using EdgeIndices = typename Base::EdgeIndices;
using FaceIndices = typename Base::FaceIndices;
// Circulators
using VertexAroundVertexCirculator = typename Base::VertexAroundVertexCirculator;
using OutgoingHalfEdgeAroundVertexCirculator =
typename Base::OutgoingHalfEdgeAroundVertexCirculator;
using IncomingHalfEdgeAroundVertexCirculator =
typename Base::IncomingHalfEdgeAroundVertexCirculator;
using FaceAroundVertexCirculator = typename Base::FaceAroundVertexCirculator;
using VertexAroundFaceCirculator = typename Base::VertexAroundFaceCirculator;
using InnerHalfEdgeAroundFaceCirculator =
typename Base::InnerHalfEdgeAroundFaceCirculator;
using OuterHalfEdgeAroundFaceCirculator =
typename Base::OuterHalfEdgeAroundFaceCirculator;
using FaceAroundFaceCirculator = typename Base::FaceAroundFaceCirculator;
/** \brief Constructor. */
QuadMesh() : Base(), add_quad_(4) {}
/** \brief The base method of addFace is hidden because of the overloads in this
* class. */
using Base::addFace;
/** \brief Add a quad to the mesh. Data is only added if it is associated with the
* elements. The last vertex is connected with the first one.
* \param[in] idx_v_0 Index to the first vertex.
* \param[in] idx_v_1 Index to the second vertex.
* \param[in] idx_v_2 Index to the third vertex.
* \param[in] idx_v_3 Index to the fourth vertex.
* \param[in] face_data Data that is set for the face.
* \param[in] half_edge_data Data that is set for all added half-edges.
* \param[in] edge_data Data that is set for all added edges.
* \return Index to the new face. Failure is signaled by returning an invalid face
* index.
* \warning The vertices must be valid and unique (each vertex may be contained
* only once). Not complying with this requirement results in undefined behavior!
*/
inline FaceIndex
addFace(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_quad_[0] = idx_v_0;
add_quad_[1] = idx_v_1;
add_quad_[2] = idx_v_2;
add_quad_[3] = idx_v_3;
return (this->addFaceImplBase(add_quad_, face_data, edge_data, half_edge_data));
}
private:
// NOTE: Can't use the typedef of Base as a friend.
friend class pcl::geometry::
MeshBase<QuadMesh<MeshTraitsT>, MeshTraitsT, pcl::geometry::QuadMeshTag>;
/** \brief addFace for the quad mesh. */
inline FaceIndex
addFaceImpl(const VertexIndices& vertices,
const FaceData& face_data,
const EdgeData& edge_data,
const HalfEdgeData& half_edge_data)
{
if (vertices.size() == 4)
return (this->addFaceImplBase(vertices, face_data, edge_data, half_edge_data));
return (FaceIndex());
}
////////////////////////////////////////////////////////////////////////
// Members
////////////////////////////////////////////////////////////////////////
/** \brief Storage for adding a quad. */
VertexIndices add_quad_;
public:
PCL_MAKE_ALIGNED_OPERATOR_NEW
};
} // namespace geometry
} // End namespace pcl
pcl::detail::MeshIndex
Definition: mesh_indices.h:68
pcl::geometry::MeshBase
Base class for the half-edge mesh.
Definition: mesh_base.h:95
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::HasVertexData
std::integral_constant< bool, !std::is_same< VertexData, pcl::geometry::NoData >::value > HasVertexData
Definition: mesh_base.h:119
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::IncomingHalfEdgeAroundVertexCirculator
pcl::geometry::IncomingHalfEdgeAroundVertexCirculator< const Self > IncomingHalfEdgeAroundVertexCirculator
Definition: mesh_base.h:152
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::OuterHalfEdgeAroundFaceCirculator
pcl::geometry::OuterHalfEdgeAroundFaceCirculator< const Self > OuterHalfEdgeAroundFaceCirculator
Definition: mesh_base.h:160
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::EdgeIndices
std::vector< EdgeIndex > EdgeIndices
Definition: mesh_base.h:143
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::FaceIndex
pcl::geometry::FaceIndex FaceIndex
Definition: mesh_base.h:139
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::EdgeData
typename MeshTraitsT::EdgeData EdgeData
Definition: mesh_base.h:106
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::FaceIndices
std::vector< FaceIndex > FaceIndices
Definition: mesh_base.h:144
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::HalfEdgeData
typename MeshTraitsT::HalfEdgeData HalfEdgeData
Definition: mesh_base.h:105
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::VertexDataCloud
pcl::PointCloud< VertexData > VertexDataCloud
Definition: mesh_base.h:130
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::FaceAroundFaceCirculator
pcl::geometry::FaceAroundFaceCirculator< const Self > FaceAroundFaceCirculator
Definition: mesh_base.h:161
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::addFaceImplBase
FaceIndex addFaceImplBase(const VertexIndices &vertices, const FaceData &face_data, const EdgeData &edge_data, const HalfEdgeData &half_edge_data)
General implementation of addFace.
Definition: mesh_base.h:1157
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::VertexData
typename MeshTraitsT::VertexData VertexData
Definition: mesh_base.h:104
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::FaceAroundVertexCirculator
pcl::geometry::FaceAroundVertexCirculator< const Self > FaceAroundVertexCirculator
Definition: mesh_base.h:154
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::HalfEdgeIndices
std::vector< HalfEdgeIndex > HalfEdgeIndices
Definition: mesh_base.h:142
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::HasEdgeData
std::integral_constant< bool, !std::is_same< EdgeData, pcl::geometry::NoData >::value > HasEdgeData
Definition: mesh_base.h:125
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::HasFaceData
std::integral_constant< bool, !std::is_same< FaceData, pcl::geometry::NoData >::value > HasFaceData
Definition: mesh_base.h:128
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::FaceDataCloud
pcl::PointCloud< FaceData > FaceDataCloud
Definition: mesh_base.h:133
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::VertexIndex
pcl::geometry::VertexIndex VertexIndex
Definition: mesh_base.h:136
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::addFace
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.
Definition: mesh_base.h:202
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::VertexAroundFaceCirculator
pcl::geometry::VertexAroundFaceCirculator< const Self > VertexAroundFaceCirculator
Definition: mesh_base.h:156
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::IsManifold
typename MeshTraitsT::IsManifold IsManifold
Definition: mesh_base.h:108
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::HalfEdgeDataCloud
pcl::PointCloud< HalfEdgeData > HalfEdgeDataCloud
Definition: mesh_base.h:131
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::FaceData
typename MeshTraitsT::FaceData FaceData
Definition: mesh_base.h:107
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::InnerHalfEdgeAroundFaceCirculator
pcl::geometry::InnerHalfEdgeAroundFaceCirculator< const Self > InnerHalfEdgeAroundFaceCirculator
Definition: mesh_base.h:158
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::VertexIndices
std::vector< VertexIndex > VertexIndices
Definition: mesh_base.h:141
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::VertexAroundVertexCirculator
pcl::geometry::VertexAroundVertexCirculator< const Self > VertexAroundVertexCirculator
Definition: mesh_base.h:148
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::EdgeIndex
pcl::geometry::EdgeIndex EdgeIndex
Definition: mesh_base.h:138
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::HasHalfEdgeData
std::integral_constant< bool, !std::is_same< HalfEdgeData, pcl::geometry::NoData >::value > HasHalfEdgeData
Definition: mesh_base.h:122
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::MeshTag
QuadMeshTag MeshTag
Definition: mesh_base.h:114
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::OutgoingHalfEdgeAroundVertexCirculator
pcl::geometry::OutgoingHalfEdgeAroundVertexCirculator< const Self > OutgoingHalfEdgeAroundVertexCirculator
Definition: mesh_base.h:150
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::HalfEdgeIndex
pcl::geometry::HalfEdgeIndex HalfEdgeIndex
Definition: mesh_base.h:137
pcl::geometry::MeshBase< QuadMesh< MeshTraitsT >, MeshTraitsT, QuadMeshTag >::EdgeDataCloud
pcl::PointCloud< EdgeData > EdgeDataCloud
Definition: mesh_base.h:132
pcl::geometry::QuadMesh
Half-edge mesh that can only store quads.
Definition: quad_mesh.h:59
pcl::geometry::QuadMesh::FaceAroundFaceCirculator
typename Base::FaceAroundFaceCirculator FaceAroundFaceCirculator
Definition: quad_mesh.h:107
pcl::geometry::QuadMesh::IncomingHalfEdgeAroundVertexCirculator
typename Base::IncomingHalfEdgeAroundVertexCirculator IncomingHalfEdgeAroundVertexCirculator
Definition: quad_mesh.h:100
pcl::geometry::QuadMesh::OutgoingHalfEdgeAroundVertexCirculator
typename Base::OutgoingHalfEdgeAroundVertexCirculator OutgoingHalfEdgeAroundVertexCirculator
Definition: quad_mesh.h:98
pcl::geometry::QuadMesh::VertexAroundVertexCirculator
typename Base::VertexAroundVertexCirculator VertexAroundVertexCirculator
Definition: quad_mesh.h:96
pcl::geometry::QuadMesh::HasVertexData
typename Base::HasVertexData HasVertexData
Definition: quad_mesh.h:74
pcl::geometry::QuadMesh::HasFaceData
typename Base::HasFaceData HasFaceData
Definition: quad_mesh.h:77
pcl::geometry::QuadMesh::MeshTag
typename Base::MeshTag MeshTag
Definition: quad_mesh.h:72
pcl::geometry::QuadMesh::IsManifold
typename Base::IsManifold IsManifold
Definition: quad_mesh.h:71
pcl::geometry::QuadMesh::HalfEdgeIndices
typename Base::HalfEdgeIndices HalfEdgeIndices
Definition: quad_mesh.h:91
pcl::geometry::QuadMesh::FaceData
typename Base::FaceData FaceData
Definition: quad_mesh.h:70
pcl::geometry::QuadMesh::VertexIndices
typename Base::VertexIndices VertexIndices
Definition: quad_mesh.h:90
pcl::geometry::QuadMesh::EdgeIndices
typename Base::EdgeIndices EdgeIndices
Definition: quad_mesh.h:92
pcl::geometry::QuadMesh::HalfEdgeData
typename Base::HalfEdgeData HalfEdgeData
Definition: quad_mesh.h:68
pcl::geometry::QuadMesh::FaceAroundVertexCirculator
typename Base::FaceAroundVertexCirculator FaceAroundVertexCirculator
Definition: quad_mesh.h:101
pcl::geometry::QuadMesh::ConstPtr
shared_ptr< const Self > ConstPtr
Definition: quad_mesh.h:65
pcl::geometry::QuadMesh::VertexIndex
typename Base::VertexIndex VertexIndex
Definition: quad_mesh.h:85
pcl::geometry::QuadMesh::InnerHalfEdgeAroundFaceCirculator
typename Base::InnerHalfEdgeAroundFaceCirculator InnerHalfEdgeAroundFaceCirculator
Definition: quad_mesh.h:104
pcl::geometry::QuadMesh::VertexData
typename Base::VertexData VertexData
Definition: quad_mesh.h:67
pcl::geometry::QuadMesh::HalfEdgeIndex
typename Base::HalfEdgeIndex HalfEdgeIndex
Definition: quad_mesh.h:86
pcl::geometry::QuadMesh::HalfEdgeDataCloud
typename Base::HalfEdgeDataCloud HalfEdgeDataCloud
Definition: quad_mesh.h:80
pcl::geometry::QuadMesh::FaceIndex
typename Base::FaceIndex FaceIndex
Definition: quad_mesh.h:88
pcl::geometry::QuadMesh::EdgeData
typename Base::EdgeData EdgeData
Definition: quad_mesh.h:69
pcl::geometry::QuadMesh::Ptr
shared_ptr< Self > Ptr
Definition: quad_mesh.h:64
pcl::geometry::QuadMesh::VertexDataCloud
typename Base::VertexDataCloud VertexDataCloud
Definition: quad_mesh.h:79
pcl::geometry::QuadMesh::OuterHalfEdgeAroundFaceCirculator
typename Base::OuterHalfEdgeAroundFaceCirculator OuterHalfEdgeAroundFaceCirculator
Definition: quad_mesh.h:106
pcl::geometry::QuadMesh::VertexAroundFaceCirculator
typename Base::VertexAroundFaceCirculator VertexAroundFaceCirculator
Definition: quad_mesh.h:102
pcl::geometry::QuadMesh::HasHalfEdgeData
typename Base::HasHalfEdgeData HasHalfEdgeData
Definition: quad_mesh.h:75
pcl::geometry::QuadMesh::addFace
FaceIndex addFace(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 a quad to the mesh.
Definition: quad_mesh.h:131
pcl::geometry::QuadMesh::HasEdgeData
typename Base::HasEdgeData HasEdgeData
Definition: quad_mesh.h:76
pcl::geometry::QuadMesh::EdgeDataCloud
typename Base::EdgeDataCloud EdgeDataCloud
Definition: quad_mesh.h:81
pcl::geometry::QuadMesh::FaceIndices
typename Base::FaceIndices FaceIndices
Definition: quad_mesh.h:93
pcl::geometry::QuadMesh::QuadMesh
QuadMesh()
Constructor.
Definition: quad_mesh.h:110
pcl::geometry::QuadMesh::EdgeIndex
typename Base::EdgeIndex EdgeIndex
Definition: quad_mesh.h:87
pcl::geometry::QuadMesh::FaceDataCloud
typename Base::FaceDataCloud FaceDataCloud
Definition: quad_mesh.h:82
PCL_MAKE_ALIGNED_OPERATOR_NEW
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: memory.h:63
memory.h
Defines functions, macros and traits for allocating and using memory.
pcl::geometry
Definition: geometry.h:57
pcl
Definition: convolution.h:46
pcl_macros.h
Defines all the PCL and non-PCL macros used.
pcl::geometry::QuadMeshTag
Tag describing the type of the mesh.
Definition: quad_mesh.h:50