# How to understand distPointLine function in FastLineDetectorImpl

**URL:** <https://forum.opencv.org/t/how-to-understand-distpointline-function-in-fastlinedetectorimpl/19013>\
**Category:** C++\
**Tags:** ximgproc\
**Created:** [October 19, 2024, 4:03am UTC](https://forum.opencv.org/t/how-to-understand-distpointline-function-in-fastlinedetectorimpl/19013 "2024-10-19T04:03:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cvInterest](https://avatars.discourse-cdn.com/v4/letter/c/45deac/32.png) [@cvInterest](https://forum.opencv.org/u/cvInterest)\
**Post date:** [October 19, 2024, 4:03am UTC](https://forum.opencv.org/t/how-to-understand-distpointline-function-in-fastlinedetectorimpl/19013/1 "2024-10-19T04:03:23Z")

</div>

this function get the distance from point to line , i can not understand the calculate method it use.

```auto
double FastLineDetectorImpl::distPointLine(const Mat& p, Mat& l)
{
    double x = l.at<double>(0,0);
    double y = l.at<double>(1,0);
    double w = sqrt(x*x+y*y);

    l.at<double>(0,0) = x / w;
    l.at<double>(1,0) = y / w;
    l.at<double>(2,0) = l.at<double>(2,0) / w;

    return l.dot(p);
}

```
