Class S57ArcDensifier
Turns S-57 arcs (AR2D) and elliptical arcs (EL2D) into polylines.
public static class S57ArcDensifier
- Inheritance
-
S57ArcDensifier
- Inherited Members
Remarks
Arcs are drawn clockwise about their centre, from the start point to the end point (S-57 Part 3, clause 5.1.4.4), with X as longitude (east) and Y as latitude (north). When the start and end points are the same, the arc is a full circle. The arc is interpolated in the coordinate plane of the data set, whatever its construction surface.
The polylines are in the data set's integer coordinate units: divide by the coordinate multiplication factor (COMF) to get decimal degrees. They start and end exactly on the arc's start and end points, and repeated points are dropped.
The curve types (B-splines and Bézier curves, with CT2D control points) aren't interpolated: their control points are joined by straight lines.
Fields
DefaultTolerance
The default tolerance, in decimal degrees: about a metre on the ground. It is the largest distance between a densified arc and the polyline that replaces it.
public const double DefaultTolerance = 1E-05
Field Value
MaximumSegmentCount
The most segments a single arc is divided into.
public const int MaximumSegmentCount = 4096
Field Value
Methods
Densify(S57Arc, double, int)
Densifies an arc into a polyline that is never further than a tolerance from the arc.
public static IReadOnlyList<S57Coordinate2D> Densify(S57Arc arc, double tolerance, int multiplicationFactor)
Parameters
arcS57ArcThe arc.
tolerancedoubleThe largest distance between the arc and the polyline, in decimal degrees; see DefaultTolerance.
multiplicationFactorintThe coordinate multiplication factor (COMF) of the data set, which converts the tolerance to coordinate units.
Returns
- IReadOnlyList<S57Coordinate2D>
The polyline, from the arc's start point to its end point.
Exceptions
- ArgumentOutOfRangeException
toleranceisn't positive, ormultiplicationFactorisn't positive.
Densify(S57Arc, int)
Densifies an arc into a polyline of a given number of segments.
public static IReadOnlyList<S57Coordinate2D> Densify(S57Arc arc, int segmentCount)
Parameters
arcS57ArcThe arc.
segmentCountintThe number of straight segments, from 1 to MaximumSegmentCount.
Returns
- IReadOnlyList<S57Coordinate2D>
The polyline, from the arc's start point to its end point.
Exceptions
- ArgumentOutOfRangeException
segmentCountis out of range.
Densify(S57ArcCurve, double, int)
Densifies the arcs, elliptical arcs and control points of an arc/curve definition into a single polyline, in that order.
public static IReadOnlyList<S57Coordinate2D> Densify(S57ArcCurve curve, double tolerance, int multiplicationFactor)
Parameters
curveS57ArcCurveThe arc/curve definition.
tolerancedoubleThe largest distance between an arc and the polyline, in decimal degrees; see DefaultTolerance.
multiplicationFactorintThe coordinate multiplication factor (COMF) of the data set.
Returns
- IReadOnlyList<S57Coordinate2D>
The polyline.
Exceptions
- ArgumentNullException
curveisnull.- ArgumentOutOfRangeException
toleranceisn't positive, ormultiplicationFactorisn't positive.
Densify(S57EllipticalArc, double, int)
Densifies an elliptical arc into a polyline that is never further than about a tolerance from the arc.
public static IReadOnlyList<S57Coordinate2D> Densify(S57EllipticalArc arc, double tolerance, int multiplicationFactor)
Parameters
arcS57EllipticalArcThe elliptical arc.
tolerancedoubleThe largest distance between the arc and the polyline, in decimal degrees; see DefaultTolerance. It is applied to the circle of the ellipse's major axis, which bounds the distance on the ellipse.
multiplicationFactorintThe coordinate multiplication factor (COMF) of the data set, which converts the tolerance to coordinate units.
Returns
- IReadOnlyList<S57Coordinate2D>
The polyline, from the arc's start point to its end point.
Exceptions
- ArgumentOutOfRangeException
toleranceisn't positive, ormultiplicationFactorisn't positive.
Densify(S57EllipticalArc, int)
Densifies an elliptical arc into a polyline of a given number of segments.
public static IReadOnlyList<S57Coordinate2D> Densify(S57EllipticalArc arc, int segmentCount)
Parameters
arcS57EllipticalArcThe elliptical arc.
segmentCountintThe number of straight segments, from 1 to MaximumSegmentCount.
Returns
- IReadOnlyList<S57Coordinate2D>
The polyline, from the arc's start point to its end point.
Exceptions
- ArgumentOutOfRangeException
segmentCountis out of range.
Densify(IReadOnlyList<S57ArcCurve>, double, int)
Densifies a sequence of arc/curve definitions, such as those of an edge, into a single polyline.
public static IReadOnlyList<S57Coordinate2D> Densify(IReadOnlyList<S57ArcCurve> curves, double tolerance, int multiplicationFactor)
Parameters
curvesIReadOnlyList<S57ArcCurve>The arc/curve definitions, in order.
tolerancedoubleThe largest distance between an arc and the polyline, in decimal degrees; see DefaultTolerance.
multiplicationFactorintThe coordinate multiplication factor (COMF) of the data set.
Returns
- IReadOnlyList<S57Coordinate2D>
The polyline.
Exceptions
- ArgumentNullException
curvesisnull.- ArgumentOutOfRangeException
toleranceisn't positive, ormultiplicationFactorisn't positive.