Class Algorithms
Inheritance
Inherited Members
Namespace: Mapsui.Geometries.Utilities
Assembly: Mapsui.Geometries.dll
Syntax
public static class Algorithms
Methods
| Improve this Doc View SourceDegreesToRadians(Double)
Converts the specified angle from degrees to radians
Declaration
public static double DegreesToRadians(double degrees)
Parameters
Type | Name | Description |
---|---|---|
System.Double | degrees | Angle to convert (degrees) |
Returns
Type | Description |
---|---|
System.Double | Returns the angle in radians |
Distance(Point, Point)
Declaration
public static double Distance(Point a, Point b)
Parameters
Type | Name | Description |
---|---|---|
Point | a | |
Point | b |
Returns
Type | Description |
---|---|
System.Double |
Distance(Double, Double, Double, Double)
Gets the euclidean distance between two points.
Declaration
public static double Distance(double x1, double y1, double x2, double y2)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x1 | The first point's X coordinate. |
System.Double | y1 | The first point's Y coordinate. |
System.Double | x2 | The second point's X coordinate. |
System.Double | y2 | The second point's Y coordinate. |
Returns
Type | Description |
---|---|
System.Double |
DistanceToLine(Point, IList<Point>)
Declaration
public static double DistanceToLine(Point point, IList<Point> points)
Parameters
Type | Name | Description |
---|---|---|
Point | point | |
System.Collections.Generic.IList<Point> | points |
Returns
Type | Description |
---|---|
System.Double |
GetDistanceAndSegmentIndex(Point, IList<Point>)
Returns the shortest distance to a line and also the index of the segment with that shortest distance. Segments count from zero to vertex count - 1.
Declaration
public static (double Distance, int Segment) GetDistanceAndSegmentIndex(Point point, IList<Point> points)
Parameters
Type | Name | Description |
---|---|---|
Point | point | |
System.Collections.Generic.IList<Point> | points |
Returns
Type | Description |
---|---|
System.ValueTuple<System.Double, System.Int32> |
IsCCW(LinearRing)
Tests whether a ring is oriented counter-clockwise.
Declaration
public static bool IsCCW(LinearRing ring)
Parameters
Type | Name | Description |
---|---|---|
LinearRing | ring | Ring to test. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if ring is oriented counter-clockwise. |
PointInPolygon(IList<Point>, Point)
Declaration
public static bool PointInPolygon(IList<Point> ring, Point point)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<Point> | ring | |
Point | point |
Returns
Type | Description |
---|---|
System.Boolean |
RotateClockwiseDegrees(Double, Double, Double)
Rotates the specified point clockwise about the origin
Declaration
public static Point RotateClockwiseDegrees(double x, double y, double degrees)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | X coordinate to rotate |
System.Double | y | Y coordinate to rotate |
System.Double | degrees | Angle to rotate (degrees) |
Returns
Type | Description |
---|---|
Point | Returns the rotated point |
RotateClockwiseRadians(Double, Double, Double)
Rotates the specified point clockwise about the origin
Declaration
public static Point RotateClockwiseRadians(double x, double y, double radians)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | X coordinate to rotate |
System.Double | y | Y coordinate to rotate |
System.Double | radians | Angle to rotate (radians) |
Returns
Type | Description |
---|---|
Point | Returns the rotated point |