Herror ::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,
    double *Angle
)
Herror ::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
)

Calculate the angle between two lines.

The operator ::angle_ll calculates the angle between two lines. As input the rows and columns of the first line (RowA1,ColumnA1, RowA2,ColumnA2) and of the second line (RowB1,ColumnB1, RowB2,ColumnB2) are expected. The calculation in done 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. Turning the vector A counterclockwise 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. The angles range from -pi <= Angle <= pi.


Parameters

RowA1 (input_control)
point.y(-array) -> HTuple.double / long
Row of the first point of the first line.

ColumnA1 (input_control)
point.x(-array) -> HTuple.double / long
Column of the first point of the first line.

RowA2 (input_control)
point.y(-array) -> HTuple.double / long
Row of the second point of the first line.

ColumnA2 (input_control)
point.x(-array) -> HTuple.double / long
Column of the second point of the first line.

RowB1 (input_control)
point.y(-array) -> HTuple.double / long
Row of the first point of the second line.

ColumnB1 (input_control)
point.x(-array) -> HTuple.double / long
Column of the first point of the second line.

RowB2 (input_control)
point.y(-array) -> HTuple.double / long
Row of the second point of the second line.

ColumnB2 (input_control)
point.x(-array) -> HTuple.double / long
Column of the second point of the second line.

Angle (output_control)
number(-array) -> (HTuple.) double *
Angle between the lines.


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 H_MSG_TRUE.


Alternatives

::angle_lx


Module

Basic operators



Copyright © 1996-2002 MVTec Software GmbH