Compute the centroid of this polygon. Generates an error if there are fewer than 3 vertices.
Namespace: Cognex.VisionProAssembly: Cognex.VisionPro.Core (in Cognex.VisionPro.Core.dll) Version: 69.0.0.0
Syntax
Parameters
- x
- Type: System Double
X-coordinate of the center.
- y
- Type: System Double
Y-coordinate of the center.
Exceptions
| Exception | Condition |
|---|---|
| CogShapeDegeneratePolygonException | NumVertices < 3. |
Remarks
Computes the centroid of this polygon. The polygon must have at least three vertices.
If the polygon is Complex, the value that AreaCenter(Double , Double ) computes will not be valid, but AreaCenter(Double , Double ) will not return an error. For Complex polygons use ArcCenter(Double , Double ) instead.
See Also