private double GetAngleDifference(Coordinate coordinate1, Coordinate coordinate2, Coordinate coordinate3) { var angle1 = AngleUtility.ToDegrees(AngleUtility.Angle(coordinate1, coordinate2)); var angle2 = AngleUtility.ToDegrees(AngleUtility.Angle(coordinate2, coordinate3)); return(Math.Abs(angle2 - angle1)); }
public void linesegment_handles_orientation() { LineSegment lineSegment1 = new LineSegment(new Coordinate(1, 1), new Coordinate(2, 2)); LineSegment lineSegment2 = new LineSegment(new Coordinate(2, 2), new Coordinate(1, 1)); double angle1 = AngleUtility.ToDegrees(lineSegment1.Angle); double angle2 = AngleUtility.ToDegrees(lineSegment2.Angle); Assert.AreEqual(45d, angle1); Assert.AreEqual(-135d, angle2); }
public void angle_utility_handles_orientation() { LineString lineString1 = new LineString(new[] { new Coordinate(1, 1), new Coordinate(2, 2) }); LineString lineString2 = new LineString(new[] { new Coordinate(2, 2), new Coordinate(1, 1) }); double angle1 = AngleUtility.ToDegrees( AngleUtility.Angle(lineString1.StartPoint.Coordinate, lineString1.EndPoint.Coordinate)); double angle2 = AngleUtility.ToDegrees( AngleUtility.Angle(lineString2.StartPoint.Coordinate, lineString2.EndPoint.Coordinate)); Assert.AreEqual(45d, angle1); Assert.AreEqual(-135d, angle2); }