angle_ll ( : : RowA1, ColumnA1, RowA2, ColumnA2, RowB1, ColumnB1, RowB2, ColumnB2 : Angle )
Calculate the angle between two lines.
The operator angle_ll calculates the angle between two lines.
As input the coordinates of to points on the first line
(RowA1,ColumnA1,
RowA2,ColumnA2) and on the second line
(RowB1,ColumnB1,
RowB2,ColumnB2) are expected.
The calculation is performed as follows: We interpret the lines
as vectors with starting points
RowA1,ColumnA1 and
RowB1,ColumnB1 and end points
RowA2,ColumnA2 and
RowB2,ColumnB2, 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 Angle returns the angle in radians,
ranging from -pi <= Angle <= pi.
Parameters
RowA1 (input_control)
|
point.y(-array) -> real / integer
|
|
Row coordinate of the first point of the first line. |
ColumnA1 (input_control)
|
point.x(-array) -> real / integer
|
|
Column coordinate of the first point of the first
line. |
RowA2 (input_control)
|
point.y(-array) -> real / integer
|
|
Row coordinate of the second point of the first line. |
ColumnA2 (input_control)
|
point.x(-array) -> real / integer
|
|
Column coordinate of the second point of the first
line. |
RowB1 (input_control)
|
point.y(-array) -> real / integer
|
|
Row coordinate of the first point of the second line. |
ColumnB1 (input_control)
|
point.x(-array) -> real / integer
|
|
Column coordinate of the first point of the second
line. |
RowB2 (input_control)
|
point.y(-array) -> real / integer
|
|
Row coordinate of the second point of the second line. |
ColumnB2 (input_control)
|
point.x(-array) -> real / integer
|
|
Column coordinate of the second point of the second
line. |
Angle (output_control)
|
number(-array) -> real
|
|
Angle between the lines [rad]. |
Example
RowA1 := 255
ColumnA1 := 10
RowA2 := 255
ColumnA2 := 501
disp_line (WindowHandle, RowA1, ColumnA1, RowA2, ColumnA2)
RowB1 := 255
ColumnB1 := 255
for i := 1 to 360 by 1
RowB2 := 255 + sin(rad(i)) * 200
ColumnB2 := 255 + cos(rad(i)) * 200
disp_line (WindowHandle, RowB1, ColumnB1, RowB2, ColumnB2)
angle_ll (RowA1, ColumnA1, RowA2, ColumnA2,
RowB1, ColumnB1, RowB2, ColumnB2, Angle)
endfor
Result
angle_ll returns 2 (H_MSG_TRUE).
Parallelization Information
angle_ll is reentrant and processed without parallelization.
Alternatives
angle_lx
Module
Foundation
Up: Tools/Geometry Top: HALCON Operators
Copyright © 1996-2008 MVTec Software GmbH