# closestPointOnLine(line,point)

**Description:**

Returns the point on the line closest to the given point.

**Example:**

![image-20250912-105237.png](https://openbrim.atlassian.net/wiki/download/attachments/3295543313/image-20250912-105237.png?api=v2)

```
<O N="ClosestPoint" T="Group">
    <O N="myLine" T="Line" RZ="">
        <O T="Point" X="0" Y="0" Z="0" />
        <O T="Point" X="20" Y="0" Z="0" />
    </O>
    <O T="Circle" Radius="0.5" X="5" Y="-10" />
    <P N="mypt" V="[5,-16]" />
    <P N="line_Coords" V="toglobal(myLine)" />
    <P N="closest" V="closestPointOnLine(line_Coords,mypt)" />
    <O T="Circle" Radius="0.5" X="closest[0]" Y="closest[1]" />
    <P N="dist" V="linel([mypt,closest])" />
 </O>
```
