Loading...
Searching...
No Matches
RulesT.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. *
* *
* ========================================================================= */
//=============================================================================
//
// Composite Subdivision and Averaging Rules
//
//=============================================================================
#ifndef OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_HH
#define OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_HH
//== INCLUDES =================================================================
#include <OpenMesh/Core/System/config.hh>
#include <OpenMesh/Tools/Subdivider/Adaptive/Composite/RuleInterfaceT.hh>
// -------------------- STL
#include <vector>
//== NAMESPACE ================================================================
namespace OpenMesh { // BEGIN_NS_OPENMESH
namespace Subdivider { // BEGIN_NS_SUBDIVIDER
namespace Adaptive { // BEGIN_NS_ADAPTIVE
//== CLASS DEFINITION =========================================================
//=============================================================================
template <class M> class Tvv3 : public RuleInterfaceT<M>
{
COMPOSITE_RULE( Tvv3, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit Tvv3(M& _mesh) : Inherited(_mesh) { Base::set_subdiv_type(3); };
void raise(typename M::FaceHandle& _fh, state_t _target_state) override;
void raise(typename M::VertexHandle& _vh, state_t _target_state) override;
};
//=============================================================================
template <class M> class Tvv4 : public RuleInterfaceT<M>
{
COMPOSITE_RULE( Tvv4, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef typename M::HalfedgeHandle HEH;
typedef typename M::VertexHandle VH;
typedef RuleInterfaceT<M> Inherited;
explicit Tvv4(M& _mesh) : Inherited(_mesh) { Base::set_subdiv_type(4); };
void raise(typename M::FaceHandle& _fh, state_t _target_state) override;
void raise(typename M::VertexHandle& _vh, state_t _target_state) override;
void raise(typename M::EdgeHandle& _eh, state_t _target_state) override;
private:
void split_edge(HEH& _hh, VH& _vh, state_t _target_state);
void check_edge(const typename M::HalfedgeHandle& _hh,
state_t _target_state);
};
//=============================================================================
template <class M> class VF : public RuleInterfaceT<M>
{
COMPOSITE_RULE( VF, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit VF(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::FaceHandle& _fh, state_t _target_state) override;
};
//=============================================================================
template <class M> class FF : public RuleInterfaceT<M>
{
COMPOSITE_RULE( FF, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit FF(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::FaceHandle& _fh, state_t _target_state) override;
};
//=============================================================================
template <class M> class FFc : public RuleInterfaceT<M>
{
COMPOSITE_RULE( FFc, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit FFc(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::FaceHandle& _fh, state_t _target_state) override;
};
//=============================================================================
template <class M> class FV : public RuleInterfaceT<M>
{
COMPOSITE_RULE( FV, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit FV(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::VertexHandle& _vh, state_t _target_state) override;
};
//=============================================================================
template <class M> class FVc : public RuleInterfaceT<M>
{
COMPOSITE_RULE( FVc, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit FVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
void raise(typename M::VertexHandle& _vh, state_t _target_state) override;
static void init_coeffs(size_t _max_valence);
static const std::vector<double>& coeffs() { return coeffs_; }
double coeff( size_t _valence )
{
assert(_valence < coeffs_.size());
return coeffs_[_valence];
}
private:
static std::vector<double> coeffs_;
};
//=============================================================================
template <class M> class VV : public RuleInterfaceT<M>
{
COMPOSITE_RULE( VV, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit VV(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::VertexHandle& _vh, state_t _target_state) override;
};
//=============================================================================
template <class M> class VVc : public RuleInterfaceT<M>
{
COMPOSITE_RULE( VVc, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit VVc(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::VertexHandle& _vh, state_t _target_state) override;
};
//=============================================================================
template <class M> class VE : public RuleInterfaceT<M>
{
COMPOSITE_RULE( VE, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit VE(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::EdgeHandle& _eh, state_t _target_state) override;
};
//=============================================================================
template <class M> class VdE : public RuleInterfaceT<M>
{
COMPOSITE_RULE( VdE, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit VdE(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::EdgeHandle& _eh, state_t _target_state) override;
};
//=============================================================================
template <class M> class VdEc : public RuleInterfaceT<M>
{
COMPOSITE_RULE( VdEc, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit VdEc(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::EdgeHandle& _eh, state_t _target_state) override;
};
//=============================================================================
template <class M> class EV : public RuleInterfaceT<M>
{
COMPOSITE_RULE( EV, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit EV(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::VertexHandle& _vh, state_t _target_state) override;
};
//=============================================================================
template <class M> class EVc : public RuleInterfaceT<M>
{
COMPOSITE_RULE( EVc, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit EVc(M& _mesh) : Inherited(_mesh) { init_coeffs(50); }
void raise(typename M::VertexHandle& _vh, state_t _target_state) override;
static void init_coeffs(size_t _max_valence);
static const std::vector<double>& coeffs() { return coeffs_; }
double coeff( size_t _valence )
{
assert(_valence < coeffs_.size());
return coeffs_[_valence];
}
private:
static std::vector<double> coeffs_;
};
//=============================================================================
template <class M> class EF : public RuleInterfaceT<M>
{
COMPOSITE_RULE( EF, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit EF(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::FaceHandle& _fh, state_t _target_state) override;
};
//=============================================================================
template <class M> class FE : public RuleInterfaceT<M>
{
COMPOSITE_RULE( FE, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit FE(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::EdgeHandle& _eh, state_t _target_state) override;
};
//=============================================================================
template <class M> class EdE : public RuleInterfaceT<M>
{
COMPOSITE_RULE( EdE, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit EdE(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::EdgeHandle& _eh, state_t _target_state) override;
};
//=============================================================================
template <class M> class EdEc : public RuleInterfaceT<M>
{
COMPOSITE_RULE( EdEc, M );
private:
typedef RuleInterfaceT<M> Base;
public:
typedef RuleInterfaceT<M> Inherited;
explicit EdEc(M& _mesh) : Inherited(_mesh) {}
void raise(typename M::EdgeHandle& _eh, state_t _target_state) override;
};
// ----------------------------------------------------------------------------
//=============================================================================
} // END_NS_ADAPTIVE
} // END_NS_SUBDIVIDER
} // END_NS_OPENMESH
//=============================================================================
#if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_CC)
# define OPENMESH_SUBDIVIDER_TEMPLATES
# include "RulesT_impl.hh"
#endif
//=============================================================================
#endif // OPENMESH_SUBDIVIDER_ADAPTIVE_RULEST_HH defined
//=============================================================================
RulesT_impl.hh
OpenMesh
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition MeshItems.hh:59
OpenMesh::Subdivider::Adaptive::state_t
CompositeTraits::state_t state_t
Adaptive Composite Subdivision framework.
Definition CompositeTraits.hh:250
OpenMesh::Subdivider::Adaptive::RuleInterfaceT
Base class for adaptive composite subdivision rules.
Definition RuleInterfaceT.hh:109
OpenMesh::Subdivider::Adaptive::Tvv3
Adaptive Composite Subdivision framework.
Definition RulesT.hh:85
OpenMesh::Subdivider::Adaptive::Tvv4
Topological composite rule Tvv,4 doing a 1-4 split of a face.
Definition RulesT.hh:107
OpenMesh::Subdivider::Adaptive::VF
Composite rule VF.
Definition RulesT.hh:138
OpenMesh::Subdivider::Adaptive::VF::raise
void raise(typename M::FaceHandle &_fh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::FF
Composite rule FF.
Definition RulesT.hh:158
OpenMesh::Subdivider::Adaptive::FF::raise
void raise(typename M::FaceHandle &_fh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::FFc
Composite rule FFc.
Definition RulesT.hh:178
OpenMesh::Subdivider::Adaptive::FFc::raise
void raise(typename M::FaceHandle &_fh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::FV
Composite rule FV.
Definition RulesT.hh:198
OpenMesh::Subdivider::Adaptive::FV::raise
void raise(typename M::VertexHandle &_vh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::FVc
Composite rule FVc.
Definition RulesT.hh:218
OpenMesh::Subdivider::Adaptive::FVc::raise
void raise(typename M::VertexHandle &_vh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::VV
Composite rule VV.
Definition RulesT.hh:252
OpenMesh::Subdivider::Adaptive::VV::raise
void raise(typename M::VertexHandle &_vh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::VVc
Composite rule VVc.
Definition RulesT.hh:273
OpenMesh::Subdivider::Adaptive::VVc::raise
void raise(typename M::VertexHandle &_vh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::VE
Composite rule VE.
Definition RulesT.hh:293
OpenMesh::Subdivider::Adaptive::VE::raise
void raise(typename M::EdgeHandle &_eh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::VdE
Composite rule VdE.
Definition RulesT.hh:313
OpenMesh::Subdivider::Adaptive::VdE::raise
void raise(typename M::EdgeHandle &_eh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::VdEc
Composite rule VdEc.
Definition RulesT.hh:333
OpenMesh::Subdivider::Adaptive::VdEc::raise
void raise(typename M::EdgeHandle &_eh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::EV
Composite rule EV.
Definition RulesT.hh:353
OpenMesh::Subdivider::Adaptive::EV::raise
void raise(typename M::VertexHandle &_vh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::EVc
Composite rule EVc.
Definition RulesT.hh:373
OpenMesh::Subdivider::Adaptive::EVc::raise
void raise(typename M::VertexHandle &_vh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::EF
Composite rule EF.
Definition RulesT.hh:408
OpenMesh::Subdivider::Adaptive::EF::raise
void raise(typename M::FaceHandle &_fh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::FE
Composite rule FE.
Definition RulesT.hh:428
OpenMesh::Subdivider::Adaptive::FE::raise
void raise(typename M::EdgeHandle &_eh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::EdE
Composite rule EdE.
Definition RulesT.hh:448
OpenMesh::Subdivider::Adaptive::EdE::raise
void raise(typename M::EdgeHandle &_eh, state_t _target_state) override
Raise item to target state _target_state.
OpenMesh::Subdivider::Adaptive::EdEc
Composite rule EdEc.
Definition RulesT.hh:468
OpenMesh::Subdivider::Adaptive::EdEc::raise
void raise(typename M::EdgeHandle &_eh, state_t _target_state) override
Raise item to target state _target_state.