CogMath IntersectSegmentSegment Method Cognex VisionPro 9.21 SR1
Returns whether the given segments intersect. Also provides the point of intersection.

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

public static bool IntersectSegmentSegment(
	CogLineSegment segmentA,
	CogLineSegment segmentB,
	ICogImage image,
	out int numPoints,
	out double x,
	out double y
)

Parameters

segmentA
Type: Cognex.VisionPro CogLineSegment

The first line segment.

segmentB
Type: Cognex.VisionPro CogLineSegment

The other line segment.

image
Type: Cognex.VisionPro ICogImage

An image that specifies the coordinate space to use.

numPoints
Type: System Int32 

The number of intersection points. If this value is −1, the line segments are coincident.

x
Type: System Double 

The x-coordinate of the intersection point.

y
Type: System Double 

The y-coordinate of the intersection point.

Return Value

Type: Boolean

True if the line segments are intersecting or coincident.

Exceptions

ExceptionCondition
ArgumentException

segmentA or segmentB 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 two line segments intersect and optionally the point of intersection.

The following table describes how the relationship between segmentA and segmentB affects the out parameters.

ConditionIntersectednumPoints(x,y)

Parallel, overlapping

False

0

(0,0)

Non-intersecting

False

0

(0,0)

Parallel, not overlapping

False

0

(0,0)

Coincident

True

−1

(0,0)

Intersecting

True

1

The point of intersection.

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

See Also