CogMath DistanceLineEllipse Method Cognex VisionPro 9.20
Returns the shortest distance from the given line to the given ellipse. 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: 80.0.0.0
Syntax

public static double DistanceLineEllipse(
	CogLine line,
	CogEllipse ellipse,
	ICogImage image,
	out double lineX,
	out double lineY,
	out double ellipseX,
	out double ellipseY
)

Parameters

line
Type: Cognex.VisionPro CogLine

The line.

ellipse
Type: Cognex.VisionPro CogEllipse

The ellipse.

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.

ellipseX
Type: System Double 

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

ellipseY
Type: System Double 

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

Return Value

Type: Double

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

Exceptions

ExceptionCondition
ArgumentException

line or ellipse 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 ellipse and optionally the points on each shape that correspond to this shortest distance.

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

ConditionDistance(lineX,lineY)(ellipseX,ellipseY)

Non-intersecting

Shortest distance between line and ellipse.

The nearest point on line

The nearest point on ellipse

Tangent

0

(0,0)

(0,0)

Intersecting

0

(0,0)

(0,0)

If you supply a value for the image parameter, then line and ellipse 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 ellipse are presumed to be in the same coordinate space.

See Also