angle_llangle_llAngleLlAngleLlangle_ll (Operator)

Name

angle_llangle_llAngleLlAngleLlangle_ll — Calculate the angle between two lines.

Signature

angle_ll( : : RowA1, ColumnA1, RowA2, ColumnA2, RowB1, ColumnB1, RowB2, ColumnB2 : Angle)

Herror angle_ll(double RowA1, double ColumnA1, double RowA2, double ColumnA2, double RowB1, double ColumnB1, double RowB2, double ColumnB2, double* Angle)

Herror T_angle_ll(const Htuple RowA1, const Htuple ColumnA1, const Htuple RowA2, const Htuple ColumnA2, const Htuple RowB1, const Htuple ColumnB1, const Htuple RowB2, const Htuple ColumnB2, Htuple* Angle)

void AngleLl(const HTuple& RowA1, const HTuple& ColumnA1, const HTuple& RowA2, const HTuple& ColumnA2, const HTuple& RowB1, const HTuple& ColumnB1, const HTuple& RowB2, const HTuple& ColumnB2, HTuple* Angle)

static HTuple HMisc::AngleLl(const HTuple& RowA1, const HTuple& ColumnA1, const HTuple& RowA2, const HTuple& ColumnA2, const HTuple& RowB1, const HTuple& ColumnB1, const HTuple& RowB2, const HTuple& ColumnB2)

static double HMisc::AngleLl(double RowA1, double ColumnA1, double RowA2, double ColumnA2, double RowB1, double ColumnB1, double RowB2, double ColumnB2)

static void HOperatorSet.AngleLl(HTuple rowA1, HTuple columnA1, HTuple rowA2, HTuple columnA2, HTuple rowB1, HTuple columnB1, HTuple rowB2, HTuple columnB2, out HTuple angle)

static HTuple HMisc.AngleLl(HTuple rowA1, HTuple columnA1, HTuple rowA2, HTuple columnA2, HTuple rowB1, HTuple columnB1, HTuple rowB2, HTuple columnB2)

static double HMisc.AngleLl(double rowA1, double columnA1, double rowA2, double columnA2, double rowB1, double columnB1, double rowB2, double columnB2)

def angle_ll(row_a1: MaybeSequence[Union[float, int]], column_a1: MaybeSequence[Union[float, int]], row_a2: MaybeSequence[Union[float, int]], column_a2: MaybeSequence[Union[float, int]], row_b1: MaybeSequence[Union[float, int]], column_b1: MaybeSequence[Union[float, int]], row_b2: MaybeSequence[Union[float, int]], column_b2: MaybeSequence[Union[float, int]]) -> Sequence[float]

def angle_ll_s(row_a1: MaybeSequence[Union[float, int]], column_a1: MaybeSequence[Union[float, int]], row_a2: MaybeSequence[Union[float, int]], column_a2: MaybeSequence[Union[float, int]], row_b1: MaybeSequence[Union[float, int]], column_b1: MaybeSequence[Union[float, int]], row_b2: MaybeSequence[Union[float, int]], column_b2: MaybeSequence[Union[float, int]]) -> float

Description

The operator angle_llangle_llAngleLlAngleLlAngleLlangle_ll calculates the angle between two lines. As input the coordinates of two points on the first line (RowA1RowA1RowA1RowA1rowA1row_a1,ColumnA1ColumnA1ColumnA1ColumnA1columnA1column_a1, RowA2RowA2RowA2RowA2rowA2row_a2,ColumnA2ColumnA2ColumnA2ColumnA2columnA2column_a2) and on the second line (RowB1RowB1RowB1RowB1rowB1row_b1,ColumnB1ColumnB1ColumnB1ColumnB1columnB1column_b1, RowB2RowB2RowB2RowB2rowB2row_b2,ColumnB2ColumnB2ColumnB2ColumnB2columnB2column_b2) are expected. The calculation is performed as follows: We interpret the lines as vectors with starting points RowA1RowA1RowA1RowA1rowA1row_a1,ColumnA1ColumnA1ColumnA1ColumnA1columnA1column_a1 and RowB1RowB1RowB1RowB1rowB1row_b1,ColumnB1ColumnB1ColumnB1ColumnB1columnB1column_b1 and end points RowA2RowA2RowA2RowA2rowA2row_a2,ColumnA2ColumnA2ColumnA2ColumnA2columnA2column_a2 and RowB2RowB2RowB2RowB2rowB2row_b2,ColumnB2ColumnB2ColumnB2ColumnB2columnB2column_b2, respectively. Rotating the vector A counter clockwise onto the vector B (the center of rotation is the intersection point of the two lines) yields the angle. The result depends on the order of the points and on the order of the lines. The parameter AngleAngleAngleAngleangleangle returns the angle in radians, ranging from -pi <= AngleAngleAngleAngleangleangle <= pi.

Execution Information

Parameters

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

Row coordinate of the first point of the first line.

ColumnA1ColumnA1ColumnA1ColumnA1columnA1column_a1 (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 first line.

RowA2RowA2RowA2RowA2rowA2row_a2 (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 first line.

ColumnA2ColumnA2ColumnA2ColumnA2columnA2column_a2 (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 first line.

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

Row coordinate of the first point of the second line.

ColumnB1ColumnB1ColumnB1ColumnB1columnB1column_b1 (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 second line.

RowB2RowB2RowB2RowB2rowB2row_b2 (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 second line.

ColumnB2ColumnB2ColumnB2ColumnB2columnB2column_b2 (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 second line.

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

Angle between the lines [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])
RowB1 := 255
ColumnB1 := 255
for I := 5 to 360 by 5
  RowB2 := 255 - sin(rad(I)) * 200
  ColumnB2 := 255 + cos(rad(I)) * 200
  gen_contour_polygon_xld (Contour, [RowB1,RowB2], [ColumnB1,ColumnB2])
  angle_ll (RowA1, ColumnA1, RowA2, ColumnA2,\
            RowB1, ColumnB1, RowB2, ColumnB2, Angle)
  AngleDeg := deg(Angle)
endfor

Result

angle_llangle_llAngleLlAngleLlAngleLlangle_ll returns 2 (H_MSG_TRUE).

Alternatives

angle_lxangle_lxAngleLxAngleLxAngleLxangle_lx

Module

Foundation