CogMath IntersectLineCircle Method Cognex VisionPro 9.5
Returns whether the given circle and line intersect. Also provides the points of intersection.

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

public static bool IntersectLineCircle(
	CogLine line,
	CogCircle circle,
	ICogImage image,
	out int numPoints,
	out double x0,
	out double y0,
	out double x1,
	out double y1
)

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.

numPoints
Type: System Int32 

The number of intersection points. If the value is zero, line and circle do not intersect. If the value is 1, (x0,y0) is the tangent point. If the value is 2, (x0,y0) and (x1,y1) are the intersection points.

x0
Type: System Double 

The x-coordinate of the first intersection point.

y0
Type: System Double 

The y-coordinate of the first intersection point.

x1
Type: System Double 

The x-coordinate of the second intersection point.

y1
Type: System Double 

The y-coordinate of the second intersection point.

Return Value

Type: Boolean

True 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 whether the given circle and line intersect and optionally the points of intersection.

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

ConditionIntersectednumPoints(x0,y0)(x1,y1)

Non-intersecting

False

0

(0,0)

(0,0)

Tangent

True

1

The tangent point.

(0,0)

Intersecting

True

2

The first intersection point.

The second intersection point.

If you supply a value for the image parameter, then line and circle are mapped to the selected space of image before the intersection 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