public void ComputeAreaTest() { double expected = 1612.1563d; double actual = PolygonalUtil.ComputeArea(_path); Assert.AreEqual(expected, actual, 4, "Signed area calculation is inaccurate"); }
public void ToRadiansTest() { double degrees = 90d; double expected = 1.5707; double actual = PolygonalUtil.ToRadians(degrees); Assert.AreEqual(expected, actual, 4, "Inaccurate degrees to radians conversion"); }
public double GetArea(bool isDrawing = false) { if (_areaNeedsUpdate) { // If the polygon is currently being drawn, it is not // part of the polygon therefore it needs to be ignored _area = PolygonalUtil.ComputeArea(!isDrawing ? Points : Points.Take(Points.Count - 1).ToList()); } _areaNeedsUpdate = false; return(_area); }