Method Fillet
- Namespace
- GeometryHelper.Core
- Assembly
- GeometryHelper.dll
Fillet(GeoPolylineArc2, double, Tolerance)
Rounds every corner of a chain that has room for it with an arc of a given radius, within a tolerance.
public static GeoPolylineArc2 Fillet(GeoPolylineArc2 polyline, double radius, Tolerance tolerance)
Parameters
polylineGeoPolylineArc2The chain.
radiusdoubleThe radius of the arcs.
toleranceToleranceThe tolerance: a corner straighter than EqualAngleRad is left alone, as where a straight edge runs on into an arc it is tangent to.
Returns
- GeoPolylineArc2
The filleted chain.
Remarks
Each arc lies on the inside of its corner and runs the way the chain runs, and it touches both edges on the edges themselves, never past the corner; a corner no circle of the radius fits that way is left alone. The chain (0, 0), (10, 0), (3, 5) filleted at 0.002 is cut back 0.0062 along both edges and turns through an arc of 144.5°, as much as the corner turns.
Where the corners at an edge take all of it, give or take the tolerance, nothing of the edge is left and the arcs either side meet at one point, midway along it; past the tolerance the corner taking more gives way. The chain's own end points never move. Three sides of the square of side 10 filleted at 5.02 at a tolerance of 0.1 run from (0, 0) to (4.98, 0), turn a quarter to (10, 5), another to (4.98, 10), and end at (0, 10).
Exceptions
- ArgumentNullException
Thrown when the chain is null.
- ArgumentOutOfRangeException
Thrown when the radius is not a positive number.
Fillet(GeoPolygonArc2, double, Tolerance)
Rounds every corner of a loop that has room for it with an arc of a given radius, within a tolerance.
public static GeoPolygonArc2 Fillet(GeoPolygonArc2 polygon, double radius, Tolerance tolerance)
Parameters
polygonGeoPolygonArc2The loop.
radiusdoubleThe radius of the arcs.
toleranceToleranceThe tolerance: a corner straighter than EqualAngleRad is left alone, as where a straight edge runs on into an arc it is tangent to.
Returns
- GeoPolygonArc2
The filleted loop.
Remarks
Each arc lies on the inside of its corner and runs the way the loop runs, touching both edges on the edges themselves; a corner no circle of the radius fits that way is left alone. Where the corners at an edge take all of it, give or take the tolerance, the arcs either side meet midway along it: the square of side 10 filleted at 5.02 at a tolerance of 0.1 is the circle of radius 5 through the midpoints of its sides. A loop the fillets would leave with fewer than three corners is given back as it was.
The loop keeps every arc however small, and every side the tolerance keeps, as a chain does: the rectangle 100 by 50 filleted at 0.0005 is eight edges, four of them arcs 0.0007 across, where the loop was put back together within the global tolerance of a thousandth and came back its four corners, 0.0625 square units short.
Exceptions
- ArgumentNullException
Thrown when the loop is null.
- ArgumentOutOfRangeException
Thrown when the radius is not a positive number.
Fillet(GeoPolylineArc2, IReadOnlyList<double>)
Rounds the corners of a chain, each by its own radius, using the default tolerance.
public static GeoPolylineArc2 Fillet(GeoPolylineArc2 polyline, IReadOnlyList<double> radii)
Parameters
polylineGeoPolylineArc2radiiIReadOnlyList<double>
Returns
Fillet(GeoPolylineArc2, IReadOnlyList<double>, Tolerance)
Rounds the corners of a chain, each by its own radius, within a tolerance.
public static GeoPolylineArc2 Fillet(GeoPolylineArc2 polyline, IReadOnlyList<double> radii, Tolerance tolerance)
Parameters
polylineGeoPolylineArc2The chain.
radiiIReadOnlyList<double>One radius per vertex, in the order the chain holds them; zero leaves that corner alone, and the two ends have no corner to round.
toleranceToleranceThe tolerance.
Returns
- GeoPolylineArc2
The filleted chain.
Remarks
The radii are read the way GetBulgeAt(int) is read: the entry at an index belongs to the vertex at that index. A list shorter than the chain leaves the rest of the corners alone. The rules for a corner that will not fit are the ones a single radius follows, and they matter more here: where two neighbours together ask for more than the edge between them is long, the one taking more of it is dropped, so a corner asking for fifty gives way to one asking for five rather than the other way round.
Exceptions
- ArgumentNullException
Thrown when the chain or the radii are null.
- ArgumentOutOfRangeException
Thrown when a radius is negative or not a number.
Fillet(GeoPolygonArc2, IReadOnlyList<double>)
Rounds the corners of a loop, each by its own radius, using the default tolerance.
public static GeoPolygonArc2 Fillet(GeoPolygonArc2 polygon, IReadOnlyList<double> radii)
Parameters
polygonGeoPolygonArc2radiiIReadOnlyList<double>
Returns
Fillet(GeoPolygonArc2, IReadOnlyList<double>, Tolerance)
Rounds the corners of a loop, each by its own radius, within a tolerance.
public static GeoPolygonArc2 Fillet(GeoPolygonArc2 polygon, IReadOnlyList<double> radii, Tolerance tolerance)
Parameters
polygonGeoPolygonArc2The loop.
radiiIReadOnlyList<double>One radius per vertex, in the order the loop holds them; zero leaves that corner alone.
toleranceToleranceThe tolerance.
Returns
- GeoPolygonArc2
The filleted loop.
Exceptions
- ArgumentNullException
Thrown when the loop or the radii are null.
- ArgumentOutOfRangeException
Thrown when a radius is negative or not a number.
Fillet(GeoPolyline2, double)
Rounds every corner of a straight chain by the same radius.
public static GeoPolylineArc2 Fillet(GeoPolyline2 polyline, double radius)
Parameters
polylineGeoPolyline2radiusdouble
Returns
Fillet(GeoPolyline2, double, Tolerance)
Rounds every corner of a straight chain by the same radius, within a tolerance.
public static GeoPolylineArc2 Fillet(GeoPolyline2 polyline, double radius, Tolerance tolerance)
Parameters
polylineGeoPolyline2The chain.
radiusdoubleThe radius to round every corner by.
toleranceToleranceThe tolerance.
Returns
- GeoPolylineArc2
The chain with its corners rounded; a corner with too little edge to give is left alone.
Exceptions
- ArgumentNullException
Thrown when the chain is null.
Fillet(GeoPolyline2, IReadOnlyList<double>)
Rounds the corners of a straight chain, one radius each.
public static GeoPolylineArc2 Fillet(GeoPolyline2 polyline, IReadOnlyList<double> radii)
Parameters
polylineGeoPolyline2radiiIReadOnlyList<double>
Returns
Fillet(GeoPolyline2, IReadOnlyList<double>, Tolerance)
Rounds the corners of a straight chain, one radius each, within a tolerance.
public static GeoPolylineArc2 Fillet(GeoPolyline2 polyline, IReadOnlyList<double> radii, Tolerance tolerance)
Parameters
polylineGeoPolyline2The chain.
radiiIReadOnlyList<double>A radius per corner; nought leaves that corner square.
toleranceToleranceThe tolerance.
Returns
- GeoPolylineArc2
The chain with the corners the radii asked for rounded.
Exceptions
- ArgumentNullException
Thrown when the chain or the list of radii is null.
Fillet(GeoPolygon2, double)
Rounds every corner of a straight loop by the same radius.
public static GeoPolygonArc2 Fillet(GeoPolygon2 polygon, double radius)
Parameters
polygonGeoPolygon2radiusdouble
Returns
Fillet(GeoPolygon2, double, Tolerance)
Rounds every corner of a straight loop by the same radius, within a tolerance.
public static GeoPolygonArc2 Fillet(GeoPolygon2 polygon, double radius, Tolerance tolerance)
Parameters
polygonGeoPolygon2The loop.
radiusdoubleThe radius to round every corner by.
toleranceToleranceThe tolerance.
Returns
- GeoPolygonArc2
The loop with its corners rounded; a corner with too little edge to give is left alone.
Exceptions
- ArgumentNullException
Thrown when the loop is null.
Fillet(GeoPolygon2, IReadOnlyList<double>)
Rounds the corners of a straight loop, one radius each.
public static GeoPolygonArc2 Fillet(GeoPolygon2 polygon, IReadOnlyList<double> radii)
Parameters
polygonGeoPolygon2radiiIReadOnlyList<double>
Returns
Fillet(GeoPolygon2, IReadOnlyList<double>, Tolerance)
Rounds the corners of a straight loop, one radius each, within a tolerance.
public static GeoPolygonArc2 Fillet(GeoPolygon2 polygon, IReadOnlyList<double> radii, Tolerance tolerance)
Parameters
polygonGeoPolygon2The loop.
radiiIReadOnlyList<double>A radius per corner; nought leaves that corner square.
toleranceToleranceThe tolerance.
Returns
- GeoPolygonArc2
The loop with the corners the radii asked for rounded.
Exceptions
- ArgumentNullException
Thrown when the loop or the list of radii is null.