Welcome to the L3 Harris Geospatial documentation center. Here you will find reference guides and help documents.
﻿
>  Docs Center  >  IDL Reference  >  Math - Miscellaneous  >  PNT_LINE

### PNT_LINE

PNT_LINE

The PNT_LINE function computes the perpendicular distance between a point P0 and a line between points L0 and L1. This function is limited by the machine accuracy of single precision floating point.

This routine is written in the IDL language. Its source code can be found in the file pnt_line.pro in the lib subdirectory of the IDL distribution.

## Examples

To print the distance between the point (2,3) and the line from (-3,3) to (5,12), and also the location of the point on the line closest to (2,3), enter the following command:

`PRINT, PNT_LINE([2,3], [-3,3], [5,12], Pl), Pl`

IDL prints:

`3.73705    -0.793104      5.48276`

## Syntax

Result = PNT_LINE( P0, L0, L1 [, Pl] [, /INTERVAL] )

## Return Value

Returns the perpendicular distance.

## Arguments

### P0

The location of the point. P0 may have 2 to n elements, for n dimensions.

### L0

One end-point of the line. L0 must have same number of elements as P0.

### L1

The other end-point of the line. L1 must have the same number of elements as L0.

### Pl

A named variable that will contain the location of the point on the line between L0 and L1 that is closest to P0. Pl is not necessarily in the interval (L0, L1).

## Keywords

### INTERVAL

If set, and if the point on the line between L0 and L1 that is closest to P0 is not within the interval (L0, L1), PNT_LINE will return the distance from P0 to the closer of the two endpoints L0 and L1.

## Version History

 Pre-4.0 Introduced