GetAngles2 Method

NI Vision for Visual Basic

GetAngles2 Method

Syntax

CWIMAQVision.GetAngles2 Coordinates, Angles [, VertexPoint]

Return Type

Long

On success, this method returns 0. On failure, this method returns a negative number.

Purpose

Computes the angles formed by sets of four points in an image or between sets of two points and a common vertex.

Remarks

If you do not specify the vertex point, the method considers four points at a time to compute the angle. If you specify a vertex, the method computes the angle made by two consecutive points in the array and the vertex.

Parameters

Coordinates As CWIMAQPoints

The coordinates for angle computation.

Angles As Variant

On return, an array containing the computed angles in degrees.

VertexPoint As Variant

[Optional] Specifies the coordinate of the vertex. A computation without a vertex is performed if this input is not specified.

Example

' Find the edge coordinates along a path defined by regions
' on Viewer1 and display the coordinates on the image.
Private Sub Run_Click()
    Dim points As New CWIMAQPoints
    Dim vertex As New CWIMAQPoint
    Dim anglesWithoutVertex
    Dim anglesWithVertex
    
    ' Initialize the points and the vertex
    points.Initialize Array(10, 20, 30, 40), Array(100, 50, 10, 15)
    vertex.Initialize 10, 10
    
    ' Find the angles without a vertex
    CWIMAQVision1.GetAngles2 points, anglesWithoutVertex
    
    ' Find the angles with a vertex
    CWIMAQVision1.GetAngles2 points, anglesWithVertex, vertex
End Sub