angle_llangle_llAngleLlAngleLl (Operator)
Name
angle_llangle_llAngleLlAngleLl
— Calculate the angle between two lines.
Signature
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)
Description
The operator angle_llangle_llAngleLlAngleLlAngleLl
calculates the angle between two lines.
As input the coordinates of to points on the first line
(RowA1RowA1RowA1RowA1rowA1
,ColumnA1ColumnA1ColumnA1ColumnA1columnA1
,
RowA2RowA2RowA2RowA2rowA2
,ColumnA2ColumnA2ColumnA2ColumnA2columnA2
) and on the second line
(RowB1RowB1RowB1RowB1rowB1
,ColumnB1ColumnB1ColumnB1ColumnB1columnB1
,
RowB2RowB2RowB2RowB2rowB2
,ColumnB2ColumnB2ColumnB2ColumnB2columnB2
) are expected.
The calculation is performed as follows: We interpret the lines
as vectors with starting points
RowA1RowA1RowA1RowA1rowA1
,ColumnA1ColumnA1ColumnA1ColumnA1columnA1
and
RowB1RowB1RowB1RowB1rowB1
,ColumnB1ColumnB1ColumnB1ColumnB1columnB1
and end points
RowA2RowA2RowA2RowA2rowA2
,ColumnA2ColumnA2ColumnA2ColumnA2columnA2
and
RowB2RowB2RowB2RowB2rowB2
,ColumnB2ColumnB2ColumnB2ColumnB2columnB2
, 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 AngleAngleAngleAngleangle
returns the angle in radians,
ranging from -pi <= AngleAngleAngleAngleangle
<= pi.
Execution Information
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Parameters
RowA1RowA1RowA1RowA1rowA1
(input_control) point.y(-array) →
HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Row coordinate of the first point of the first line.
ColumnA1ColumnA1ColumnA1ColumnA1columnA1
(input_control) point.x(-array) →
HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Column coordinate of the first point of the first
line.
RowA2RowA2RowA2RowA2rowA2
(input_control) point.y(-array) →
HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Row coordinate of the second point of the first line.
ColumnA2ColumnA2ColumnA2ColumnA2columnA2
(input_control) point.x(-array) →
HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Column coordinate of the second point of the first
line.
RowB1RowB1RowB1RowB1rowB1
(input_control) point.y(-array) →
HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Row coordinate of the first point of the second line.
ColumnB1ColumnB1ColumnB1ColumnB1columnB1
(input_control) point.x(-array) →
HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Column coordinate of the first point of the second
line.
RowB2RowB2RowB2RowB2rowB2
(input_control) point.y(-array) →
HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Row coordinate of the second point of the second line.
ColumnB2ColumnB2ColumnB2ColumnB2columnB2
(input_control) point.x(-array) →
HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Column coordinate of the second point of the second
line.
AngleAngleAngleAngleangle
(output_control) angle.rad(-array) →
HTupleHTupleHtuple (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_llAngleLlAngleLlAngleLl
returns 2 (H_MSG_TRUE).
Alternatives
angle_lxangle_lxAngleLxAngleLxAngleLx
Module
Foundation