First checkin for OpenMesh 2.0

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@2 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2009-02-06 13:37:46 +00:00
parent c3321ebdd9
commit 97f515985d
417 changed files with 76182 additions and 0 deletions

View File

@@ -0,0 +1,168 @@
//=============================================================================
//
// 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: 1802 $
// $Date: 2008-05-19 11:55:07 +0200 (Mo, 19. Mai 2008) $
//
//=============================================================================
/** \file CollapseInfoT.hh
Provides data class CollapseInfoT for storing all information
about a halfedge collapse.
*/
//=============================================================================
//
// STRUCT CollpaseInfoT
//
//=============================================================================
#ifndef OPENMESH_DECIMATER_COLLAPSEINFOT_HH
#define OPENMESH_DECIMATER_COLLAPSEINFOT_HH
//== INCLUDES =================================================================
//== NAMESPACE ================================================================
namespace OpenMesh {
namespace Decimater {
//== CLASS DEFINITION =========================================================
/** Stores information about a halfedge collapse.
The class stores information about a halfedge collapse. The most
important information is \c v0v1, \c v1v0, \c v0, \c v1, \c vl,
\c vr, which you can lookup in the following image:
\image html collapse_info.png
\see ModProgMeshT::Info
*/
template <class Mesh>
struct CollapseInfoT
{
public:
/** Initializing constructor.
*
* Given a mesh and a halfedge handle of the halfedge to be collapsed
* all important information of a halfedge collapse will be stored.
* \param _mesh Mesh source
* \param _heh Halfedge to collapse. The direction of the halfedge
* defines the direction of the collapse, i.e. the from-vertex
* will be removed and the to-vertex remains.
*/
CollapseInfoT(Mesh& _mesh, typename Mesh::HalfedgeHandle _heh);
Mesh& mesh;
typename Mesh::HalfedgeHandle v0v1; ///< Halfedge to be collapsed
typename Mesh::HalfedgeHandle v1v0; ///< Reverse halfedge
typename Mesh::VertexHandle v0; ///< Vertex to be removed
typename Mesh::VertexHandle v1; ///< Remaining vertex
typename Mesh::Point p0; ///< Position of removed vertex
typename Mesh::Point p1; ///< Positions of remaining vertex
typename Mesh::FaceHandle fl; ///< Left face
typename Mesh::FaceHandle fr; ///< Right face
typename Mesh::VertexHandle vl; ///< Left vertex
typename Mesh::VertexHandle vr; ///< Right vertex
//@{
/** Outer remaining halfedge of diamond spanned by \c v0, \c v1,
* \c vl, and \c vr
*/
typename Mesh::HalfedgeHandle vlv1, v0vl, vrv0, v1vr;
//@}
};
//-----------------------------------------------------------------------------
// CollapseInfoT::CollapseInfoT( _mesh, _heh )
//
// Local configuration of halfedge collapse to be stored in CollapseInfoT:
/*
vl
*
/ \
/ \
/ fl \
v0 *------>* v1
\ fr /
\ /
\ /
*
vr
*/
// Parameters:
// _mesh Reference to mesh
// _heh The halfedge (v0 -> v1) defining the collapse
//
template <class Mesh>
inline
CollapseInfoT<Mesh>::
CollapseInfoT(Mesh& _mesh, typename Mesh::HalfedgeHandle _heh) :
mesh(_mesh),
v0v1(_heh),
v1v0(_mesh.opposite_halfedge_handle(v0v1)),
v0(_mesh.to_vertex_handle(v1v0)),
v1(_mesh.to_vertex_handle(v0v1)),
p0(_mesh.point(v0)),
p1(_mesh.point(v1)),
fl(_mesh.face_handle(v0v1)),
fr(_mesh.face_handle(v1v0))
{
// get vl
if (fl.is_valid())
{
vlv1 = mesh.next_halfedge_handle(v0v1);
v0vl = mesh.next_halfedge_handle(vlv1);
vl = mesh.to_vertex_handle(vlv1);
vlv1 = mesh.opposite_halfedge_handle(vlv1);
v0vl = mesh.opposite_halfedge_handle(v0vl);
}
// get vr
if (fr.is_valid())
{
vrv0 = mesh.next_halfedge_handle(v1v0);
v1vr = mesh.next_halfedge_handle(vrv0);
vr = mesh.to_vertex_handle(vrv0);
vrv0 = mesh.opposite_halfedge_handle(vrv0);
v1vr = mesh.opposite_halfedge_handle(v1vr);
}
}
//=============================================================================
} // END_NS_DECIMATER
} // END_NS_OPENMESH
//=============================================================================
#endif // OPENMESH_DECIMATER_COLLAPSEINFOT_HH defined
//=============================================================================