CogMath CreateSegmentByAveragingSegments Method Cognex VisionPro 9.10
Create a new line segment by averaging SegmentA and SegmentB.

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

public static CogLineSegment CreateSegmentByAveragingSegments(
	CogLineSegment segmentA,
	CogLineSegment segmentB,
	ICogImage image
)

Return Value

Type: CogLineSegment

The new line segment.

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

Creates a new CogLineSegment by averaging segmentA and segmentB.

The start point of the new segment is the average of the start points of segmentA and segmentB, and the end point of the new segment is the is the average of the end points of segmentA and segmentB. The new segment is initialized with as many of segmentA's properties (such as Color) as possible.

You would typically use this function when segmentA and segmentB are parallel to each other and you wish to find a center line between them.

If you supply a value for the image parameter, then segmentA and segmentB are mapped to the selected space of image before the returned segment is computed. The returned segment has its selected space set to the selected space of image.

If you do not supply a value for image, then segmentA and segmentB are presumed to be in the same coordinate space and the returned line has its selected space set to ".".

See Also