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

#pragma once

#include "glmCoreAPI.h"

namespace glm
{
	class Segment2;
	class Vector2;

	/**
	* \brief Check if two 2D lines intersects and return the parameter of the intersection point on the second line.
	* \warning This functions consider that two coincident lines don't intersect.
	* \param[in] position1 A position on the first line.
	* \param[in] direction1 A direction vector of the first line (of any norm).
	* \param[in] position2 A position on the second line.
	* \param[in] direction2 A direction vector of the second line (of any norm).
	* \param[out] param2 The scalar parameter such as the intersection point (if it exists) is \p param2 * \p direction2 + \p position2.
	* \return True if the two lines intersect.
	*/
	bool GLM_CORE_API intersection(const Vector2& position1, const Vector2& direction1, const Vector2& position2, const Vector2& direction2, float& param2);

	/**
	* \brief Check if two 2D lines intersects and return both the parameter of the intersection point on the first line and on the second line.
	* \param[in] position1 A position on the first line.
	* \param[in] direction1 A direction vector of the first line (of any norm).
	* \param[out] param1 The scalar parameter such as the intersection point (if it exists) is \p param1 * \p direction1 + \p position1.
	* \param[in] position2 A position on the second line.
	* \param[in] direction2 A direction vector of the second line (of any norm).
	* \param[out] param2 The scalar parameter such as the intersection point (if it exists) is \p param2 * \p direction2 + \p position2.
	* \return True if the two lines intersect or are coincident.
	*/
	bool GLM_CORE_API intersection(const Vector2& position1, const Vector2& direction1, float& param1, const Vector2& position2, const Vector2& direction2, float& param2);

	/**
	* \brief Check if two 2D line segments intersects.
	* \param[in] segment1 The first line segment.
	* \param[in] segment2 The second line segment.
	* \return The LineIntersection value defining the intersection of the two line segments.
	* \return True if the two line segment intersect or overlap.
	*/
	bool GLM_CORE_API intersection(const Segment2& segment1, const Segment2& segment2);
}
