/***************************************************************************
*                                                                          *
*  Copyright (C) Golaem S.A.  All Rights Reserved.                         *
*                                                                          *
***************************************************************************/

#pragma once

#include "glmSDKAPI.h"
#include "glmPathDefinitions.h"
#include "glmSpatialEnvironment.h"
#include "glmNavigationMeshLocation.h"

//golaem core includes
#include <glmVector2.h>
#include <glmSegment2.h>
#include <glmAngle.h>
#include <glmAxisAlignedBox3.h>
#include <glmBox2.h>

//golaem core includes
#include <glmTypes.h>

namespace glm
{
	/**
	* \defgroup Utils Common utility functions.
	* \ingroup Navigation
	*/
	//@{

	/**
	* \brief Compute the collision time between a punctual mobile and a punctual obstacle.
	*
	* \param[inout] beginCollisionTime The time of the collision beginning (this value is updated if the compute collision time is smaller than the given time).
	* \param[inout] endCollisionTime The time of the collision ending (this value is updated if the compute collision time is greater than the given time).
	* \param[in] relativePosition The mobile position relative to the obstacle.
	* \param[in] relativeVelocity The mobile velocity relative to the obstacle.
	* \param[in] collisionDistance The distance under which the collision occurs.
	* \returns True if a collision occurs.
	*
	* \author Golaem <dev@golaem.com>
	*/
	bool GLM_SDK_API collisionsTime(
		float& beginCollisionTime, 
		float& endCollisionTime, 
		const Vector2 & relativePosition, 
		const Vector2 & relativeVelocity, 
		float collisionDistance);

	/**
	* \brief Compute the collision time between a punctual mobile and a segment obstacle.
	*
	* \param[inout] beginCollisionTime The time of the collision beginning (this value is updated if the compute collision time is smaller than the given time).
	* \param[inout] endCollisionTime The time of the collision ending (this value is updated if the compute collision time is greater than the given time).
	* \param[in] mobilePosition The mobile position.
	* \param[in] mobileVelocity The mobile velocity.
	* \param[in] obstacleSegment The obstacle segment.
	* \param[in] collisionDistance The distance under which the collision occurs.
	* \returns True if a collision occurs.
	*
	* \author Golaem <dev@golaem.com>
	*/
	bool GLM_SDK_API collisionsTime(
		float& beginCollisionTime, 
		float& endCollisionTime, 
		const Vector2 & mobilePosition, 
		const Vector2 & mobileVelocity, 
		const Segment2 & obstacleSegment, 
		float collisionDistance);

	/**
	* \brief Compute the time where the minimum distance between a punctual mobile and a punctual obstacle is reached.
	*
	* \param[out] time The computed time.
	* \param[in] relativePosition The mobile position relative to the obstacle.
	* \param[in] relativeVelocity The mobile velocity relative to the obstacle.
	* \returns False if the minimum distance time could not be computed, True otherwise.
	*
	* \author Golaem <dev@golaem.com>
	*/
	bool GLM_SDK_API minimumDistanceTime(
		float& time, 
		const Vector2& relativePosition, 
		const Vector2& relativeVelocity);
}
