Assembly: Cognex.VisionPro.Core (in Cognex.VisionPro.Core.dll) Version: 85.1.0.0
public CogGeneralContourSegmentIterator ReplaceSegmentWithEllipticalArcSegment( CogGeneralContourSegmentIterator replaceSegment, CogGeneralContourVertexConstants startFlags, double startX, double startY, double midpointX, double midpointY, CogGeneralContourVertexConstants endFlags, double endX, double endY, double ellipseFraction )
Parameters
- replaceSegment
- Type: Cognex.VisionPro CogGeneralContourSegmentIterator
The segment to be replaced.
- startFlags
- Type: Cognex.VisionPro CogGeneralContourVertexConstants
Flags that specify how the start point is treated with respect to the other segments in the contour shape.
- startX
- Type: System Double
X-coordinate of the start point of the segment. Ignored if startFlags includes Connected.
- startY
- Type: System Double
Y-coordinate of the start point of the segment. Ignored if startFlags includes Connected.
- midpointX
- Type: System Double
X-coordinate of the midpoint of the elliptical arc segment.
- midpointY
- Type: System Double
Y-coordinate of the midpoint of the elliptical arc segment.
- endFlags
- Type: Cognex.VisionPro CogGeneralContourVertexConstants
Flags that specify how the end point is treated with respect to the other segments in the contour shape.
- endX
- Type: System Double
X-coordinate of the end point of the segment. Ignored if endFlags includes Connected.
- endY
- Type: System Double
Y-coordinate of the end point of the segment. Ignored if endFlags includes Connected.
- ellipseFraction
- Type: System Double
The fraction of the ellipse that passes through the start, mid-, and end points. For slight arcs, using roughly a quarter of the ellipse usually provides good results. This value must be greater than 0 and less than 1
Return Value
Type: CogGeneralContourSegmentIteratorA new iterator positioned at the new segment.
| Event Type | Reason |
|---|---|
| CogGeneralContour Changed | Fires when the segment is replaced. The following state flags may be affected: |
| Exception | Condition |
|---|---|
| CogShapeBadContourSegConnException | replaceSegment is the first segment and startFlags includes Connected or replaceSegment is the end segment and endFlags includes Connected. |
| ArgumentException | startFlags or endFlags include bits that are not defined in CogGeneralContourVertexConstants. |
| ArgumentException | EllipseFraction is < 0 or > 1. |
| CogShapeCoordinatesMustDifferException | Points in the new segment are coincident. |
| CogIteratorInvalidIteratorException | replaceSegment is invalid and not the end iterator. |
| CogShapeBadContourChainClosureException | endFlags include Closed but startFlags do not include Connected ; or startFlags include Closed but endFlags do not include Connected. This error may also occur if the startFlags and endFlags are set properly but closing the chain would create a contour with only two segments. |
| CogShapeDegenerateEllipticalArcSegException | Points on the elliptical arc segment are colinear. |
Replaces replaceSegment with a new elliptical arc segment and returns a new iterator positioned at the new segment.
If replaceSegment is Nothing or if replaceSegment.IsEnd is True, ReplaceSegmentWithEllipticalArcSegment(CogGeneralContourSegmentIterator, CogGeneralContourVertexConstants, Double, Double, Double, Double, CogGeneralContourVertexConstants, Double, Double, Double) behaves exactly as if AddEllipticalArcSegment(CogGeneralContourSegmentIterator, CogGeneralContourVertexConstants, Double, Double, Double, Double, CogGeneralContourVertexConstants, Double, Double, Double) were called with NextSegment set to Nothing.
If startFlags includes Connected, then startX and startY are ignored. Similarly, if endFlags includes Connected, then endX and endY are ignored.
Note: ReplaceSegmentWithEllipticalArcSegment(CogGeneralContourSegmentIterator, CogGeneralContourVertexConstants, Double, Double, Double, Double, CogGeneralContourVertexConstants, Double, Double, Double) can break connections and undo closed contour chains. Any CogGeneralContourSegmentIterator positioned at the replaced segment (including replaceSegment) become invalid. Other iterators are unchanged.