CogMath IntersectSegmentLine Method Cognex VisionPro 9.8
Returns whether the given segment and line intersect. Also provides the point of intersection.

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

public static bool IntersectSegmentLine(
	CogLineSegment segment,
	CogLine line,
	ICogImage image,
	out int numPoints,
	out double x,
	out double y
)

Parameters

segment
Type: Cognex.VisionPro CogLineSegment

The line segment.

line
Type: Cognex.VisionPro CogLine

The line.

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 and the line segment 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 lines are intersecting or coincident.

Exceptions

ExceptionCondition
ArgumentException

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

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

ConditionIntersectednumPoints(x,y)

Parallel

False

0

(0,0)

Non-intersecting

False

0

(0,0)

Coincident

True

−1

(0,0)

Intersecting

True

1

The intersection point.

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

See Also