CogMath IntersectLineLine Method Cognex VisionPro 9.22
Returns whether the given lines intersect. Also provides the point of intersection and the angle between the lines.

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

public static bool IntersectLineLine(
	CogLine lineA,
	CogLine lineB,
	ICogImage image,
	out int numPoints,
	out double x,
	out double y,
	out double angle
)

Parameters

lineA
Type: Cognex.VisionPro CogLine

The first line.

lineB
Type: Cognex.VisionPro CogLine

The first 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 lines are coincident.

x
Type: System Double 

The x-coordinate of the intersection point.

y
Type: System Double 

The y-coordinate of the intersection point.

angle
Type: System Double 

The angle between the two lines. The angle is normalized to the range -π to π.

Return Value

Type: Boolean

True if the lines intersect or are coincident.

Exceptions

ExceptionCondition
ArgumentException

lineA or lineB 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 lines intersect and optionally, the point of intersection and the angle between the lines.

The following table describes how the relationship between lineA and lineB affects the out parameters.

ConditionIntersectednumPoints(x,y)

Parallel

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 lineA and lineB 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 lineA and lineB are presumed to be in the same coordinate space.

See Also