Body2D.hpp
This file defines classes to represent bodies that exist on a 2D surface.
Each class should be able to:
Maintain a pointer to information about the full organism associated with this body.
provide a circular perimeter of the body (for phase1 of collision detection)
Provide body an anchor point and center point of the body (typically the same)
Currently, the only type of body we have is:
CircleBody2D - One individual circular object in the 2D world.
Development notes:
If we are going to have a lot of links, we may want a better data structure than vector.
-
class Body2D_Base
- #include <Body2D.hpp>
Subclassed by CircleBody2D
Public Functions
-
inline Body2D_Base()
-
inline virtual ~Body2D_Base()
-
inline double GetBirthTime() const
-
inline double GetMass() const
-
inline uint32_t GetColorID() const
-
inline bool IsReproducing() const
-
inline int GetReproCount() const
-
inline double GetPressure() const
-
inline bool GetDetachOnDivide() const
-
inline void SetBirthTime(double _in)
-
inline void SetMass(double _in)
-
inline void SetColorID(uint32_t _in)
-
inline void TurnLeft(int steps = 1)
-
inline void TurnRight(int steps = 1)
-
inline void RotateDegrees(double degrees)
-
inline void IncSpeed()
-
inline void DecSpeed()
-
inline void SetVelocity(double x, double y)
-
inline void SetDetachOnDivide(bool in = true)
Protected Types
-
inline Body2D_Base()
-
class CircleBody2D : public Body2D_Base
- #include <Body2D.hpp>
Public Functions
-
CircleBody2D() = delete
-
inline ~CircleBody2D()
-
inline double GetRadius() const
-
inline double GetTargetRadius() const
-
inline void SetRadius(double r)
-
inline void SetTargetRadius(double t)
-
inline bool IsLinkedFrom(const CircleBody2D &link_org) const
-
inline bool IsLinkedTo(const CircleBody2D &link_org) const
-
inline bool IsLinked(const CircleBody2D &link_org) const
-
inline size_t GetLinkCount() const
-
inline void AddLink(LINK_TYPE type, CircleBody2D &link_org, double cur_dist, double target_dist)
-
inline void RemoveLink(Ptr<BodyLink<CircleBody2D>> link)
-
inline const BodyLink<CircleBody2D> &FindLink(const CircleBody2D &link_org) const
-
inline BodyLink<CircleBody2D> &FindLink(CircleBody2D &link_org)
-
inline double GetLinkDist(const CircleBody2D &link_org) const
-
inline double GetTargetLinkDist(const CircleBody2D &link_org) const
-
inline void ShiftLinkDist(CircleBody2D &link_org, double change)
-
inline Ptr<CircleBody2D> BuildOffspring(Point offset)
-
inline void BodyUpdate(double change_factor = 1)
-
inline void ProcessStep(double friction = 0)
-
inline bool OK()
-
CircleBody2D() = delete