MetaObject.h

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @class  MetaObject
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.  'strength' defines the initial charge 
00013    of the object, and 'negative' is a boolean which defaults to false, denoting 
00014    whether or not this MetaObject has a positive or a negative impact on 
00015    surrounding MetaObjects.  MetaObject is an abstract class, and specific 
00016    implementations define how its initial charge dissipates throughout the 
00017    field.
00018    
00019    @param
00020       strength - initial charge of object (defaults to 1.0)
00021    @param
00022       negative - whether or not this metaobject has a positive or negative 
00023    impact on surrounding MetaObjects (defaults to false)
00024    
00025    @see also Blob
00026    @see also MetaBall
00027    <!-------------------------------------------------------------------->**/
00028 
00029 #ifndef META_OBJECT_H_
00030 #define META_OBJECT_H_
00031 
00032 #include <shapes/ScalarField.h>
00033 #include <utils/PropertyMap.h>
00034 #include <accel/AABB.h>
00035 
00036 class MetaObject : public ScalarField, public PropertyMap {
00037    public:
00038       ///@name Constructors
00039       //@{-----------------------------------------------------------------
00040       
00041       inline MetaObject(real_t strength = 1.0, bool negative = false)
00042          : ScalarField(), PropertyMap(), 
00043            m_strength(strength), m_isNegative(negative)
00044       { }
00045       
00046       virtual ~MetaObject()
00047       { }
00048       
00049       
00050       //@}-----------------------------------------------------------------
00051       ///@name Core functionality
00052       //@{-----------------------------------------------------------------
00053       
00054       /**
00055        * @brief
00056        *    Performs any initialization which may be necessary before 
00057        * calling getAABB or evaluate
00058        * 
00059        * @note
00060        *    Implementations will likely want to precompute their AABB in 
00061        * init and store it for later since getAABB may be called often
00062        * 
00063        * @note
00064        *    Default implementation synchs parameters from PropertyMap
00065        */
00066       virtual void init();
00067       
00068       /**
00069        * @returns the bounding box of influence which bounds the range in 
00070        *    which this MetaObject may have a non-zero charge
00071        */
00072       virtual AABB getAABB() const = 0;
00073       
00074       /**
00075        * @returns this MetaObject's charge at the given point
00076        * 
00077        * @note
00078        *    If the given point is outside of this MetaObject's AABB, 
00079        * evaluate is assumed to return zero
00080        */
00081       virtual real_t evaluate(const Point3 &pt) const = 0;
00082       
00083       
00084       //@}-----------------------------------------------------------------
00085       ///@name Accessors / Mutators
00086       //@{-----------------------------------------------------------------
00087       
00088       /// @returns the initial charge of this object
00089       inline real_t getStrength() const {
00090          return m_strength;
00091       }
00092       
00093       /// sets the initial charge of this object
00094       inline void setStrength(real_t strength) {
00095          m_strength = strength;
00096       }
00097       
00098       /// @returns whether or not this MetaObject has a positive or negative 
00099       ///    influence on surrounding MetaObjects
00100       inline bool   isNegative() const {
00101          return m_isNegative;
00102       }
00103       
00104       /// sets whether or not this MetaObject has a positive or negative 
00105       ///    influence on surrounding MetaObjects
00106       inline void setIsNegative(bool negative) {
00107          m_isNegative = negative;
00108       }
00109       
00110       
00111       //@}-----------------------------------------------------------------
00112       
00113    protected:
00114       real_t m_strength;
00115       bool   m_isNegative;
00116 };
00117 
00118 #endif // META_OBJECT_H_
00119 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6