Changed OpenMesh directory structure
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@106 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
17
src/OpenMesh/Tools/Subdivider/Uniform/Composite/ACGMakefile
Normal file
17
src/OpenMesh/Tools/Subdivider/Uniform/Composite/ACGMakefile
Normal file
@@ -0,0 +1,17 @@
|
||||
#== SYSTEM PART -- DON'T TOUCH ==============================================
|
||||
include $(ACGMAKE)/Config
|
||||
#==============================================================================
|
||||
|
||||
|
||||
SUBDIRS = $(call find-subdirs)
|
||||
|
||||
PACKAGES :=
|
||||
|
||||
PROJ_LIBS :=
|
||||
|
||||
MODULES := cxxlib
|
||||
|
||||
|
||||
#== SYSTEM PART -- DON'T TOUCH ==============================================
|
||||
include $(ACGMAKE)/Rules
|
||||
#==============================================================================
|
||||
1310
src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc
Normal file
1310
src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.cc
Normal file
File diff suppressed because it is too large
Load Diff
233
src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.hh
Normal file
233
src/OpenMesh/Tools/Subdivider/Uniform/Composite/CompositeT.hh
Normal file
@@ -0,0 +1,233 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// OpenMesh
|
||||
// Copyright (C) 2003 by Computer Graphics Group, RWTH Aachen
|
||||
// www.openmesh.org
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// License
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation, version 2.1.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Revision$
|
||||
// $Date$
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
/** \file Uniform/Composite/CompositeT.hh
|
||||
|
||||
*/
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// 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 =========================================================
|
||||
|
||||
/** This class provides the composite subdivision rules for the uniform case.
|
||||
*
|
||||
* To create a subdivider derive from this class and overload the functions
|
||||
* name() and apply_rules(). In the latter one call the wanted rules.
|
||||
*
|
||||
* For details on the composite scheme refer to
|
||||
* - <a
|
||||
* href="http://cm.bell-labs.com/who/poswald/sqrt3.pdf">P. Oswald,
|
||||
* P. Schroeder "Composite primal/dual sqrt(3)-subdivision schemes",
|
||||
* CAGD 20, 3, 2003, 135--164</a>
|
||||
|
||||
* \note Not all rules are implemented!
|
||||
* \see class Adaptive::CompositeT
|
||||
*/
|
||||
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_(NULL) {}
|
||||
CompositeT(MeshType& _mesh) : parent_t(_mesh), p_mesh_(NULL) {};
|
||||
virtual ~CompositeT() { }
|
||||
|
||||
public: // inherited interface
|
||||
|
||||
virtual const char *name( void ) const = 0;
|
||||
|
||||
protected: // inherited interface
|
||||
|
||||
bool prepare( MeshType& _m );
|
||||
|
||||
bool subdivide( MeshType& _m, size_t _n )
|
||||
{
|
||||
assert( p_mesh_ == &_m );
|
||||
|
||||
while(_n--)
|
||||
{
|
||||
apply_rules();
|
||||
commit(_m);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef NDEBUG
|
||||
bool cleanup( MeshType& )
|
||||
#else
|
||||
bool cleanup( MeshType& _m )
|
||||
#endif
|
||||
{
|
||||
assert( p_mesh_ == &_m );
|
||||
p_mesh_=NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/// Assemble here the rule sequence, by calling the constructor
|
||||
/// of the wanted rules.
|
||||
virtual void apply_rules(void) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
/// Move vertices to new positions after the rules have been applied
|
||||
/// to the mesh (called by subdivide()).
|
||||
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.handle(), _m.data(v_it).position());
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/// Abstract base class for coefficient functions
|
||||
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;
|
||||
|
||||
/// \name Uniform composite subdivision rules
|
||||
//@{
|
||||
|
||||
|
||||
void Tvv3(); ///< Split Face, using Vertex information (1-3 split)
|
||||
void Tvv4(); ///< Split Face, using Vertex information (1-4 split)
|
||||
void Tfv(); ///< Split Face, using Face Information
|
||||
|
||||
void FF(); ///< Face to face averaging.
|
||||
void FFc(Coeff& _coeff); ///< Weighted face to face averaging.
|
||||
void FFc(scalar_t _c); ///< Weighted face to face averaging.
|
||||
|
||||
void FV(); ///< Face to vertex averaging.
|
||||
void FVc(Coeff& _coeff); ///< Weighted face to vertex Averaging with flaps
|
||||
void FVc(scalar_t _c); ///< Weighted face to vertex Averaging with flaps
|
||||
|
||||
void FE(); ///< Face to edge averaging.
|
||||
|
||||
void VF(); ///< Vertex to Face Averaging.
|
||||
void VFa(Coeff& _coeff); ///< Vertex to Face Averaging, weighted.
|
||||
void VFa(scalar_t _alpha); ///< Vertex to Face Averaging, weighted.
|
||||
|
||||
void VV(); ///< Vertex to vertex averaging.
|
||||
void VVc(Coeff& _coeff); ///< Vertex to vertex averaging, weighted.
|
||||
void VVc(scalar_t _c); ///< Vertex to vertex averaging, weighted.
|
||||
|
||||
void VE(); ///< VE Step (Vertex to Edge Averaging)
|
||||
|
||||
|
||||
void VdE(); ///< Vertex to edge averaging, using diamond of edges.
|
||||
void VdEc(scalar_t _c); ///< Weighted vertex to edge averaging, using diamond of edges
|
||||
|
||||
/// Weigthed vertex to edge averaging, using diamond of edges for
|
||||
/// irregular vertices.
|
||||
void VdEg(Coeff& _coeff);
|
||||
/// Weigthed vertex to edge averaging, using diamond of edges for
|
||||
/// irregular vertices.
|
||||
void VdEg(scalar_t _gamma);
|
||||
|
||||
void EF(); ///< Edge to face averaging.
|
||||
|
||||
void EV(); ///< Edge to vertex averaging.
|
||||
void EVc(Coeff& _coeff); ///< Weighted edge to vertex averaging.
|
||||
void EVc(scalar_t _c); ///< Weighted edge to vertex averaging.
|
||||
|
||||
void EdE(); ///< Edge to edge averaging w/ flap rule.
|
||||
void EdEc(scalar_t _c); ///< Weighted edge to edge averaging w/ flap rule.
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
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.cc"
|
||||
#endif
|
||||
//=============================================================================
|
||||
#endif // COMPOSITET_HH defined
|
||||
//=============================================================================
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// OpenMesh
|
||||
// Copyright (C) 2003 by Computer Graphics Group, RWTH Aachen
|
||||
// www.openmesh.org
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// License
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation, version 2.1.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Revision$
|
||||
// $Date$
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
/** \file Uniform/Composite/CompositeTraits.hh
|
||||
Mesh traits for uniform composite subdivision.
|
||||
*/
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// CLASS Traits
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH
|
||||
#define OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH
|
||||
|
||||
|
||||
//== INCLUDES =================================================================
|
||||
|
||||
//#include "Config.hh"
|
||||
// --------------------
|
||||
#include <OpenMesh/Core/Mesh/Traits.hh>
|
||||
#include <OpenMesh/Core/Mesh/Attributes.hh>
|
||||
|
||||
|
||||
//== NAMESPACE ================================================================
|
||||
|
||||
namespace OpenMesh { // BEGIN_NS_OPENMESH
|
||||
namespace Subdivider { // BEGIN_NS_DECIMATER
|
||||
namespace Uniform { // BEGIN_NS_UNIFORM
|
||||
|
||||
|
||||
//== CLASS DEFINITION =========================================================
|
||||
|
||||
|
||||
/** Uniform Composite Subdivision framework.
|
||||
*/
|
||||
|
||||
struct CompositeTraits : public OpenMesh::DefaultTraits
|
||||
{
|
||||
FaceAttributes( OpenMesh::Attributes::Normal );
|
||||
|
||||
VertexAttributes( OpenMesh::Attributes::Normal );
|
||||
|
||||
//HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge );
|
||||
|
||||
FaceTraits
|
||||
{
|
||||
private:
|
||||
typedef typename Refs::HalfedgeHandle HalfedgeHandle;
|
||||
typedef typename Refs::Scalar Scalar;
|
||||
typedef typename Refs::Point Point;
|
||||
HalfedgeHandle red_halfedge_handle_;
|
||||
unsigned int generation_;
|
||||
bool red_;
|
||||
Scalar quality_;
|
||||
Point midpoint_;
|
||||
Point position_;
|
||||
|
||||
public:
|
||||
const unsigned int& generation() { return generation_; }
|
||||
void set_generation(const unsigned int& _g) { generation_ = _g; }
|
||||
void inc_generation() { ++generation_; }
|
||||
void set_red() { red_ = 1; }
|
||||
void set_green() {red_ = 0; }
|
||||
bool is_red() { return red_; }
|
||||
bool is_green() { return !red_; }
|
||||
void set_red_halfedge_handle(HalfedgeHandle& _heh)
|
||||
{ red_halfedge_handle_ = _heh; }
|
||||
HalfedgeHandle& red_halfedge_handle() { return red_halfedge_handle_; }
|
||||
void set_quality(Scalar& _q) { quality_ = _q; }
|
||||
Scalar& quality() { return quality_; }
|
||||
const Point& midpoint() const { return midpoint_; }
|
||||
void set_midpoint(const Point& _p) { midpoint_ = _p; }
|
||||
const Point& position() const { return position_; }
|
||||
void set_position(const Point& _p) { position_ = _p; }
|
||||
};
|
||||
|
||||
EdgeTraits
|
||||
{
|
||||
private:
|
||||
typedef typename Refs::Point Point;
|
||||
typedef typename Refs::Scalar Scalar;
|
||||
Point midpoint_;
|
||||
Scalar length_;
|
||||
Point position_;
|
||||
public:
|
||||
const Point& midpoint() const { return midpoint_; }
|
||||
void set_midpoint(const Point& _vh) { midpoint_ = _vh; }
|
||||
const Scalar& length() const { return length_; }
|
||||
void set_length(const Scalar& _s) { length_ = _s; }
|
||||
const Point& position() const { return position_; }
|
||||
void set_position(const Point& _p) { position_ = _p; }
|
||||
};
|
||||
|
||||
VertexTraits
|
||||
{
|
||||
private:
|
||||
typedef typename Refs::Point Point;
|
||||
Point new_pos_;
|
||||
Point orig_pos_;
|
||||
Point position_;
|
||||
unsigned int generation_;
|
||||
public:
|
||||
const Point& new_pos() const { return new_pos_; }
|
||||
void set_new_pos(const Point& _p) { new_pos_ = _p; }
|
||||
const unsigned int& generation() const { return generation_; }
|
||||
void set_generation(const unsigned int& _i) { generation_ = _i; }
|
||||
const Point& orig_pos() const { return orig_pos_; }
|
||||
void set_orig_pos(const Point& _p) { orig_pos_ = _p; }
|
||||
const Point& position() const { return position_; }
|
||||
void set_position(const Point& _p) { position_ = _p; }
|
||||
};
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
} // END_NS_UNIFORM
|
||||
} // END_NS_SUBDIVIDER
|
||||
} // END_NS_OPENMESH
|
||||
//=============================================================================
|
||||
#endif // OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH defined
|
||||
//=============================================================================
|
||||
|
||||
Reference in New Issue
Block a user