[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29740] branches/soc-2010-rohith291991/ intern/comiso/intern: Added code to generate constrained faces.

Rohith B V rohith291991 at gmail.com
Sun Jun 27 18:36:42 CEST 2010


Revision: 29740
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29740
Author:   rohith291991
Date:     2010-06-27 18:36:42 +0200 (Sun, 27 Jun 2010)

Log Message:
-----------
Added code to generate constrained faces. This code must be adapted. Does not compile

Added Paths:
-----------
    branches/soc-2010-rohith291991/intern/comiso/intern/map.h
    branches/soc-2010-rohith291991/intern/comiso/intern/map_attributes.h
    branches/soc-2010-rohith291991/intern/comiso/intern/map_curvature.cpp
    branches/soc-2010-rohith291991/intern/comiso/intern/map_curvature.h
    branches/soc-2010-rohith291991/intern/comiso/intern/normal_cycle.cpp
    branches/soc-2010-rohith291991/intern/comiso/intern/normal_cycle.h

Added: branches/soc-2010-rohith291991/intern/comiso/intern/map.h
===================================================================
--- branches/soc-2010-rohith291991/intern/comiso/intern/map.h	                        (rev 0)
+++ branches/soc-2010-rohith291991/intern/comiso/intern/map.h	2010-06-27 16:36:42 UTC (rev 29740)
@@ -0,0 +1,510 @@
+/*
+ *  OGF/Graphite: Geometry and Graphics Programming Library + Utilities
+ *  Copyright (C) 2000 Bruno Levy
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  If you modify this software, you should include a notice giving the
+ *  name of the person performing the modification, the date of modification,
+ *  and the reason for such modification.
+ *
+ *  Contact: Bruno Levy
+ *
+ *     levy at loria.fr
+ *
+ *     ISA Project
+ *     LORIA, INRIA Lorraine, 
+ *     Campus Scientifique, BP 239
+ *     54506 VANDOEUVRE LES NANCY CEDEX 
+ *     FRANCE
+ *
+ *  Note that the GNU General Public License does not permit incorporating
+ *  the Software into proprietary programs. 
+ */
+ 
+
+#ifndef __OGF_CELLS_MAP_MAP__
+#define __OGF_CELLS_MAP_MAP__
+
+#include <OGF/cells/common/common.h>
+#include <OGF/cells/types/iterators.h>
+#include <OGF/cells/map/map_cells.h>
+#include <OGF/basic/containers/dlist.h>
+#include <OGF/basic/attributes/attribute.h>
+
+#include <vector>
+
+namespace OGF {
+
+//_________________________________________________________
+
+    class MapMutator ;
+
+
+    class Map ;
+
+    /**
+     * Has its members add() and remove() called
+     * whenever a vertex is added (respectively
+     * removed) from the structure. This class
+     * is meant to be subclassed by client code.
+     */
+    template <class CELL> class MapCombelObserver {
+    public:
+        MapCombelObserver(Map* m) : map_(m) { }
+        virtual ~MapCombelObserver() { }
+        virtual void add(CELL* c) { }
+        virtual void remove(CELL* c) { }
+
+    protected:
+        Map* map() { return map_; }
+        
+    private:
+        Map* map_ ;
+    } ;
+
+
+    /**
+     * Map implements a topological map. It is highly inspired 
+     * by CGAL's Polyhedron class, with the difference that
+     * each halfedge is allocated separately. All the elements
+     * are allocated in a high-performance chunk-based allocator.
+     * Map is nearly source-level compatible with CGAL polyhedron.
+     * The operations modifying the Map are implemented in the
+     * MapEditor class.
+     */
+
+    class CELLS_API Map {
+    public:
+
+        // __________________ types ___________________
+
+        typedef MapTypes::Vertex Vertex ;
+        typedef MapTypes::TexVertex TexVertex ; 
+        typedef MapTypes::Halfedge Halfedge ;
+        typedef MapTypes::Facet Facet ;
+
+        typedef DList<Vertex>::iterator Vertex_iterator ;
+        typedef DList<Halfedge>::iterator Halfedge_iterator ;
+        typedef DList<Facet>::iterator Facet_iterator ;
+
+        typedef DList<Vertex>::const_iterator Vertex_const_iterator ;
+        typedef DList<Halfedge>::const_iterator Halfedge_const_iterator ;
+        typedef DList<Facet>::const_iterator Facet_const_iterator ;
+
+        
+        typedef GenericAttributeManager<Vertex> VertexAttributeManager ;
+        typedef GenericAttributeManager<Halfedge> HalfedgeAttributeManager ;
+        typedef GenericAttributeManager<Facet> FacetAttributeManager ;
+        typedef GenericAttributeManager<TexVertex> TexVertexAttributeManager ;
+
+
+
+
+
+        Map() ;
+        virtual ~Map() ;
+
+        // __________________ access ___________________
+
+        Vertex_iterator vertices_begin()    { return vertices_.begin() ;  }
+        Vertex_iterator vertices_end()      { return vertices_.end() ;    }
+        Halfedge_iterator halfedges_begin() { return halfedges_.begin() ; }
+        Halfedge_iterator halfedges_end()   { return halfedges_.end() ;   }
+        Facet_iterator facets_begin()       { return facets_.begin() ;    }
+        Facet_iterator facets_end()         { return facets_.end() ;      } 
+
+        Vertex_const_iterator vertices_begin() const { 
+            return vertices_.begin() ;  
+        }
+
+        Vertex_const_iterator vertices_end() const { 
+            return vertices_.end() ;    
+        }
+        
+        Halfedge_const_iterator halfedges_begin() const { 
+            return halfedges_.begin() ; 
+        }
+        Halfedge_const_iterator halfedges_end() const { 
+            return halfedges_.end() ;   
+        }
+        Facet_const_iterator facets_begin() const { 
+            return facets_.begin() ;    
+        }
+        Facet_const_iterator facets_end() const { 
+            return facets_.end() ;      
+        } 
+
+        int size_of_vertices() const  { return vertices_.size() ;  }
+        int size_of_halfedges() const { return halfedges_.size() ; }
+        int size_of_facets() const    { return facets_.size() ;    }
+
+        // ___________________ attributes _______________________
+        
+        VertexAttributeManager* vertex_attribute_manager() const {
+            return const_cast<VertexAttributeManager*>(
+                &vertex_attribute_manager_ 
+            ) ;
+        }
+
+        HalfedgeAttributeManager* halfedge_attribute_manager() const {
+            return const_cast<HalfedgeAttributeManager*>(
+                &halfedge_attribute_manager_ 
+            ) ;
+        }
+        
+        FacetAttributeManager* facet_attribute_manager() const {
+            return const_cast<FacetAttributeManager*>(
+                &facet_attribute_manager_ 
+            ) ;
+        }         
+        
+        TexVertexAttributeManager* tex_vertex_attribute_manager() const {
+            return const_cast<TexVertexAttributeManager*>(
+                &tex_vertex_attribute_manager_ 
+            ) ;
+        }
+
+
+        // ___________________ observers ________________________
+
+        void add_vertex_observer(MapCombelObserver<Vertex>* obs) ;
+        void remove_vertex_observer(MapCombelObserver<Vertex>* obs) ;
+        void add_halfedge_observer(MapCombelObserver<Halfedge>* obs) ;
+        void remove_halfedge_observer(MapCombelObserver<Halfedge>* obs) ;
+        void add_facet_observer(MapCombelObserver<Facet>* obs) ;
+        void remove_facet_observer(MapCombelObserver<Facet>* obs) ;
+
+        // __________________ modification ______________________
+
+        void clear() ;
+        void erase_all() ;
+        void clear_inactive_items() ;
+
+        // __________________ stored normals ____________________
+
+        void compute_normals() ;
+        void compute_vertex_normals() ;
+        void compute_facet_normals(bool create = false) ;
+        void compute_vertex_normal(Vertex* v) ;
+        void compute_facet_normal(Facet* f) ;
+
+        // __________________ predicated ________________________
+
+        bool is_triangulated() const ;
+
+        // __________________ low level (for experts only) ______
+
+        /**
+         * checks the validity of the combinatorial structure.
+         */
+        bool is_valid() const ;
+
+        /**
+         * checks the validity of the combinatorial structure,
+         * and stops in an assertion failure if an error is detected.
+         * This function can be used to debug low-level operations,
+         * such as those in the MapBuilder and the MapEditor classes.
+         */
+        void assert_is_valid() const ;
+
+        /**
+         * fills the list l with all the vertices connected to v,
+         * directly or indirectly.
+         */
+        void get_connected_component(
+            Vertex* v, std::vector<Vertex*>& l
+        ) ;
+
+    protected:
+
+        /**
+         * allocates a pair of halfedges connected with next(), prev(),
+         * and opposite() links.
+         */
+        Halfedge* new_edge() ;
+
+        /**
+         * deallocates a pair of halfedges, connected with an opposite() link.
+         */
+        void delete_edge(Halfedge* h) ;
+
+        Vertex* new_vertex() ;
+        TexVertex* new_tex_vertex() ;
+        Halfedge* new_halfedge() ;
+        Facet* new_facet() ;
+
+        /** copies geometry and attributes from rhs. */
+        Vertex* new_vertex(const Vertex* rhs) ;
+        /** copies geometry and attributes from rhs. */
+        TexVertex* new_tex_vertex(const TexVertex* rhs) ;        
+        /** copies attributes from rhs. */
+        Halfedge* new_halfedge(const Halfedge* rhs) ;
+        /** copies attributes from rhs. */
+        Facet* new_facet(const Facet* rhs) ;
+
+        void delete_vertex(Vertex* v) ;
+        void delete_halfedge(Halfedge* h) ;
+        void delete_facet(Facet* f) ;
+        void delete_tex_vertex(TexVertex* tv) ;
+
+        void activate_vertex(Vertex* v) ;
+        void activate_halfedge(Halfedge* h) ;
+        void activate_facet(Facet* f) ;
+        
+        void deactivate_vertex(Vertex* v) ;
+        void deactivate_halfedge(Halfedge* h) ;
+        void deactivate_facet(Facet* f) ;
+
+        
+        friend class ::OGF::MapMutator ;
+        
+    protected:
+        void reorient_facet( Halfedge* first) ;
+        
+
+    protected:
+
+        // MapCombelObservers notification
+        void notify_add_vertex(Vertex* v) ;
+        void notify_remove_vertex(Vertex* v) ;
+        void notify_add_halfedge(Halfedge* h) ;
+        void notify_remove_halfedge(Halfedge* h) ;
+        void notify_add_facet(Facet* f) ;
+        void notify_remove_facet(Facet* f) ;
+
+    private:
+        DList<Vertex> vertices_ ;
+        DList<Halfedge> halfedges_ ;
+        DList<Facet> facets_ ;
+
+        VertexAttributeManager vertex_attribute_manager_ ;
+        HalfedgeAttributeManager halfedge_attribute_manager_ ;
+        FacetAttributeManager facet_attribute_manager_ ;

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list