/[ff3d]/ff3d/geometry/Intersection.hpp
ViewVC logotype

Diff of /ff3d/geometry/Intersection.hpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by delpinux, Mon Feb 17 16:32:50 2003 UTC revision 1.2 by delpinux, Fri Feb 28 14:56:55 2003 UTC
# Line 22  Line 22 
22  #define INTERSECTION_HPP  #define INTERSECTION_HPP
23    
24  #include <Object.hpp>  #include <Object.hpp>
25    #include <ReferenceCounting.hpp>
26    
27    #include <list>
28    
29  /*!  \class Intersection  /*!  \class Intersection
30    
# Line 30  Line 33 
33    \author Stéphane Del Pino.    \author Stéphane Del Pino.
34  */  */
35    
36  class Intersection : public Shape  class Intersection
37      : public Shape
38  {  {
39  private:  private:
40    //! The list of Objects contained in the intersection.    typedef std::list<ReferenceCounting<Object> > ObjectList;
41    std::vector<ReferenceCounting<Shape> > __shape;  
42    public:
43      typedef std::list<ReferenceCounting<Object> >::iterator iterator;
44      typedef std::list<ReferenceCounting<Object> >::const_iterator const_iterator;
45    
46    private:
47      //! The list of Shapes contained in the intersection.
48      ObjectList __objects;
49    
50    //! Returns \p true if the point \a p is inside the Intersection.    //! Returns \p true if the point \a p is inside the Intersection.
51    inline const bool inShape (const TinyVector<3>& p) const;    inline const bool inShape (const TinyVector<3>& p) const;
# Line 42  private: Line 53  private:
53    //! Prints the Intersection informations using the stream \a s.    //! Prints the Intersection informations using the stream \a s.
54    std::ostream& put(std::ostream& s) const;    std::ostream& put(std::ostream& s) const;
55    
   /*!  
     Compute the distance to the face of the Intersection.  
     \warning Not implemented.  
   */  
   inline const TinyVector<3> _distance(const Vertex& V) const  
   {  
     fferr(2) << '\n' << __FILE__ << ':' << __LINE__  
              << ':' << "Not implemented\n";  
     std::exit(1);  
     return V;  
   };  
   
56  public:  public:
57    
58    /*!    const const_iterator begin() const
59      Computes the vector \f$ \overrightarrow{WV} \f$ where \em W the closest    {
60      point of the surface of the Intersection to a given \a \em V and which norm is      return __objects.begin();
61      1. If W is not on an edge or a corner WV is the external normal to the    }
     Intersection.  
   */  
   inline const TinyVector<3> normal(const Vertex& V) const;  
   
   //! Adds the Object \a O inside the Intersection.  
   inline void AddObject(const Object& O);  
62    
63    //! Adds the Shape \a S inside the Intersection.    iterator begin()
64    inline void AddObject(ReferenceCounting<Shape> S);    {
65        return __objects.begin();
66      }
67    
68    //! Returns the Number of Objects contained in the Intersection.  
69    inline const size_t NbObjects() const    const const_iterator end() const
70    {    {
71      return __shape.size();      return __objects.end();
72      }
73    
74      iterator end()
75      {
76        return __objects.end();
77      }
78    
79      //! Adds the Object \a O inside the Union.
80      inline void push_back(ReferenceCounting<Object> O)
81      {
82        __objects.push_back(O);
83    }    }
84    
85    //! Default constructor.    //! Default constructor.
86    Intersection();    Intersection();
87    
   //! Constructs and Intersection using an Object \a O.  
   Intersection(const Object& O);  
   
88    //! Copy constructor.    //! Copy constructor.
89    Intersection(const Intersection& U);    Intersection(const Intersection& U);
90    
# Line 93  public: Line 96  public:
96    
97  };  };
98    
 //! Adds the Object \a O inside the Intersection.  
 void Intersection::AddObject(const Object& O)  
 {  
   __shape.push_back(O.shape());  
 }  
   
 //! Adds the Shape \a S inside the Intersection.  
 void Intersection::AddObject(ReferenceCounting<Shape> s)  
 {  
   __shape.push_back(s);  
 }  
   
99  //! Returns \p true if the point \a p is inside the Intersection.  //! Returns \p true if the point \a p is inside the Intersection.
100  inline const bool Intersection::inShape (const TinyVector<3>& p) const  inline const bool Intersection::inShape (const TinyVector<3>& p) const
101  {  {
102    for (size_t i=0; i<NbObjects(); i++) {    for (Intersection::const_iterator i = __objects.begin();
103      if (!((*__shape[i]).inside(p)))         i != __objects.end(); ++i) {
104        if (!(*(*i)).inside(p))
105        return false;        return false;
106    }    }
107    
108    return true;    return true;
109  }  }
110    
 /*!  Computes the vector \f$ \overrightarrow{WV} \f$ where \em W the closest  
   point of the surface of the Intersection to a given \a \em V and which norm is  
   1. If W is not on an edge or a corner WV is the external normal to the  
   Intersection.  
   \warning not implemented.  
 */  
 inline const TinyVector<3> Intersection::normal(const Vertex& V) const  
 {  
   fferr(2) << __FILE__ << ':' << __LINE__  
            << ':' << "Not implemented\n";  
   std::exit(1);  
   return V;  
 }  
   
   
111  #endif // INTERSECTION_HPP  #endif // INTERSECTION_HPP
112    

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26