Method Chamfer
- Namespace
- GeometryHelper.Core
- Assembly
- GeometryHelper.dll
Chamfer(GeoPolygon2, double)
Chamfers every corner of a polygon that has room for it, cutting the same distance along both edges, using the default tolerance.
public static GeoPolygon2 Chamfer(GeoPolygon2 polygon, double distance)
Parameters
polygonGeoPolygon2The polygon.
distancedoubleHow far back along each edge the cut is measured.
Returns
- GeoPolygon2
The chamfered polygon.
Chamfer(GeoPolygon2, double, Tolerance)
Chamfers every corner of a polygon that has room for it, cutting the same distance along both edges, within a tolerance.
public static GeoPolygon2 Chamfer(GeoPolygon2 polygon, double distance, Tolerance tolerance)
Parameters
polygonGeoPolygon2distancedoubletoleranceTolerance
Returns
Chamfer(GeoPolygon2, double, double)
Chamfers every corner of a polygon that has room for it, using the default tolerance.
public static GeoPolygon2 Chamfer(GeoPolygon2 polygon, double distance1, double distance2)
Parameters
polygonGeoPolygon2The polygon.
distance1doubleHow far back along the edge running into the corner.
distance2doubleHow far back along the edge running out of it.
Returns
- GeoPolygon2
The chamfered polygon.
Chamfer(GeoPolygon2, double, double, Tolerance)
Chamfers every corner of a polygon that has room for it, within a tolerance.
public static GeoPolygon2 Chamfer(GeoPolygon2 polygon, double distance1, double distance2, Tolerance tolerance)
Parameters
polygonGeoPolygon2The polygon.
distance1doubleHow far back along the edge running into the corner.
distance2doubleHow far back along the edge running out of it.
toleranceToleranceThe tolerance: a corner straighter than EqualAngleRad is left alone.
Returns
- GeoPolygon2
The chamfered polygon: a corner that was cut becomes two vertices, one that was left alone stays one.
Remarks
Which way round the two distances go follows the way the polygon runs, so reversing it swaps them. A corner is left alone when its cut would not fit, and what was skipped and why is written to GeometryHelperLog; see the class remarks for the rules.
The polygon is put back together within the tolerance asked, as a curved loop's cut corners are, so a cut longer than the tolerance stays and one no longer than it is no edge: at a millionth, the triangle (0, 0), (10, 0), (10, 10) cut by 0.0003 has six corners, where it was put back together within the global tolerance of a thousandth, the two ends of each cut, 0.00023 to 0.00042 apart, were one corner, and it came back three.
Exceptions
- ArgumentNullException
Thrown when the polygon is null.
- ArgumentOutOfRangeException
Thrown when either distance is not a positive number.
- ArgumentException
Thrown when a vertex has a coordinate that is not a finite number.
Chamfer(GeoPolyline2, double)
Chamfers every corner of a chain that has room for it, cutting the same distance along both edges, using the default tolerance.
public static GeoPolyline2 Chamfer(GeoPolyline2 polyline, double distance)
Parameters
polylineGeoPolyline2distancedouble
Returns
Chamfer(GeoPolyline2, double, Tolerance)
Chamfers every corner of a chain that has room for it, cutting the same distance along both edges, within a tolerance.
public static GeoPolyline2 Chamfer(GeoPolyline2 polyline, double distance, Tolerance tolerance)
Parameters
polylineGeoPolyline2distancedoubletoleranceTolerance
Returns
Chamfer(GeoPolyline2, double, double)
Chamfers every corner of a chain that has room for it, using the default tolerance.
public static GeoPolyline2 Chamfer(GeoPolyline2 polyline, double distance1, double distance2)
Parameters
polylineGeoPolyline2distance1doubledistance2double
Returns
Chamfer(GeoPolyline2, double, double, Tolerance)
Chamfers every corner of a chain that has room for it, within a tolerance.
public static GeoPolyline2 Chamfer(GeoPolyline2 polyline, double distance1, double distance2, Tolerance tolerance)
Parameters
polylineGeoPolyline2The chain.
distance1doubleHow far back along the edge running into the corner.
distance2doubleHow far back along the edge running out of it.
toleranceToleranceThe tolerance: a corner straighter than EqualAngleRad is left alone.
Returns
- GeoPolyline2
The chamfered chain, which keeps both of its end points exactly where they were.
Remarks
A chain has corners only where it turns, so its two end points are never touched.
The chain is put back together within the tolerance asked, as a curved chain's cut corners are, so a cut longer than the tolerance stays and one no longer than it is no edge, the chain turning where the cut starts: at a millionth, the chain (0, 0), (10, 0), (10, 10) cut by 0.0003 turns at (9.9997, 0) and (10, 0.0003), where it was put back together within the global tolerance of a thousandth, the two ends of the cut 0.00042 apart were one corner, and it turned at (9.9997, 0) alone, as it still does within a thousandth.
Exceptions
- ArgumentNullException
Thrown when the chain is null.
- ArgumentOutOfRangeException
Thrown when either distance is not a positive number.
- ArgumentException
Thrown when a vertex has a coordinate that is not a finite number.
Chamfer(GeoPolylineArc2, double, double, Tolerance)
Chamfers every corner of a chain that has room for it, within a tolerance.
public static GeoPolylineArc2 Chamfer(GeoPolylineArc2 polyline, double distance1, double distance2, Tolerance tolerance)
Parameters
polylineGeoPolylineArc2The chain.
distance1doubleHow far back along the edge running into the corner.
distance2doubleHow far back along the edge running out of it.
toleranceToleranceThe tolerance.
Returns
- GeoPolylineArc2
The chamfered chain, its arcs untouched and both of its end points where they were.
Remarks
A cut taking all of an edge, give or take the tolerance, starts or ends at the edge's far end, or midway along it where the corner there is cut too: the chain (0, 0), (10, 0), (10, 10) chamfered by 10.05 and 5 at a tolerance of 0.1 is (0, 0), (10, 5), (10, 10). A cut no longer than the tolerance is no edge at that tolerance, and the chain runs through the point it would have started at.
Exceptions
- ArgumentNullException
Thrown when the chain is null.
- ArgumentOutOfRangeException
Thrown when either distance is not a positive number.
Chamfer(GeoPolygonArc2, double, double, Tolerance)
Chamfers every corner of a loop that has room for it, within a tolerance.
public static GeoPolygonArc2 Chamfer(GeoPolygonArc2 polygon, double distance1, double distance2, Tolerance tolerance)
Parameters
polygonGeoPolygonArc2distance1doubledistance2doubletoleranceTolerance
Returns
- GeoPolygonArc2
The chamfered loop, its arcs untouched.
Remarks
The loop keeps every cut longer than the tolerance, as a chain does: at a millionth, the rectangle 100 by 50 chamfered by 0.0003 is eight corners, where the loop was put back together within the global tolerance of a thousandth and came back its four.
Exceptions
- ArgumentNullException
Thrown when the loop is null.
- ArgumentOutOfRangeException
Thrown when either distance is not a positive number.