Loading...
Searching...
No Matches
CompositeT.hh
Go to the documentation of this file.
/* ========================================================================= *
* *
* OpenMesh *
* Copyright (c) 2001-2025, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openmesh.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenMesh. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. 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. *
* *
* 3. Neither the name of the copyright holder 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 HOLDER *
* 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. *
* *
* ========================================================================= */
//=============================================================================
//
// CLASS CompositeT
//
//=============================================================================
#ifndef OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITE_HH
#define OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITE_HH
//== INCLUDES =================================================================
#include <string>
#include <vector>
// --------------------
#include <OpenMesh/Tools/Subdivider/Uniform/SubdividerT.hh>
//== NAMESPACE ================================================================
namespace OpenMesh { // BEGIN_NS_OPENMESH
namespace Subdivider { // BEGIN_NS_DECIMATER
namespace Uniform { // BEGIN_NS_UNIFORM
//== CLASS DEFINITION =========================================================
template <typename MeshType, typename RealType=float >
class CompositeT : public SubdividerT< MeshType, RealType >
{
public:
typedef RealType real_t;
typedef MeshType mesh_t;
typedef SubdividerT< mesh_t, real_t > parent_t;
public:
CompositeT(void) : parent_t(), p_mesh_(nullptr) {}
explicit CompositeT(MeshType& _mesh) : parent_t(_mesh), p_mesh_(nullptr) {};
virtual ~CompositeT() { }
public: // inherited interface
virtual const char *name( void ) const override = 0;
protected: // inherited interface
bool prepare( MeshType& _m ) override;
bool subdivide( MeshType& _m, size_t _n, const bool _update_points = true ) override
{
assert( p_mesh_ == &_m );
while(_n--)
{
apply_rules();
commit(_m);
}
return true;
}
#ifdef NDEBUG
bool cleanup( MeshType& ) override
#else
bool cleanup( MeshType& _m ) override
#endif
{
assert( p_mesh_ == &_m );
p_mesh_=nullptr;
return true;
}
protected:
virtual void apply_rules(void) = 0;
protected:
void commit( MeshType &_m)
{
typename MeshType::VertexIter v_it;
for (v_it=_m.vertices_begin(); v_it != _m.vertices_end(); ++v_it)
_m.set_point(*v_it, _m.data(*v_it).position());
}
public:
struct Coeff
{
virtual ~Coeff() { }
virtual double operator() (size_t _valence) = 0;
};
protected:
typedef typename MeshType::Scalar scalar_t;
typedef typename MeshType::VertexHandle VertexHandle;
typedef typename MeshType::FaceHandle FaceHandle;
typedef typename MeshType::EdgeHandle EdgeHandle;
typedef typename MeshType::HalfedgeHandle HalfedgeHandle;
void Tvv3();
void Tvv4();
void Tfv();
void FF();
void FFc(Coeff& _coeff);
void FFc(scalar_t _c);
void FV();
void FVc(Coeff& _coeff);
void FVc(scalar_t _c);
void FE();
void VF();
void VFa(Coeff& _coeff);
void VFa(scalar_t _alpha);
void VV();
void VVc(Coeff& _coeff);
void VVc(scalar_t _c);
void VE();
void VdE();
void VdEc(scalar_t _c);
void VdEg(Coeff& _coeff);
void VdEg(scalar_t _gamma);
void EF();
void EV();
void EVc(Coeff& _coeff);
void EVc(scalar_t _c);
void EdE();
void EdEc(scalar_t _c);
void corner_cutting(HalfedgeHandle _heh);
VertexHandle split_edge(HalfedgeHandle _heh);
private:
MeshType* p_mesh_;
};
//=============================================================================
} // END_NS_UNIFORM
} // END_NS_SUBDIVIDER
} // END_NS_OPENMESH
//=============================================================================
#if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITE_CC)
#define OPENMESH_SUBDIVIDER_TEMPLATES
#include "CompositeT_impl.hh"
#endif
//=============================================================================
#endif // COMPOSITET_HH defined
//=============================================================================
SubdividerT.hh
OpenMesh
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition MeshItems.hh:59
OpenMesh::Subdivider::Uniform::CompositeT
This class provides the composite subdivision rules for the uniform case.
Definition CompositeT.hh:90
OpenMesh::Subdivider::Uniform::CompositeT::corner_cutting
void corner_cutting(HalfedgeHandle _heh)
Corner Cutting.
Definition CompositeT_impl.hh:1184
OpenMesh::Subdivider::Uniform::CompositeT::Tvv3
void Tvv3()
Split Face, using Vertex information (1-3 split)
Definition CompositeT_impl.hh:92
OpenMesh::Subdivider::Uniform::CompositeT::cleanup
bool cleanup(MeshType &_m) override
Cleanup mesh after usage, e.g. remove added properties.
Definition CompositeT.hh:127
OpenMesh::Subdivider::Uniform::CompositeT::EF
void EF()
Edge to face averaging.
Definition CompositeT_impl.hh:924
OpenMesh::Subdivider::Uniform::CompositeT::VVc
void VVc(Coeff &_coeff)
Vertex to vertex averaging, weighted.
Definition CompositeT_impl.hh:1028
OpenMesh::Subdivider::Uniform::CompositeT::VF
void VF()
Vertex to Face Averaging.
Definition CompositeT_impl.hh:287
OpenMesh::Subdivider::Uniform::CompositeT::FV
void FV()
Face to vertex averaging.
Definition CompositeT_impl.hh:534
OpenMesh::Subdivider::Uniform::CompositeT::VFa
void VFa(Coeff &_coeff)
Vertex to Face Averaging, weighted.
Definition CompositeT_impl.hh:311
OpenMesh::Subdivider::Uniform::CompositeT::FVc
void FVc(Coeff &_coeff)
Weighted face to vertex Averaging with flaps.
Definition CompositeT_impl.hh:559
OpenMesh::Subdivider::Uniform::CompositeT::prepare
bool prepare(MeshType &_m) override
Prepare mesh, e.g.
Definition CompositeT_impl.hh:76
OpenMesh::Subdivider::Uniform::CompositeT::EVc
void EVc(Coeff &_coeff)
Weighted edge to vertex averaging.
Definition CompositeT_impl.hh:861
OpenMesh::Subdivider::Uniform::CompositeT::name
virtual const char * name(void) const override=0
Return name of subdivision algorithm.
OpenMesh::Subdivider::Uniform::CompositeT::VdEg
void VdEg(Coeff &_coeff)
Weigthed vertex to edge averaging, using diamond of edges for irregular vertices.
Definition CompositeT_impl.hh:773
OpenMesh::Subdivider::Uniform::CompositeT::VdEc
void VdEc(scalar_t _c)
Weighted vertex to edge averaging, using diamond of edges.
Definition CompositeT_impl.hh:682
OpenMesh::Subdivider::Uniform::CompositeT::FE
void FE()
Face to edge averaging.
Definition CompositeT_impl.hh:948
OpenMesh::Subdivider::Uniform::CompositeT::apply_rules
virtual void apply_rules(void)=0
Assemble here the rule sequence, by calling the constructor of the wanted rules.
OpenMesh::Subdivider::Uniform::CompositeT::FF
void FF()
Face to face averaging.
Definition CompositeT_impl.hh:423
OpenMesh::Subdivider::Uniform::CompositeT::EV
void EV()
Edge to vertex averaging.
Definition CompositeT_impl.hh:835
OpenMesh::Subdivider::Uniform::CompositeT::commit
void commit(MeshType &_m)
Move vertices to new positions after the rules have been applied to the mesh (called by subdivide()).
Definition CompositeT.hh:145
OpenMesh::Subdivider::Uniform::CompositeT::split_edge
VertexHandle split_edge(HalfedgeHandle _heh)
Split Edge.
Definition CompositeT_impl.hh:1233
OpenMesh::Subdivider::Uniform::CompositeT::FFc
void FFc(Coeff &_coeff)
Weighted face to face averaging.
Definition CompositeT_impl.hh:459
OpenMesh::Subdivider::Uniform::CompositeT::EdEc
void EdEc(scalar_t _c)
Weighted edge to edge averaging w/ flap rule.
Definition CompositeT_impl.hh:1141
OpenMesh::Subdivider::Uniform::CompositeT::VE
void VE()
VE Step (Vertex to Edge Averaging)
Definition CompositeT_impl.hh:976
OpenMesh::Subdivider::Uniform::CompositeT::Tvv4
void Tvv4()
Split Face, using Vertex information (1-4 split)
Definition CompositeT_impl.hh:156
OpenMesh::Subdivider::Uniform::CompositeT::VdE
void VdE()
Vertex to edge averaging, using diamond of edges.
Definition CompositeT_impl.hh:646
OpenMesh::Subdivider::Uniform::CompositeT::Tfv
void Tfv()
Split Face, using Face Information.
Definition CompositeT_impl.hh:211
OpenMesh::Subdivider::Uniform::CompositeT::VV
void VV()
Vertex to vertex averaging.
Definition CompositeT_impl.hh:994
OpenMesh::Subdivider::Uniform::CompositeT::EdE
void EdE()
Edge to edge averaging w/ flap rule.
Definition CompositeT_impl.hh:1100
OpenMesh::Subdivider::Uniform::CompositeT::subdivide
bool subdivide(MeshType &_m, size_t _n, const bool _update_points=true) override
Subdivide mesh _m _n times.
Definition CompositeT.hh:111
OpenMesh::Subdivider::Uniform::CompositeT::Coeff
Abstract base class for coefficient functions.
Definition CompositeT.hh:158
OpenMesh::Subdivider::Uniform::SubdividerT
Abstract base class for uniform subdivision algorithms.
Definition SubdividerT.hh:89