Herror ::distance_pl (
    const HTuple &Row,
    const HTuple &Column,
    const HTuple &Row1,
    const HTuple &Column1,
    const HTuple &Row2,
    const HTuple &Column2,
    double *Distance
)
Herror ::distance_pl (
    const HTuple &Row,
    const HTuple &Column,
    const HTuple &Row1,
    const HTuple &Column1,
    const HTuple &Row2,
    const HTuple &Column2,
    HTuple *Distance
)

Calculate the distance between one point and one line.

The operator ::distance_pl calculates the orthogonal distance between a point (Row,Column) and a line, given by two arbitrary points of the line. The result is passed in Distance.


Parameters

Row (input_control)
point.y(-array) -> HTuple.double / long
Row of the point.

Column (input_control)
point.x(-array) -> HTuple.double / long
Column of the point.

Row1 (input_control)
point.y(-array) -> HTuple.double / long
Row of the first point of the line.

Column1 (input_control)
point.x(-array) -> HTuple.double / long
Column of the first point of the line.

Row2 (input_control)
point.y(-array) -> HTuple.double / long
Row of the second point of the line.

Column2 (input_control)
point.x(-array) -> HTuple.double / long
Column of the second point of the line.

Distance (output_control)
number(-array) -> (HTuple.) double *
Distance between the points


Example
read_image (Image, 'mreut')
dev_open_window (0, 0, 512, 512, 'white', WindowHandle)
dev_display (Image)
dev_set_color ('black')
threshold (Image, Region, 180, 255)
dev_clear_window ()
dev_display (Region)
connection (Region, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, 'area', 'and',
              10000, 100000000)
get_region_contour (SelectedRegions, Rows, Columns)
RowLine1 := 5
ColLine1 := 300
RowLine2 := 300
ColLine2 := 400
NumberTuple := |Rows|
dev_set_color ('red')
disp_line (WindowHandle, RowLine1, ColLine1, RowLine2, ColLine2)
dev_set_color ('green')
for i := 1 to NumberTuple by 5
  disp_line (WindowHandle, Rows[i], Columns[i]-2, Rows[i], Columns[i]+2)
  disp_line (WindowHandle, Rows[i]-2, Columns[i], Rows[i]+2, Columns[i])
  distance_pl (Rows[i], Columns[i], RowLine1, ColLine1,
               RowLine2, ColLine2, Distance)
endfor

Result

::distance_pl returns H_MSG_TRUE.


Alternatives

::distance_ps


See also

::distance_pp, ::distance_pr


Module

Basic operators



Copyright © 1996-2002 MVTec Software GmbH