ClassesClassesClassesClasses | | | | Operators

distance_pldistance_plDistancePldistance_plDistancePlDistancePl (Operator)

Name

distance_pldistance_plDistancePldistance_plDistancePlDistancePl — Calculate the distance between one point and one line.

Signature

distance_pl( : : Row, Column, Row1, Column1, Row2, Column2 : Distance)

Herror distance_pl(double Row, double Column, double Row1, double Column1, double Row2, double Column2, double* Distance)

Herror T_distance_pl(const Htuple Row, const Htuple Column, const Htuple Row1, const Htuple Column1, const Htuple Row2, const Htuple Column2, Htuple* Distance)

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)

void DistancePl(const HTuple& Row, const HTuple& Column, const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2, HTuple* Distance)

static HTuple HMisc::DistancePl(const HTuple& Row, const HTuple& Column, const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2)

static double HMisc::DistancePl(double Row, double Column, double Row1, double Column1, double Row2, double Column2)

void HOperatorSetX.DistancePl(
[in] VARIANT Row, [in] VARIANT Column, [in] VARIANT Row1, [in] VARIANT Column1, [in] VARIANT Row2, [in] VARIANT Column2, [out] VARIANT* Distance)

VARIANT HMiscX.DistancePl(
[in] VARIANT Row, [in] VARIANT Column, [in] VARIANT Row1, [in] VARIANT Column1, [in] VARIANT Row2, [in] VARIANT Column2)

static void HOperatorSet.DistancePl(HTuple row, HTuple column, HTuple row1, HTuple column1, HTuple row2, HTuple column2, out HTuple distance)

static HTuple HMisc.DistancePl(HTuple row, HTuple column, HTuple row1, HTuple column1, HTuple row2, HTuple column2)

static double HMisc.DistancePl(double row, double column, double row1, double column1, double row2, double column2)

Description

The operator distance_pldistance_plDistancePldistance_plDistancePlDistancePl calculates the orthogonal distance between points (RowRowRowRowRowrow,ColumnColumnColumnColumnColumncolumn) and lines, given by two arbitrary points on the line. The result is passed in DistanceDistanceDistanceDistanceDistancedistance.

distance_pldistance_plDistancePldistance_plDistancePlDistancePl calculates the distances between a set of n points and one line as well as the distances between a set of n points and n lines.

Parallelization

Parameters

RowRowRowRowRowrow (input_control)  point.y(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Row coordinate of the point.

ColumnColumnColumnColumnColumncolumn (input_control)  point.x(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Column of the point.

Row1Row1Row1Row1Row1row1 (input_control)  point.y(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Row coordinate of the first point of the line.

Column1Column1Column1Column1Column1column1 (input_control)  point.x(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Column coordinate of the first point of the line.

Row2Row2Row2Row2Row2row2 (input_control)  point.y(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Row coordinate of the second point of the line.

Column2Column2Column2Column2Column2column2 (input_control)  point.x(-array) HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Column coordinate of the second point of the line.

DistanceDistanceDistanceDistanceDistancedistance (output_control)  real(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Distance between the points.

Example (HDevelop)

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

Example (C)

double row,column,row1,column1,row2,column2,distance;

draw_point(WindowHandle,&row,&column);
draw_line(WindowHandle,&row1,&column1,&row2,&column2);
distance_pl(row,column,row1,column1,row2,column2,&distance);

Example (HDevelop)

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

Example (HDevelop)

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

Example (HDevelop)

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

Example (HDevelop)

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_pldistance_plDistancePldistance_plDistancePlDistancePl returns 2 (H_MSG_TRUE).

Alternatives

distance_psdistance_psDistancePsdistance_psDistancePsDistancePs

See also

distance_ppdistance_ppDistancePpdistance_ppDistancePpDistancePp, distance_prdistance_prDistancePrdistance_prDistancePrDistancePr

Module

Foundation


ClassesClassesClassesClasses | | | | Operators