CogMath DistanceLineCircle Method Cognex VisionPro 9.8
Returns the shortest distance from the given line to the given circle. Also provides the points on each shape that correspond to this shortest distance.

Namespace: Cognex.VisionPro
Assembly: Cognex.VisionPro.Core (in Cognex.VisionPro.Core.dll) Version: 75.1.0.0
Syntax

public static double DistanceLineCircle(
	CogLine line,
	CogCircle circle,
	ICogImage image,
	out double lineX,
	out double lineY,
	out double circleX,
	out double circleY
)

Parameters

line
Type: Cognex.VisionPro CogLine

The line.

circle
Type: Cognex.VisionPro CogCircle

The circle.

image
Type: Cognex.VisionPro ICogImage

An image that specifies the coordinate space to use.

lineX
Type: System Double 

The x-coordinate of the nearest point on the line.

lineY
Type: System Double 

The y-coordinate of the nearest point on the line.

circleX
Type: System Double 

The x-coordinate of the nearest point on the circle.

circleY
Type: System Double 

The y-coordinate of the nearest point on the circle.

Return Value

Type: Double

The nearest distance between line and circle. Zero if the line and circle are tangent or intersecting.

Exceptions

ExceptionCondition
ArgumentException

line or circle is NULL.

CogSpaceTreeInvalidNameSyntaxException

At least one shape's selected space names is not a legal space name.

CogSpaceTreeNotUniqueException

At least one shape's selected space names is a nonqualified space name and more than one instance of it exists in image's coordinate space tree.

CogSpaceTreeNotInTreeException

At least one shape does not exist in image's coordinate space tree.

CogImageNoTreeException

The coordinate space tree is missing from image.

Remarks

Returns the shortest distance from line to circle and optionally the points on each shape that correspond to this shortest distance.

The following table describes how the relationship between line and circle affects the out parameters.

ConditionDistance(lineX,lineY)(circleX,circleY)

Non-intersecting

Shortest distance between line and circle.

The nearest point on line

The nearest point on circle

Tangent

0

(0,0)

(0,0)

Intersecting

0

(0,0)

(0,0)

If you supply a value for the image parameter, then line and circle are mapped to the selected space of image before the measurement is computed and the result is expressed in that space.

If you do not supply a value for image, then line and circle are presumed to be in the same coordinate space.

See Also