//Constructor called when a cell is created in the begining of the program
 public ForwardInternals(float x, float z, float v, float dT, float angle, ICellRegulation regulator, int iterations) :
     this(v, dT, angle, regulator, iterations)
 {
     //add the initial values to the arrays
     positions[0] = new Vector3Adapter(x, z);
     AddState(0);
     birthDate = 0;
 }
    //Simulates a single step of movement public since this might be usefull to call from the outside for the dynmaic environment
    public void SimulateMovementStep(int step)
    {
        if (step < 1 || step > iterations)
        {
            throw new IncorrectSimulationStepException(step);
        }

        if (deathDate <= step || positions[step] != null) //check if cell is dead or already handled in a previous timestep
        {
            return;
        }

        float c = model.environment.GetConcentration(positions[step - 1].GetX(), positions[step - 1].GetZ(), step - 1);

        if (lifeRegulator.Die(c)) //check if the cell should die and kill it if that is the case
        {
            deathDate = step;
            model.KillCell(step, parentObject);
            State deathState = new State();
            for (int i = step; i <= iterations; i++) //set the remaining positions and states to the current one
            {
                positions[i]    = positions[step - 1];
                states[i]       = deathState;
                states[i].death = 1;
            }

            return;
        }
        else if (lifeRegulator.Split(c)) //check if the cell should split and split the cell if that is the case
        {
            Split(step);
        }

        positions[step] = new Vector3Adapter(positions[step - 1].GetX(), positions[step - 1].GetZ());
        if (!regulator.DecideState(c)) //tumble
        {
            angle = CalculateTumbleAngle();
            AddState(step);
            step++;
            if (step == positions.Length)
            {
                return;
            }
            positions[step] = positions[step - 1].Copy();
        }

        CalculateNextLocation(positions[step]);
        AddState(step);
    }