Operator Reference

angle_lxangle_lxAngleLxAngleLxangle_lx (Operator)

angle_lxangle_lxAngleLxAngleLxangle_lx — Calculate the angle between one line and the horizontal axis.

Signature

angle_lx( : : Row1, Column1, Row2, Column2 : Angle)

Herror angle_lx(double Row1, double Column1, double Row2, double Column2, double* Angle)

Herror T_angle_lx(const Htuple Row1, const Htuple Column1, const Htuple Row2, const Htuple Column2, Htuple* Angle)

void AngleLx(const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2, HTuple* Angle)

static HTuple HMisc::AngleLx(const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2)

static double HMisc::AngleLx(double Row1, double Column1, double Row2, double Column2)

static void HOperatorSet.AngleLx(HTuple row1, HTuple column1, HTuple row2, HTuple column2, out HTuple angle)

static HTuple HMisc.AngleLx(HTuple row1, HTuple column1, HTuple row2, HTuple column2)

static double HMisc.AngleLx(double row1, double column1, double row2, double column2)

def angle_lx(row_1: MaybeSequence[Union[float, int]], column_1: MaybeSequence[Union[float, int]], row_2: MaybeSequence[Union[float, int]], column_2: MaybeSequence[Union[float, int]]) -> Sequence[float]

def angle_lx_s(row_1: MaybeSequence[Union[float, int]], column_1: MaybeSequence[Union[float, int]], row_2: MaybeSequence[Union[float, int]], column_2: MaybeSequence[Union[float, int]]) -> float

Description

The operator angle_lxangle_lxAngleLxAngleLxangle_lx calculates the angle between one line and the horizontal axis. As input the coordinates of two points on the line (Row1Row1Row1row1row_1,Column1Column1Column1column1column_1, Row2Row2Row2row2row_2,Column2Column2Column2column2column_2) are expected. The calculation is performed as follows: We interpret the line as a vector with starting point Row1Row1Row1row1row_1,Column1Column1Column1column1column_1 and end point Row2Row2Row2row2row_2,Column2Column2Column2column2column_2. The starting point is on the horizontal axis and defines the center of rotation in the following consideration. If the end point is above the horizontal axis, the angle (with positive sign) results from the rotation of the horizontal axis in counter clockwise direction onto the vector. If the end point is below the horizontal axis, the angle (with negative sign) results from the rotation of the horizontal axis in clockwise direction onto the vector. The result depends on the order of the two points defining the line. The parameter AngleAngleAngleangleangle returns the angle in radians, ranging from .

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 angles is always N.

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

Row1Row1Row1row1row_1 (input_control)  point.y(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate the first point of the line.

Column1Column1Column1column1column_1 (input_control)  point.x(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column coordinate of the first point of the line.

Row2Row2Row2row2row_2 (input_control)  point.y(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate of the second point of the line.

Column2Column2Column2column2column_2 (input_control)  point.x(-array) HTupleMaybeSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column coordinate of the second point of the line.

AngleAngleAngleangleangle (output_control)  angle.rad(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Angle between the line and the horizontal axis [rad].

Example (HDevelop)

dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
RowA1 := 255
ColumnA1 := 10
RowA2 := 255
ColumnA2 := 501
gen_contour_polygon_xld (Contour, [RowA1,RowA2], [ColumnA1,ColumnA2])
Row1 := 255
Column1 := 255
for I := 5 to 360 by 5
  Row2 := 255 - sin(rad(I)) * 200
  Column2 := 255 + cos(rad(I)) * 200
  gen_contour_polygon_xld (Contour, [Row1,Row2], [Column1,Column2])
  angle_lx (Row1, Column1, Row2, Column2, Angle)
  AngleDeg := deg(Angle)
endfor

Result

angle_lxangle_lxAngleLxAngleLxangle_lx returns 2 ( H_MSG_TRUE) .

Alternatives

angle_llangle_llAngleLlAngleLlangle_ll

Module

Foundation