Herror ::angle_lx (
const HTuple &Row1,
const HTuple &Column1,
const HTuple &Row2,
const HTuple &Column2,
double *Angle
)
Herror ::angle_lx (
const HTuple &Row1,
const HTuple &Column1,
const HTuple &Row2,
const HTuple &Column2,
HTuple *Angle
)
Calculate the angle between one line and the vertical axis.
The operator ::angle_lx calculates the angle between one line
and the abscissa.
As input the row and column of the line
(Row1,Column1,
Row2,Column2) are expected.
The calculation in done as follows: We interprete the line
as a vector with starting point
Row1,Column1 and end point
Row2,Column2.
Turning the vector counter clockwise onto the
abscissa (center of rotation
is the intersection point of the abscissa) yields the angle.
The result is dependant on the order of points of line.
The parameters Angle returns the angle in radians.
The angles range from -pi <= Angle <= pi.
Parameters
Row1 (input_control)
|
point.y(-array) -> HTuple.double / long
|
|
Row of the first point of the line. |
Column1 (input_control)
|
point.x(-array) -> HTuple.double / long
|
|
Column of the first point of the line. |
Row2 (input_control)
|
point.y(-array) -> HTuple.double / long
|
|
Row of the second point of the line. |
Column2 (input_control)
|
point.x(-array) -> HTuple.double / long
|
|
Column of the second point of the line. |
Angle (output_control)
|
number(-array) -> (HTuple.) double *
|
|
Angle between the line and the abscissa. |
Example
RowX1 := 255
ColumnX1 := 10
RowX2 := 255
ColumnX2 := 501
disp_line (WindowHandle, RowX1, ColumnX1, RowX2, ColumnX2)
Row1 := 255
Column1 := 255
for i := 1 to 360 by 1
Row2 := 255 + sin(rad(i)) * 200
Column2 := 255 + cos(rad(i)) * 200
disp_line (WindowHandle, Row1, Column1, Row2, Column2)
angle_lx (Row1, Column1, Row2, Column2, Angle)
endfor
Result
::angle_lx returns H_MSG_TRUE.
Alternatives
::angle_ll
Module
Basic operators
Copyright © 1996-2002 MVTec Software GmbH