FindDistanceFromPointToLine Method

NI Vision for Visual Basic

FindDistanceFromPointToLine Method

Syntax

CWIMAQVision.FindDistanceFromPointToLine Line, Point, Distance

Return Type

Long

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

Purpose

Computes the distance of a point from a line.

Parameters

Line As CWIMAQLine

Defines the line.

Point As CWIMAQPoint

Defines the point.

Distance As Double

On return, the distance between the point and the line.

Example

Dim line As New CWIMAQLine
Dim point As New CWIMAQPoint
Dim distance As Double

' Initialize the line and the point
line.Initialize 10, 10, 100, 100
point.Initialize 50, -50

' Find the distance of the point from the line
CWIMAQVision1.FindDistanceFromPointToLine line, point, distance