CogMath IntersectLineEllipse Method Cognex VisionPro 9.25 SR1
Returns whether the given ellipse and line intersect. Also provides the points of intersection.

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

public static bool IntersectLineEllipse(
	CogLine line,
	CogEllipse ellipse,
	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.

ellipse
Type: Cognex.VisionPro CogEllipse

The ellipse.

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 ellipse 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 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 whether ellipse and line intersect and optionally the point of intersection.

The following table describes how the relationship between line and ellipse 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 ellipse 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 ellipse are presumed to be in the same coordinate space.

See Also