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

Diff of /ff3d/geometry/Object.hpp

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

revision 1.2 by delpinux, Fri Feb 28 14:56:55 2003 UTC revision 1.3 by delpinux, Sun Aug 31 15:09:40 2003 UTC
# Line 26  Line 26 
26  #include <Shape.hpp>  #include <Shape.hpp>
27  #include <ReferenceCounting.hpp>  #include <ReferenceCounting.hpp>
28    
29  /*!  /**
30    \class Object   * @file   Object.hpp
31    This class links a Shape and a reference.   * @author Stephane Del Pino
32     * @date   Sun Aug 31 15:08:43 2003
33    \author Stéphane Del Pino.   *
34     * @brief Describes objects which are made of a shape and maybe a
35     * reference
36     *
37   */   */
38  class Object  class Object
39  {  {
40  private:  private:
41    /// A pointer to a Shape \a s.    ReferenceCounting<Shape> __shape; /**<  A pointer to the shape */
42    ReferenceCounting<Shape> __shape;  
43      bool __hasReference;          /**< true if the object has a reference */
44    
45    /// The reference of the Object \a ref.    TinyVector<3> __reference;    /**< the POV-Ray reference of the object */
   TinyVector<3> __reference;  
46    
47  public:  public:
48    //! Outputs the Shape \a S to the stream \a os.    /**
49       * Writes the object information in a given stream
50       *
51       * @param os the given stream
52       * @param o the object to write
53       *
54       * @return the modified stream
55       */
56    friend std::ostream& operator << (std::ostream& os,    friend std::ostream& operator << (std::ostream& os,
57                                      const Object& o)                                      const Object& o)
58    {    {
# Line 50  public: Line 60  public:
60      return os;      return os;
61    }    }
62    
63    /// Read-only access function to the reference \a ref.    /**
64       * returns the reference state of the object
65       *
66       * @return true if the object has a defined reference
67       */
68      const bool& hasReference() const
69      {
70        return __hasReference;
71      }
72    
73      /**
74       * Access to the reference of the object
75       *
76       * @return the reference
77       */
78    const TinyVector<3>& reference() const    const TinyVector<3>& reference() const
79    {    {
80        assert(__hasReference);
81      return __reference;      return __reference;
82    }    }
83    
84    /// Read-only access function to the Shape \a s.    /**
85    inline const ReferenceCounting<Shape> shape() const     * Read only access to the shape of the object
86       *
87       * @return the shape
88       */
89      inline const ReferenceCounting<Shape>& shape() const
90    {    {
91        assert(__shape != 0);
92      return __shape;      return __shape;
93    }    }
94    
95      /**
96    /// Returns the Shape type.     * Computes if a vertex is inside the object
97    inline const Shape::ShapeType& shapeType() const     *
98    {     * @param x the given vertex
99      return (*__shape).type();     *
100    }     * @return true if \a x is in the shape
101       */
102    /// Returns \p true if the Vertex \a V is in the Object Shape.    inline bool inside(const TinyVector<3, real_t>& x) const
103    inline const bool inside(const Vertex& V) const    {
104    {      return (*__shape).inside(x);
105      return (*__shape).inside(V);    }
106    }  
107      /**
108    /// Returns \p true if the Vertex \a V is in the Object Shape.     * Sets the reference object
109    inline const bool inside(const TinyVector<3>& P) const     *
110    {     * @param aReference the given reference
111      return (*__shape).inside(P);     */
112    }    void setReference(const TinyVector<3, real_t>& aReference)
113      {
114        assert(__hasReference == false);
115    /// Constructs an Object using the Shape \a S and the reference \a ref.      __hasReference = true;
116    Object(ReferenceCounting<Shape> s, const TinyVector<3>& ref)      __reference = aReference;
117      }
118    
119      /**
120       * Constructs an object using a given shape
121       *
122       * @param s the given shape
123       */
124      Object(const ReferenceCounting<Shape>& s)
125      : __shape(s),      : __shape(s),
126        __reference(ref)        __hasReference(false),
127          __reference(0)
128    {    {
129      ;      ;
130    }    }
131    
132    /// Copy Constuctor    /**
133    Object(const Object& O)     * Constructs an object using another object
134      : __shape(O.__shape),     *
135        __reference(O.__reference)     * @param o a given object
136       */
137      Object(const Object& o)
138        : __shape(o.__shape),
139          __hasReference(o.__hasReference),
140          __reference(o.__reference)
141    {    {
142      ;      ;
143    }    }
144    
145      /**
146       * Destructor
147       *
148       */
149    ~Object()    ~Object()
150    {    {
151      ;      ;

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

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