CogMath DistanceCircleCircle Method Cognex VisionPro 9.10
Returns the shortest distance between the given circles. 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: 79.0.0.0
Syntax

public static double DistanceCircleCircle(
	CogCircle circleA,
	CogCircle circleB,
	ICogImage image,
	out double circleAX,
	out double circleAY,
	out double circleBX,
	out double circleBY
)

Parameters

circleA
Type: Cognex.VisionPro CogCircle

The first circle.

circleB
Type: Cognex.VisionPro CogCircle

The second circle.

image
Type: Cognex.VisionPro ICogImage

An image that specifies the coordinate space to use.

circleAX
Type: System Double 

The x-coordinate of the nearest point in circleA.

circleAY
Type: System Double 

The y-coordinate of the nearest point in circleA.

circleBX
Type: System Double 

The x-coordinate of the nearest point in circleB.

circleBY
Type: System Double 

The y-coordinate of the nearest point in circleB.

Return Value

Type: Double

The shortest distance between the two circles. The distance in negative if one circle is wholly within the other; zero if the circles are coincident, tangent, or intersecting.

Exceptions

ExceptionCondition
ArgumentException

circleA or circleB is NULL.

CogMathUnsupportedGeometryException

It is impossible to map both circleA and circleB to the same coordinate space without converting one or both circles into ellipses.

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 between the given circles and optionally the points on each shape that correspond to this shortest distance.

The following table describes how the relationship between circleA and circleB affects the out parameters.

Note: In this release of VisionPro, if it is not possible to map both circleA and circleB into a single space where neither circle is converted into an ellipse, this function will throw E_CogMath_Unsupported_Geometry.

ConditionDistance(circleAX,circleAY)(circleBX,circleBY)

Concentric

The negative of the distance from circleA to circleB.

An arbitrary point on circleA

An arbitrary point on circleB

Non-intersecting

The negative of the shortest distance from circleA to circleB.

The nearest point on circleA

The nearest point on circleB

Non-intersecting

The shortest distance from circleA to circleB.

The nearest point on circleA

The nearest point on circleB

Coincident

0

(0,0)

(0,0)

Tangent

0

(0,0)

(0,0)

Intersecting

0

(0,0)

(0,0)

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

See Also