MetaBall.h
Go to the documentation of this file.00001 /**<!--------------------------------------------------------------------> 00002 @class MetaBall 00003 @author Travis Fischer (fisch0920@gmail.com) 00004 @author Matthew Jacobs (jacobs.mh@gmail.com) 00005 @date Spring 2008 00006 00007 @brief 00008 A MetaObject exerts a positive or negative 'charge' in a scalar field, 00009 whose isocontours (level sets) define blobby surfaces with different 00010 threshold values corresponding to the contour level. MetaObjects positively 00011 or negatively affect their neighboring MetaObjects depending on their 00012 'strength' and 'negative' attributes. 00013 A MetaBall exerts a non-zero charge (aka influence) over a spherical 00014 region emanating from a single point, 'position', out to a maximum distance 00015 of 'radius'. 00016 00017 @param 00018 position - center of sphere defining region of influence 00019 @param 00020 radius - maximum extent of influence 00021 00022 @see also Blob 00023 @see also MetaObject 00024 <!-------------------------------------------------------------------->**/ 00025 00026 #ifndef META_BALL_H_ 00027 #define META_BALL_H_ 00028 00029 #include <shapes/MetaObject.h> 00030 00031 class MetaBall : public MetaObject { 00032 public: 00033 ///@name Constructors 00034 //@{----------------------------------------------------------------- 00035 00036 inline MetaBall(real_t strength = 1.0, bool negative = false, 00037 const Point3 &position = Point3(), 00038 real_t radius = 1.0) 00039 : MetaObject(strength, negative), 00040 m_position(position), m_radius(radius) 00041 { } 00042 00043 virtual ~MetaBall() 00044 { } 00045 00046 00047 //@}----------------------------------------------------------------- 00048 ///@name Core functionality 00049 //@{----------------------------------------------------------------- 00050 00051 /** 00052 * @brief 00053 * Performs any initialization which may be necessary before 00054 * calling getAABB or evaluate 00055 */ 00056 virtual void init(); 00057 00058 /** 00059 * @returns the bounding box of influence which bounds the range in 00060 * which this MetaBall may have a non-zero charge 00061 */ 00062 virtual AABB getAABB() const; 00063 00064 /** 00065 * @returns this MetaBall's charge at the given point 00066 * 00067 * @note 00068 * If the given point is outside of this MetaBall's AABB, 00069 * evaluate is assumed to return zero 00070 */ 00071 virtual real_t evaluate(const Point3 &pt) const; 00072 00073 00074 //@}----------------------------------------------------------------- 00075 ///@name Accessors / Mutators 00076 //@{----------------------------------------------------------------- 00077 00078 /// @returns the center of this MetaBall 00079 inline Point3 getPosition() const { 00080 return m_position; 00081 } 00082 00083 /// sets the initial charge of this object 00084 inline void setPosition(const Point3 &position) { 00085 m_position = position; 00086 } 00087 00088 /// @returns the radius of this MetaBall 00089 inline real_t getRadius() const { 00090 return m_radius; 00091 } 00092 00093 /// sets the radius of this MetaBall 00094 inline void setRadius(real_t radius) { 00095 m_radius = radius; 00096 } 00097 00098 00099 //@}----------------------------------------------------------------- 00100 00101 protected: 00102 AABB m_aabb; 00103 Point3 m_position; 00104 real_t m_radius; 00105 }; 00106 00107 #endif // META_BALL_H_ 00108
Generated on 28 Feb 2009 for Milton by
1.5.6