CogMath IntersectSegmentEllipse Method Cognex VisionPro 9.21 SR1
Returns whether the given ellipse and line segment intersect. Also provides the points of intersection.

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

public static bool IntersectSegmentEllipse(
	CogLineSegment segment,
	CogEllipse ellipse,
	ICogImage image,
	out int numPoints,
	out double x0,
	out double y0,
	out double x1,
	out double y1
)

Parameters

segment
Type: Cognex.VisionPro CogLineSegment

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, segment and ellipse do not intersect. If the value is 1, (x0,y0) is the tangent point or the single intersection 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 segment and ellipse are tangent or intersecting.

Exceptions

ExceptionCondition
ArgumentException

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

The following table describes how the relationship between segment 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, endpoint on ellipse

True

1

The endpoint that touches the ellipse.

(0,0)

Straddle

True

1

The intersection point.

(0,0)

Intersecting

True

2

The first intersection point.

The second intersection point.

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

See Also