- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# Tools/Subdivider/Uniform/Composite/CompositeTraits.hh

Go to the documentation of this file.

    00001 //=============================================================================
    00002 //
    00003 //                               OpenMesh
    00004 //      Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen
    00005 //                           www.openmesh.org
    00006 //
    00007 //-----------------------------------------------------------------------------
    00008 //
    00009 //                                License
    00010 //
    00011 //   This library is free software; you can redistribute it and/or modify it
    00012 //   under the terms of the GNU Library General Public License as published
    00013 //   by the Free Software Foundation, version 2.
    00014 //
    00015 //   This library is distributed in the hope that it will be useful, but
    00016 //   WITHOUT ANY WARRANTY; without even the implied warranty of
    00017 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00018 //   Library General Public License for more details.
    00019 //
    00020 //   You should have received a copy of the GNU Library General Public
    00021 //   License along with this library; if not, write to the Free Software
    00022 //   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00023 //
    00024 //-----------------------------------------------------------------------------
    00025 //
    00026 //   $Revision: 1.2 $
    00027 //   $Date: 2005-12-21 13:58:55 $
    00028 //
    00029 //=============================================================================
    00030
    00035 //=============================================================================
    00036 //
    00037 //  CLASS Traits
    00038 //
    00039 //=============================================================================
    00040
    00041 #ifndef OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH
    00042 #define OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH
    00043
    00044
    00045 //== INCLUDES =================================================================
    00046
    00047 //#include "Config.hh"
    00048 // --------------------
    00049 #include <OpenMesh/Core/Mesh/Traits.hh>
    00050 #include <OpenMesh/Core/Attributes/Attributes.hh>
    00051
    00052
    00053 //== NAMESPACE ================================================================
    00054
    00055 namespace OpenMesh   { // BEGIN_NS_OPENMESH
    00056 namespace Subdivider { // BEGIN_NS_DECIMATER
    00057 namespace Uniform    { // BEGIN_NS_UNIFORM
    00058
    00059
    00060 //== CLASS DEFINITION =========================================================
    00061
    00062
    00066 struct CompositeTraits : public OpenMesh::DefaultTraits
    00067 {
    00068   FaceAttributes( OpenMesh::Attributes::Normal );
    00069
    00070   VertexAttributes( OpenMesh::Attributes::Normal );
    00071
    00072   HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge );
    00073
    00074   FaceTraits
    00075   {
    00076   private:
    00077     typedef typename Refs::HalfedgeHandle HalfedgeHandle;
    00078     typedef typename Refs::Scalar Scalar;
    00079     typedef typename Refs::Point Point;
    00080     HalfedgeHandle red_halfedge_handle_;
    00081     unsigned int generation_;
    00082     bool red_;
    00083     Scalar quality_;
    00084     Point midpoint_;
    00085     Point position_;
    00086
    00087   public:
    00088     const unsigned int& generation() { return generation_; }
    00089     void set_generation(const unsigned int& _g) { generation_ = _g; }
    00090     void inc_generation() { ++generation_; }
    00091     void set_red() { red_ = 1; }
    00092     void set_green() {red_ = 0; }
    00093     bool is_red() { return red_; }
    00094     bool is_green() { return !red_; }
    00095     void set_red_halfedge_handle(HalfedgeHandle& _heh)
    00096       { red_halfedge_handle_ = _heh; }
    00097     HalfedgeHandle& red_halfedge_handle() { return red_halfedge_handle_; }
    00098     void set_quality(Scalar& _q) { quality_ = _q; }
    00099     Scalar& quality() { return quality_; }
    00100     const Point& midpoint() const { return midpoint_; }
    00101     void set_midpoint(const Point& _p) { midpoint_ = _p; }
    00102     const Point& position() const { return position_; }
    00103     void set_position(const Point& _p) { position_ = _p; }
    00104   };
    00105
    00106   EdgeTraits
    00107   {
    00108   private:
    00109     typedef typename Refs::Point Point;
    00110     typedef typename Refs::Scalar Scalar;
    00111     Point midpoint_;
    00112     Scalar length_;
    00113     Point position_;
    00114   public:
    00115     const Point& midpoint() const { return midpoint_; }
    00116     void set_midpoint(const Point& _vh) { midpoint_ = _vh; }
    00117     const Scalar& length() const { return length_; }
    00118     void set_length(const Scalar& _s) { length_ = _s; }
    00119     const Point& position() const { return position_; }
    00120     void set_position(const Point& _p) { position_ = _p; }
    00121   };
    00122
    00123   VertexTraits
    00124   {
    00125   private:
    00126     typedef typename Refs::Point Point;
    00127     Point new_pos_;
    00128     Point orig_pos_;
    00129     Point position_;
    00130     unsigned int generation_;
    00131   public:
    00132     const Point& new_pos() const { return new_pos_; }
    00133     void set_new_pos(const Point& _p) { new_pos_ = _p; }
    00134     const unsigned int& generation() const { return generation_; }
    00135     void set_generation(const unsigned int& _i) { generation_ = _i; }
    00136     const Point& orig_pos() const { return orig_pos_; }
    00137     void set_orig_pos(const Point& _p) { orig_pos_ = _p; }
    00138     const Point& position() const { return position_; }
    00139     void set_position(const Point& _p) { position_ = _p; }
    00140   };
    00141 };
    00142
    00143 //=============================================================================
    00144 } // END_NS_UNIFORM
    00145 } // END_NS_SUBDIVIDER
    00146 } // END_NS_OPENMESH
    00147 //=============================================================================
    00148 #endif // OPENMESH_SUBDIVIDER_UNIFORM_COMPOSITETRAITS_HH defined
    00149 //=============================================================================
    00150