Skip to content

distance_psDistancePsDistancePsdistance_psdistance_psπŸ”—

Short descriptionπŸ”—

distance_psDistancePsDistancePsdistance_psdistance_ps β€” Calculate the distances between a point and a line segment.

SignatureπŸ”—

distance_ps( point.y Row, point.x Column, point.y Row1, point.x Column1, point.y Row2, point.x Column2, out real DistanceMin, out real 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 HOperatorSet.DistancePs( HTuple row, HTuple column, HTuple row1, HTuple column1, HTuple row2, HTuple column2, out HTuple distanceMin, out HTuple distanceMax )def distance_ps( row: MaybeSequence[Union[float, int]], column: MaybeSequence[Union[float, int]], row_1: MaybeSequence[Union[float, int]], column_1: MaybeSequence[Union[float, int]], row_2: MaybeSequence[Union[float, int]], column_2: MaybeSequence[Union[float, int]] ) -> Tuple[Sequence[float], Sequence[float]]

def distance_ps_s( row: MaybeSequence[Union[float, int]], column: MaybeSequence[Union[float, int]], row_1: MaybeSequence[Union[float, int]], column_1: MaybeSequence[Union[float, int]], row_2: MaybeSequence[Union[float, int]], column_2: MaybeSequence[Union[float, int]] ) -> Tuple[float, float]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 )

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 )

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_psDistancePs calculates the minimum and maximum distance between a point (Rowrowrow,Columncolumncolumn) and a line segment which is represented by the start point (Row1row1row_1,Column1column1column_1) and the end point (Row2row2row_2,Column2column2column_2). DistanceMaxdistanceMaxdistance_max is the maximum distance between the point and the end points of the line segment. DistanceMindistanceMindistance_min is identical to distance_plDistancePl in the case that the point is β€œbetween” the two endpoints. Otherwise, the minimum distance to one of the end points is used.

Parameter BroadcastingπŸ”—

This operator supports parameter broadcasting. This means that each parameter can be given as a tuple of length 1 or N. Parameters with tuple length 1 will be repeated internally such that the number of computed distances is always N.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on internal data level.

ParametersπŸ”—

Rowrowrow (input_control) point.y(-array) β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[float, int]]Htuple (double / Hlong)

Row coordinate of the first point.

Columncolumncolumn (input_control) point.x(-array) β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[float, int]]Htuple (double / Hlong)

Column coordinate of the first point.

Row1row1row_1 (input_control) point.y(-array) β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[float, int]]Htuple (double / Hlong)

Row coordinate of the first point of the line segment.

Column1column1column_1 (input_control) point.x(-array) β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[float, int]]Htuple (double / Hlong)

Column coordinate of the first point of the line segment.

Row2row2row_2 (input_control) point.y(-array) β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[float, int]]Htuple (double / Hlong)

Row coordinate of the second point of the line segment.

Column2column2column_2 (input_control) point.x(-array) β†’ (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[float, int]]Htuple (double / Hlong)

Column coordinate of the second point of the line segment.

DistanceMindistanceMindistance_min (output_control) real(-array) β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Minimum distance between the point and the line segment.

DistanceMaxdistanceMaxdistance_max (output_control) real(-array) β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Maximum distance between the point and the line segment.

ExampleπŸ”—

(HDevelop)


dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
draw_point (WindowHandle, Row, Column)
gen_cross_contour_xld (Cross, Row, Column, 15, 0)
draw_line (WindowHandle, Row1, Column1, Row2, Column2)
gen_contour_polygon_xld (Contour, [Row1,Row2], [Column1,Column2])
distance_ps (Row, Column, Row1, Column1, Row2, Column2, \
             DistanceMin, DistanceMax)
(C)
double row,column,row1,column1,row2,column2\;
double distance_min,distance_max\;

draw_point(WindowHandle,&row,&column)\;
draw_line(WindowHandle,&row1,&column1,&row2,&column2)\;
distance_pl(row,column,row1,column1,row2,column2,
            &distance_min,&distance_max)\;

ResultπŸ”—

distance_psDistancePs returns 2 (H_MSG_TRUE).

Combinations with other operatorsπŸ”—

Combinations

Alternatives

distance_plDistancePl

See also

distance_ppDistancePp, distance_prDistancePr

ModuleπŸ”—

Foundation