Class SphericalAgent2D<A extends SphericalAgent2D,​G extends AgentGrid2D<A>>

  • All Implemented Interfaces:

    public class SphericalAgent2D<A extends SphericalAgent2D,​G extends AgentGrid2D<A>>
    extends AgentPT2D<G>
    Spherical cow model of 2D cells
    See Also:
    Serialized Form
    • Field Detail

      • radius

        public double radius
      • xVel

        public double xVel
      • yVel

        public double yVel
    • Constructor Detail

      • SphericalAgent2D

        public SphericalAgent2D()
    • Method Detail

      • DefaultInit

        public void DefaultInit​(double radius)
        a default initialization function that sets the radius based on the argument, and the x and y velocities to 0
      • SumForces

        public double SumForces​(double interactionRad,
                                OverlapForceResponse2D<A> OverlapFun)
        The interactionRad argument is a double that specifies how far apart to check for other agent centers to interact with, and should be set to the maximum distance apart that two interacting agent centers can be. the OverlapForceResponse argument must be a function that takes in an overlap and an agent, and returns a force response. aka. (double,Agent) -> double. the double argument is the extent of the overlap. if this value is positive, then the two agents are “overlapping” by the distance specified. if the value is negative, then the two agents are separated by the distance specified. the OverlapForceResponse should return a double which indicates the force to apply to the agent as a result of the overlap. if the force is positive, it will repel the agent away from the overlap direction, if it is negative it will pull it towards that direction. SumForces alters the xVel and yVel properites of the agent by calling OverlapForceResponse using every other agent within the interactionRad.
      • SumForces

        public <T extends SphericalAgent2D> double SumForces​(java.util.ArrayList<T> neighbors,
                                                             java.util.ArrayList<double[]> displacementInfo,
                                                             OverlapForceResponse2D<T> OverlapFun)
      • SumForces

        public <T extends SphericalAgent2D> double SumForces​(double interactionRad,
                                                             AgentGrid2D<T> otherGrid,
                                                             OverlapForceResponse2D<T> OverlapFun,
                                                             Rand resolvePerfectOverlap)
        similar to the SumForces function above, but it can be used with other AgentGrids
      • ApplyFriction

        public void ApplyFriction​(double frictionConst)
        mulitplies xVel and yVel by frictionConst. if frictionConst = 1, then no friction force will be applied, if frictionConst = 0, then the cell won't move.
      • CapVelocity

        public void CapVelocity​(double maxVel)
        caps the xVel and yVel variables such that their norm is not greater than maxVel
      • ForceMove

        public void ForceMove()
        adds xVel and yVel property values to the x,y position of the agent.
      • Divide

        public A Divide​(double divRadius,
                        double[] scratchCoordArr,
                        Rand rn)
        Facilitiates modeling cell division. The divRadius specifies how far apart from the center of the parent agent the daughters should be separated. the scratchCoordArr will store the randomly calculated axis of division. The axis is calculated using the Rand argument (HAL's random number generator object) if no Rand argument is provided, the values currently in the scratchCoordArr will be used to determine the axis of division. The first entry of scratchCoordArr is the x component of the axis, the second entry is the y component. division is achieved by placing the newly generated daughter cell divRadius away from the parent cell using divCoordArr for the x and y components of the direction, and placing the parent divRadius away in the negative direction. Divide returns the newly created daughter cell.
      • Divide

        public A Divide​(double divRadius,
                        Rand rn)