From 0cae7874a4bc073d86a589f4ca8ef6e20fde7ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 26 Sep 2022 16:36:49 +0200 Subject: [PATCH] Math: clarify Intersection::lineSegment*() input requirements. The line segment direction length is crucial for knowing where the intersection happens so normalizing it beforehand will have unintended consequences. OTOH, in case of the second (non-segment) variant, the second parameter can but doesn't have to be normalized. --- src/Magnum/Math/Intersection.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Magnum/Math/Intersection.h b/src/Magnum/Math/Intersection.h index f65935fa9..26ef392d9 100644 --- a/src/Magnum/Math/Intersection.h +++ b/src/Magnum/Math/Intersection.h @@ -91,10 +91,10 @@ template inline bool pointSphere(const Vector3& point, const Vector3 /** @brief Intersection of two line segments in 2D -@param p Starting point of first line segment -@param r Direction of first line segment -@param q Starting point of second line segment -@param s Direction of second line segment +@param p Starting point of the first line segment +@param r Direction and length of the first line segment +@param q Starting point of the second line segment +@param s Direction and length of the second line segment Returns intersection point positions @f$ t @f$, @f$ u @f$ on both lines: @@ -136,10 +136,10 @@ template inline std::pair lineSegmentLineSegment(const Vector2 /** @brief Intersection of line segment and line in 2D -@param p Starting point of first line segment -@param r Direction of first line segment -@param q Starting point of second line -@param s Direction of second line +@param p Starting point of the first line segment +@param r Direction and length of first line segment +@param q Starting point of the second line +@param s Direction of the second line. Doesn't need to be normalized. Returns intersection point position @f$ t @f$ on the first line: @@ -162,7 +162,7 @@ template inline T lineSegmentLine(const Vector2& p, const Vector2 @brief Intersection of a plane and line @param plane Plane equation @param p Starting point of the line -@param r Direction of the line +@param r Direction of the line. Doesn't need to be normalized. Returns intersection point position @f$ t @f$ on the line: