ClassesClassesClassesClasses | | | | Operators

distance_psdistance_psDistancePsdistance_psDistancePsDistancePs (Operator)

Name

distance_psdistance_psDistancePsdistance_psDistancePsDistancePs — Calculate the distances between a point and a line segment.

Signature

distance_ps( : : Row, Column, Row1, Column1, Row2, Column2 : DistanceMin, DistanceMax)

Herror distance_ps(double Row, double Column, double Row1, double Column1, double Row2, double Column2, double* DistanceMin, double* DistanceMax)

Herror T_distance_ps(const Htuple Row, const Htuple Column, const Htuple Row1, const Htuple Column1, const Htuple Row2, const Htuple Column2, Htuple* DistanceMin, Htuple* DistanceMax)

Herror distance_ps(const HTuple& Row, const HTuple& Column, const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2, double* DistanceMin, double* DistanceMax)

Herror distance_ps(const HTuple& Row, const HTuple& Column, const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2, HTuple* DistanceMin, HTuple* DistanceMax)

void DistancePs(const HTuple& Row, const HTuple& Column, const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2, HTuple* DistanceMin, HTuple* DistanceMax)

static void HMisc::DistancePs(const HTuple& Row, const HTuple& Column, const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2, HTuple* DistanceMin, HTuple* DistanceMax)

static void HMisc::DistancePs(double Row, double Column, double Row1, double Column1, double Row2, double Column2, double* DistanceMin, double* DistanceMax)

void HOperatorSetX.DistancePs(
[in] VARIANT Row, [in] VARIANT Column, [in] VARIANT Row1, [in] VARIANT Column1, [in] VARIANT Row2, [in] VARIANT Column2, [out] VARIANT* DistanceMin, [out] VARIANT* DistanceMax)

VARIANT HMiscX.DistancePs(
[in] VARIANT Row, [in] VARIANT Column, [in] VARIANT Row1, [in] VARIANT Column1, [in] VARIANT Row2, [in] VARIANT Column2, [out] VARIANT* DistanceMax)

static void HOperatorSet.DistancePs(HTuple row, HTuple column, HTuple row1, HTuple column1, HTuple row2, HTuple column2, out HTuple distanceMin, out HTuple distanceMax)

static void HMisc.DistancePs(HTuple row, HTuple column, HTuple row1, HTuple column1, HTuple row2, HTuple column2, out HTuple distanceMin, out HTuple distanceMax)

static void HMisc.DistancePs(double row, double column, double row1, double column1, double row2, double column2, out double distanceMin, out double distanceMax)

Description

The operator distance_psdistance_psDistancePsdistance_psDistancePsDistancePs calculates the minimum and maximum distance between a point (RowRowRowRowRowrow,ColumnColumnColumnColumnColumncolumn) and a line segment which is represented by the start point (Row1Row1Row1Row1Row1row1,Column1Column1Column1Column1Column1column1) and the end point (Row2Row2Row2Row2Row2row2,Column2Column2Column2Column2Column2column2). DistanceMaxDistanceMaxDistanceMaxDistanceMaxDistanceMaxdistanceMax is the maximum distance between the point and the end points of the line segment. DistanceMinDistanceMinDistanceMinDistanceMinDistanceMindistanceMin is identical to distance_pldistance_plDistancePldistance_plDistancePlDistancePl in the case that the point is “between” the two endpoints. Otherwise, the minimum distance to one of the end points is used.

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 first point.

ColumnColumnColumnColumnColumncolumn (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.

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 segment.

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 segment.

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 segment.

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 segment.

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

Minimum distance between the point and the line segment.

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

Maximum distance between the point and the line segment.

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 := 400
ColLine1 := 50
RowLine2 := 50
ColLine2 := 450
NumberTuple := |Rows|
dev_set_color ('red')
disp_line (WindowHandle, RowLine1, ColLine1, RowLine2, ColLine2)
dev_set_color ('green')
for i := 1 to NumberTuple by 10
  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_ps (Rows[i], Columns[i], RowLine1, ColLine1, RowLine2, ColLine2, \
               DistanceMin, DistanceMax)
endfor

Example (C)

double row,column,row1,column1,row2,column2;
double distance_min,distance_max;

distance_ps(row,column,row1,column1,row2,column2,
            &distance_min,&distance_max);

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 := 400
ColLine1 := 50
RowLine2 := 50
ColLine2 := 450
NumberTuple := |Rows|
dev_set_color ('red')
disp_line (WindowHandle, RowLine1, ColLine1, RowLine2, ColLine2)
dev_set_color ('green')
for i := 1 to NumberTuple by 10
  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_ps (Rows[i], Columns[i], RowLine1, ColLine1, RowLine2, ColLine2, \
               DistanceMin, DistanceMax)
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 := 400
ColLine1 := 50
RowLine2 := 50
ColLine2 := 450
NumberTuple := |Rows|
dev_set_color ('red')
disp_line (WindowHandle, RowLine1, ColLine1, RowLine2, ColLine2)
dev_set_color ('green')
for i := 1 to NumberTuple by 10
  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_ps (Rows[i], Columns[i], RowLine1, ColLine1, RowLine2, ColLine2, \
               DistanceMin, DistanceMax)
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 := 400
ColLine1 := 50
RowLine2 := 50
ColLine2 := 450
NumberTuple := |Rows|
dev_set_color ('red')
disp_line (WindowHandle, RowLine1, ColLine1, RowLine2, ColLine2)
dev_set_color ('green')
for i := 1 to NumberTuple by 10
  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_ps (Rows[i], Columns[i], RowLine1, ColLine1, RowLine2, ColLine2, \
               DistanceMin, DistanceMax)
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 := 400
ColLine1 := 50
RowLine2 := 50
ColLine2 := 450
NumberTuple := |Rows|
dev_set_color ('red')
disp_line (WindowHandle, RowLine1, ColLine1, RowLine2, ColLine2)
dev_set_color ('green')
for i := 1 to NumberTuple by 10
  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_ps (Rows[i], Columns[i], RowLine1, ColLine1, RowLine2, ColLine2, \
               DistanceMin, DistanceMax)
endfor

Result

distance_psdistance_psDistancePsdistance_psDistancePsDistancePs returns 2 (H_MSG_TRUE).

Alternatives

distance_pldistance_plDistancePldistance_plDistancePlDistancePl

See also

distance_ppdistance_ppDistancePpdistance_ppDistancePpDistancePp, distance_prdistance_prDistancePrdistance_prDistancePrDistancePr

Module

Foundation


ClassesClassesClassesClasses | | | | Operators