Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 3, 2011, 9:46:30 PM (13 years ago)
Author:
youngk
Message:

Added Newtonian Gravitation to the selection of force fields.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/objects/ForceField.h

    r7801 r8397  
    2424 *   Co-authors:
    2525 *      Damian 'Mozork' Frick
     26 *      Kevin Young
    2627 *
    2728 */
     
    5556            tube, //!< The ForceField has a tube shape.
    5657            sphere, //!< The ForceField has a spherical shape.
    57             invertedSphere //!< The ForceField has a spherical shape but "inverted" behavior.
     58            invertedSphere, //!< The ForceField has a spherical shape but "inverted" behavior.
     59            newtonianGravity //!< The ForceField imitates Newtonian gravitation for use in stellar bodies.
    5860        };
    5961    }
     
    106108
    107109            /**
    108             @brief Set the diameter of the ForceField.
     110            @brief Set the diameter of the ForceField. In mode StellarBody this stands for the outer radius.
    109111            @param diam The diameter to be set.
    110112            */
     
    112114                { this->radius_ = diam/2; }
    113115            /**
    114             @brief Get the diameter of the ForceField.
     116            @brief Get the diameter of the ForceField. In mode StellarBody this stands for the outer radius.
    115117            @return Returns the diameter of the ForceField.
    116118            */
    117119            inline float getDiameter()
    118120                { return this->radius_*2; }
     121       
     122            /**
     123            @brief Set the diameter of the stellar body for the Newtonian ForceField.
     124            @param massDiam The diameter of the stellar body.
     125            */
     126            inline void setMassDiameter(float massDiam)
     127                { this->massRadius_ = massDiam/2; }
     128       
     129            /**
     130            @brief Get the diameter of the stellar body for the Newtonian ForceField.
     131            @return float Returns the diameter of the stellar body.
     132            */
     133            inline float getMassDiameter()
     134                { return this->massRadius_*2; }
    119135
    120136            /**
     
    139155            static const std::string modeSphere_s;
    140156            static const std::string modeInvertedSphere_s;
     157            static const std::string modeNewtonianGravity_s;
    141158
    142159            float velocity_; //!< The velocity of the ForceField.
    143160            float radius_; //!< The radius of the ForceField.
     161            float massRadius_; //!< The radius of the stellar body for the Newtonian ForceField.
    144162            float halfLength_; //!< Half of the length of the ForceField.
    145163            int mode_; //!< The mode of the ForceField.
     164           
     165            //! Gravitational constant for Newtonian ForceFields.
     166            static const float gravConstant_;
     167            //! Attenuation factor for Newtonian ForceFields
     168            static const float attenFactor_;
    146169  };
    147170}
Note: See TracChangeset for help on using the changeset viewer.