public void TestAllCenters() { var theMesh = new GlobalMesh(25000); for (long mesh = 0; mesh < theMesh.Count; mesh++) { var center = theMesh.CenterOf(mesh); var verify = theMesh.MeshNumber(center); Assert.AreEqual(mesh, verify); } }
public void TestCorners() { var lon = -54.45576937839619; var lat = -34.6821341916981; var point = new GlobalCoordinates(lat, lon); var meshsize = 500; var mesh = new GlobalMesh(meshsize); var meshnumber = mesh.MeshNumber(point); var utmOrig = mesh.Projection.ToEuclidian(point); var utmCenter = mesh.CenterOf(meshnumber); var coord2 = utmCenter.Projection.FromEuclidian(utmCenter); var dist = mesh.Projection.EuclidianDistance(utmOrig, utmCenter); var maxdist = Math.Sqrt(2.0) * meshsize / 2.0; Assert.IsTrue(dist <= maxdist); }