[geometry] Documentation

Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
mvglasow
2025-11-10 21:55:52 +02:00
parent 90fdf0ed72
commit 67a3866529

View File

@@ -9,17 +9,20 @@
namespace m2
{
// This class holds a parametrization of the
// line segment between two points p0 and p1.
// The parametrization is of the form
// p(t) = p0 + t * dir.
// Other conditions:
// dir is the normalized (p1 - p0) vector.
// length(dir) = 1.
// p(0) = p0.
// p(T) = p1 with T = length(p1 - p0).
//
// The points with t in [0, T] are the points of the segment.
/**
* @brief This class holds a parametrization of the line segment between two points `p0` and `p1`.
*
* The parametrization is of the form
* `p(t) = p0 + t * dir`.
*
* Other conditions:
* * `dir` is the normalized `(p1 - p0)` vector.
* * `length(dir) = 1`.
* * `p(0) = p0`.
* * `p(T) = p1` with `T = length(p1 - p0)`.
*
* The points with `t` in `[0, T]` are the points of the segment.
*/
template <typename Point>
class ParametrizedSegment
{
@@ -36,7 +39,9 @@ public:
m_d = m_d / m_length;
}
// Returns the squared (euclidean) distance from the segment to |p|.
/**
* @brief Returns the squared (euclidean) distance from the segment to `p`.
*/
double SquaredDistanceToPoint(Point const & p) const
{
m2::PointD const diff(p - m_p0);
@@ -52,7 +57,9 @@ public:
return math::Pow2(CrossProduct(diff, m_d));
}
// Returns the point of the segment that is closest to |p|.
/**
* @brief Returns the point of the segment that is closest to `p`.
*/
m2::PointD ClosestPointTo(Point const & p) const
{
m2::PointD const diff(p - m_p0);