Example #1
0
  /**
   * \brief For self-attachment scenarios, calculates the new position of the agent based on XY and
   * XZ angles and a distance to move
   *
   * <p>For self-attachment scenarios, calculates the new position of the agent based on XY and XZ
   * angles and a distance to move. No return value as the global swimmingAgentPosition is altered.
   * The angles XY and XZ are also global parameters as these can also be altered by other methods
   * in the swimming agent position checks
   *
   * @param distanceAgentMoves Distance that the agent is to move
   */
  public void calculateNewAgentPosition(Double distanceAgentMoves) {
    // Now calculate where this angle would place the agent.
    swimMovement.set(
        Math.cos(angleOfMovingAgentXY) * Math.cos(angleOfMovingAgentXZ),
        Math.sin(angleOfMovingAgentXY),
        Math.sin(angleOfMovingAgentXZ));

    swimMovement.times(distanceAgentMoves);

    swimmingAgentPosition.add(swimMovement);
  }