angle_lxangle_lxAngleLxAngleLx (Operator)

Name

angle_lxangle_lxAngleLxAngleLx — 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)

Description

The operator angle_lxangle_lxAngleLxAngleLxAngleLx calculates the angle between one line and the horizontal axis. As input the coordinates of two points on the line (Row1Row1Row1Row1row1,Column1Column1Column1Column1column1, Row2Row2Row2Row2row2,Column2Column2Column2Column2column2) are expected. The calculation is performed as follows: We interprete the line as a vector with starting point Row1Row1Row1Row1row1,Column1Column1Column1Column1column1 and end point Row2Row2Row2Row2row2,Column2Column2Column2Column2column2. 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 .

Execution Information

Parameters

Row1Row1Row1Row1row1 (input_control)  point.y(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate the first point of the line.

Column1Column1Column1Column1column1 (input_control)  point.x(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column coordinate of the first point of the line.

Row2Row2Row2Row2row2 (input_control)  point.y(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate of the second point of the line.

Column2Column2Column2Column2column2 (input_control)  point.x(-array) HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column coordinate of the second point of the line.

AngleAngleAngleAngleangle (output_control)  angle.rad(-array) HTupleHTupleHtuple (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_lxAngleLxAngleLxAngleLx returns 2 (H_MSG_TRUE).

Alternatives

angle_llangle_llAngleLlAngleLlAngleLl

Module

Foundation