54 #ifndef OPENMESH_SUBDIVIDER_ADAPTIVE_COMPOSITET_HH
55 #define OPENMESH_SUBDIVIDER_ADAPTIVE_COMPOSITET_HH
60 #include <OpenMesh/Core/System/config.hh>
71 namespace Subdivider {
78 template <
typename R>
struct RuleHandleT;
79 template <
typename M>
class RuleInterfaceT;
139 typedef std::vector<Rule*> RuleSequence;
141 typedef typename M::VertexHandle VH;
142 typedef typename M::FaceHandle FH;
143 typedef typename M::EdgeHandle EH;
144 typedef typename M::HalfedgeHandle HH;
151 subdiv_rule_(nullptr), mesh_(_mesh)
164 subdiv_rule_ =
nullptr;
166 std::for_each(rule_sequence_.begin(),
167 rule_sequence_.end(), DeleteRule() );
168 rule_sequence_.clear();
177 void refine(
typename M::FaceHandle& _fh);
181 void refine(
typename M::VertexHandle& _vh);
189 const Rule& subdiv_rule()
const {
return *subdiv_rule_; }
200 template <
typename R >
203 size_t idx = rule_sequence_.size();
204 rule_sequence_.push_back(
new R( mesh_ ) );
205 return RuleHandleT<R>( (idx < rule_sequence_.size()) ? idx : -1 );
212 template <
typename R >
215 return _rh = add< R >();
223 template <
typename R >
226 typedef typename RuleHandleT<R>::Rule rule_t;
228 return *
dynamic_cast<rule_t*
>(rule_sequence_[ _rh.
idx() ]);
240 return *rule_sequence_[ _idx ];
244 size_t n_rules()
const {
return rule_sequence_.size(); }
254 const RuleSequence&
rules()
const {
return rule_sequence_; }
267 Rule* t_rule()
const {
return subdiv_rule_; }
268 Rule* f_rule() {
return rule_sequence_.front(); }
269 Rule* l_rule() {
return rule_sequence_.back(); }
274 RuleSequence rule_sequence_;
288 #ifndef DOXY_IGNORE_THIS
289 struct DeleteRule {
void operator()( Rule* _r ) {
delete _r; } };
305 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_SUBDIVIDER_ADAPTIVE_COMPOSITET_CC)
306 # define OPENMESH_SUBDIVIDER_TEMPLATES
307 # include "CompositeT_impl.hh"
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
CompositeTraits::state_t state_t
Adaptive Composite Subdivision framework.
Definition: CompositeTraits.hh:250
bool is_valid() const
The handle is valid iff the index is not negative.
Definition: Handles.hh:72
int idx() const
Get the underlying index of this handle.
Definition: Handles.hh:69
Handle template for adaptive composite subdividion rules.
Definition: RuleInterfaceT.hh:84
Base class for adaptive composite subdivision rules.
Definition: RuleInterfaceT.hh:109
Adaptive Composite Subdivision framework.
Definition: CompositeT.hh:134
std::string rules_as_string(const std::string &_sep=" * ") const
Return the sequence as string.
Definition: CompositeT_impl.hh:289
CompositeT(Mesh &_mesh)
Constructor.
Definition: CompositeT.hh:149
state_t generation(VH _vh) const
Add new rule to rule sequence by passing the type of the wanted rule as template argument to the meth...
Definition: CompositeT.hh:260
bool initialize(void)
Initialize faces, edges, vertices, and rules.
Definition: CompositeT_impl.hh:77
size_t n_rules() const
Number of rules in the rule sequence.
Definition: CompositeT.hh:244
state_t generation(FH _fh) const
Add new rule to rule sequence by passing the type of the wanted rule as template argument to the meth...
Definition: CompositeT.hh:262
state_t generation(state_t _s) const
Add new rule to rule sequence by passing the type of the wanted rule as template argument to the meth...
Definition: CompositeT.hh:259
RuleHandleT< R > & add(RuleHandleT< R > &_rh)
Add new rule to rule sequence by passing an appropriate handle to the method.
Definition: CompositeT.hh:213
RuleInterfaceT< M > & rule(size_t _idx)
Get rule (interface) by index.
Definition: CompositeT.hh:237
RuleHandleT< R > add()
Add new rule to rule sequence by passing the type of the wanted rule as template argument to the meth...
Definition: CompositeT.hh:201
RuleHandleT< R >::Rule & rule(const RuleHandleT< R > &_rh)
Get rule in the rule sequence by a handle.
Definition: CompositeT.hh:224
state_t generation(EH _eh) const
Add new rule to rule sequence by passing the type of the wanted rule as template argument to the meth...
Definition: CompositeT.hh:261
const RuleSequence & rules() const
The rule sequence.
Definition: CompositeT.hh:254
void cleanup(void)
Reset self to state after the default constructor except of the mesh.
Definition: CompositeT.hh:161
int subdiv_type()
Return subdivision split type (3 for 1-to-3 split, 4 for 1-to-4 split).
Definition: CompositeT.hh:185
void refine(typename M::FaceHandle &_fh)
Refine one face.
Definition: CompositeT_impl.hh:174
Mesh traits for adaptive composite subdivider.