BuildCoordinateSystem Method

NI Vision for Visual Basic

BuildCoordinateSystem Method

Syntax

CWIMAQVision.BuildCoordinateSystem ReferencePoints, AxisOrientation, CoordinateSystem

Return Type

Long

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

Purpose

Builds a reference for any arbitrary coordinate system with respect to the image plane. The reference of the coordinate system is specified as the position of the origin of the coordinate system, the orientation of its x-axis with respect to that of the image plane, and the direction of the axis.

Parameters

ReferencePoints As CWIMAQPoints

Reference Points is a collection of points that define the coordinate system.

If two points are specified, these points are assumed to lie along the x-axis of the coordinate system and the first point is used as the origin of the coordinate axis, as shown in the following figure.

Coordinate Reference with Two Points Specified

If three points are specified, the first two points are assumed to be along the x-axis, and the third point is assumed to be on the y-axis of the coordinate system, as shown in the following figure.

AxisOrientation As CWIMAQAxisOrientations

Specifies the direction of the coordinate system. The AxisOrientation can be cwimaqDirect or cwimaqIndirect.

CoordinateSystem As CWIMAQCoordinateSystem

On return, a CWIMAQCoordinateSystem object containing the built coordinate system.

Example

Dim referencePoints1 As New CWIMAQPoints
Dim referencePoints2 As New CWIMAQPoints
Dim coordinateSystem1 As New CWIMAQCoordinateSystem
Dim coordinateSystem2 As New CWIMAQCoordinateSystem

'Build a direct coordinate system whose origin is at (0,0) 
'and the x-axis passes through (10,10)
referencePoints1.Add 2
referencePoints1(1).Initialize 0,0
referencePoints1(2).Initialize 10,10

CWIMAQVision1.BuildCoordinateSystem referencePoints1, _ 
                                    cwimaqAxisOrientationDirect, _
                                    coordinateSystem1                    
'Build an indirect coordinate system whose 
'x-axis passes through (1,5) and (10,-25) and
'y-axis passes through (20,2)
referencePoints2.Add 3
referencePoints2(1).Initialize 1,5
referencePoints2(2).Initialize 10,-25
referencePoints2(3).Initialize 20,2

CWIMAQVision1.BuildCoordinateSystem referencePoints2, _ 
                                    cwimaqAxisOrientationIndirect, _
                                    coordinateSystem2