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 TestBoundingBox() { var theMesh = new GlobalMesh(1000); var nr = theMesh.MeshNumber(Constants.MyHome); var ll = theMesh.LowerLeft(nr); var lr = theMesh.LowerRight(nr); var ul = theMesh.UpperLeft(nr); var ur = theMesh.UpperRight(nr); Assert.AreEqual(ll.X, ul.X); Assert.AreEqual(lr.X, ur.X); Assert.AreEqual(ll.Y, lr.Y); Assert.AreEqual(ul.Y, ur.Y); }
public void TestNeighborHood() { var theMesh = new GlobalMesh(1000); var nr = theMesh.MeshNumber(Constants.MyHome); var n0 = theMesh.Neighborhood(nr, 0); Assert.AreEqual(n0.Count, 1); Assert.AreEqual(n0[0], nr); var n1 = theMesh.Neighborhood(nr, 1); Assert.AreEqual(n1.Count, 8); var n2 = theMesh.Neighborhood(nr, 2); Assert.AreEqual(n2.Count, 16); var n3 = theMesh.Neighborhood(nr, 3); Assert.AreEqual(n3.Count, 24); }
public void TestNeighborHood() { var theMesh = new GlobalMesh(1000); var nr = theMesh.MeshNumber(Constants.MyHome); var n0 = theMesh.Neighborhood(nr, 0); Assert.IsTrue(n0.Count == 1); Assert.AreEqual(nr, n0[0]); var n1 = theMesh.Neighborhood(nr, 1); Assert.AreEqual(8, n1.Count); var n2 = theMesh.Neighborhood(nr, 2); Assert.AreEqual(16, n2.Count); var n3 = theMesh.Neighborhood(nr, 3); Assert.AreEqual(24, n3.Count); }
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); }