예제 #1
0
static int EmptyPoly() {
  struct geod_geodesic g;
  struct geod_polygon p;
  double perim, area;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_polygon_init(&p, 0);
  geod_polygon_testpoint(&g, &p, 1, 1, 0, 1, &area, &perim);
  result += area == 0 ? 0 : 1;
  result += perim == 0 ? 0 : 1;
  geod_polygon_testedge(&g, &p, 90, 1000, 0, 1, &area, &perim);
  result += checkNaN(area);
  result += checkNaN(perim);
  geod_polygon_compute(&g, &p, 0, 1, &area, &perim);
  result += area == 0 ? 0 : 1;
  result += perim == 0 ? 0 : 1;
  geod_polygon_init(&p, 1);
  geod_polygon_testpoint(&g, &p, 1, 1, 0, 1, nullptr, &perim);
  result += perim == 0 ? 0 : 1;
  geod_polygon_testedge(&g, &p, 90, 1000, 0, 1, nullptr, &perim);
  result += checkNaN(perim);
  geod_polygon_compute(&g, &p, 0, 1, nullptr, &perim);
  result += perim == 0 ? 0 : 1;
  geod_polygon_addpoint(&g, &p, 1, 1);
  geod_polygon_testedge(&g, &p, 90, 1000, 0, 1, nullptr, &perim);
  result += checkEquals(perim, 1000, 1e-10);
  geod_polygon_testpoint(&g, &p, 2, 2, 0, 1, nullptr, &perim);
  result += checkEquals(perim, 156876.149, 0.5e-3);
  return result;
}
예제 #2
0
void SwapTwoLists::run()
{
    SList newList;
    SList otherList;
    std::string str1 = "foo";
    std::string str2 = "bar";
    std::string str3 = "baz";
    std::string str4 = "far";
    std::string str5 = "faz";
    newList.push_front(str1);
    newList.push_front(str2);
    newList.push_front(str3);
    otherList.push_front(str4);
    otherList.push_front(str5);
    newList.swap(otherList);

    checkEquals(newList.front(), str5);
    newList.pop_front();
    checkEquals(newList.front(), str4);

    checkEquals(otherList.front(), str3);
    otherList.pop_front();
    checkEquals(otherList.front(), str2);
    otherList.pop_front();
    checkEquals(otherList.front(), str1);
}
예제 #3
0
static int Planimeter0() {
  /* Check fix for pole-encircling bug found 2011-03-16 */
  double pa[4][2] = {{89, 0}, {89, 90}, {89, 180}, {89, 270}};
  double pb[4][2] = {{-89, 0}, {-89, 90}, {-89, 180}, {-89, 270}};
  double pc[4][2] = {{0, -1}, {-1, 0}, {0, 1}, {1, 0}};
  double pd[3][2] = {{90, 0}, {0, 0}, {0, 90}};
  struct geod_geodesic g;
  double perimeter, area;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);

  planimeter(&g, pa, 4, &perimeter, &area);
  result += checkEquals(perimeter, 631819.8745, 1e-4);
  result += checkEquals(area, 24952305678.0, 1);

  planimeter(&g, pb, 4, &perimeter, &area);
  result += checkEquals(perimeter, 631819.8745, 1e-4);
  result += checkEquals(area, -24952305678.0, 1);

  planimeter(&g, pc, 4, &perimeter, &area);
  result += checkEquals(perimeter, 627598.2731, 1e-4);
  result += checkEquals(area, 24619419146.0, 1);

  planimeter(&g, pd, 3, &perimeter, &area);
  result += checkEquals(perimeter, 30022685, 1);
  result += checkEquals(area, 63758202715511.0, 1);

  polylength(&g, pd, 3, &perimeter);
  result += checkEquals(perimeter, 20020719, 1);

  return result;
}
예제 #4
0
static int GeodSolve0() {
  double azi1, azi2, s12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_inverse(&g, 40.6, -73.8, 49.01666667, 2.55, &s12, &azi1, &azi2);
  result += checkEquals(azi1, 53.47022, 0.5e-5);
  result += checkEquals(azi2, 111.59367, 0.5e-5);
  result += checkEquals(s12, 5853226, 0.5);
  return result;
}
예제 #5
0
static int GeodSolve78() {
  /* An example where the NGS calculator fails to converge */
  double azi1, azi2, s12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_inverse(&g, 27.2, 0.0, -27.1, 179.5, &s12, &azi1, &azi2);
  result += checkEquals(azi1,  45.82468716758, 0.5e-11);
  result += checkEquals(azi2, 134.22776532670, 0.5e-11);
  result += checkEquals(s12,  19974354.765767, 0.5e-6);
  return result;
}
예제 #6
0
static int Planimeter5() {
  /* Check fix for Planimeter pole crossing bug found 2011-06-24 */
  double points[3][2] = {{89, 0.1}, {89, 90.1}, {89, -179.9}};
  struct geod_geodesic g;
  double perimeter, area;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  planimeter(&g, points, 3, &perimeter, &area);
  result += checkEquals(perimeter, 539297, 1);
  result += checkEquals(area, 12476152838.5, 1);
  return result;
}
예제 #7
0
static int Planimeter12() {
  /* Area of arctic circle (not really -- adjunct to rhumb-area test) */
  double points[2][2] = {{66.562222222, 0}, {66.562222222, 180}};
  struct geod_geodesic g;
  double perimeter, area;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  planimeter(&g, points, 2, &perimeter, &area);
  result += checkEquals(perimeter, 10465729, 1);
  result += checkEquals(area, 0, 1);
  return result;
}
예제 #8
0
static int GeodSolve1() {
  double lat2, lon2, azi2;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_direct(&g, 40.63972222, -73.77888889, 53.5, 5850e3,
              &lat2, &lon2, &azi2);
  result += checkEquals(lat2, 49.01467, 0.5e-5);
  result += checkEquals(lon2, 2.56106, 0.5e-5);
  result += checkEquals(azi2, 111.62947, 0.5e-5);
  return result;
}
예제 #9
0
static int GeodSolve59() {
  /* Check for points close with longitudes close to 180 deg apart. */
  double azi1, azi2, s12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_inverse(&g, 5, 0.00000000000001, 10, 180, &s12, &azi1, &azi2);
  result += checkEquals(azi1, 0.000000000000035, 1.5e-14);
  result += checkEquals(azi2, 179.99999999999996, 1.5e-14);
  result += checkEquals(s12, 18345191.174332713, 5e-9);
  return result;
}
예제 #10
0
static int Planimeter13() {
  /* Check encircling pole twice */
  double points[6][2] = {{89,-360}, {89,-240}, {89,-120},
                         {89,0}, {89,120}, {89,240}};
  struct geod_geodesic g;
  double perimeter, area;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  planimeter(&g, points, 6, &perimeter, &area);
  result += checkEquals(perimeter, 1160741, 1);
  result += checkEquals(area, 32415230256.0, 1);
  return result;
}
예제 #11
0
static int GeodSolve12() {
  /* Check fix for inverse geodesics on extreme prolate/oblate
   * ellipsoids Reported 2012-08-29 Stefan Guenther
   * <*****@*****.**>; fixed 2012-10-07 */
  double azi1, azi2, s12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, 89.8, -1.83);
  geod_inverse(&g, 0, 0, -10, 160, &s12, &azi1, &azi2);
  result += checkEquals(azi1, 120.27, 1e-2);
  result += checkEquals(azi2, 105.15, 1e-2);
  result += checkEquals(s12, 266.7, 1e-1);
  return result;
}
예제 #12
0
static int GeodSolve71() {
  /* Check that DirectLine sets s13. */
  double lat2, lon2, azi2;
  struct geod_geodesic g;
  struct geod_geodesicline l;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_directline(&l, &g, 1, 2, 45, 1e7, 0);
  geod_position(&l, 0.5 * l.s13, &lat2, &lon2, &azi2);
  result += checkEquals(lat2, 30.92625, 0.5e-5);
  result += checkEquals(lon2, 37.54640, 0.5e-5);
  result += checkEquals(azi2, 55.43104, 0.5e-5);
  return result;
}
예제 #13
0
static int Planimeter6() {
  /* Check fix for Planimeter lon12 rounding bug found 2012-12-03 */
  double pa[3][2] = {{9, -0.00000000000001}, {9, 180}, {9, 0}};
  double pb[3][2] = {{9, 0.00000000000001}, {9, 0}, {9, 180}};
  double pc[3][2] = {{9, 0.00000000000001}, {9, 180}, {9, 0}};
  double pd[3][2] = {{9, -0.00000000000001}, {9, 0}, {9, 180}};
  struct geod_geodesic g;
  double perimeter, area;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);

  planimeter(&g, pa, 3, &perimeter, &area);
  result += checkEquals(perimeter, 36026861, 1);
  result += checkEquals(area, 0, 1);
  planimeter(&g, pb, 3, &perimeter, &area);
  result += checkEquals(perimeter, 36026861, 1);
  result += checkEquals(area, 0, 1);
  planimeter(&g, pc, 3, &perimeter, &area);
  result += checkEquals(perimeter, 36026861, 1);
  result += checkEquals(area, 0, 1);
  planimeter(&g, pd, 3, &perimeter, &area);
  result += checkEquals(perimeter, 36026861, 1);
  result += checkEquals(area, 0, 1);
  return result;
}
예제 #14
0
static int GeodSolve76() {
  /* The distance from Wellington and Salamanca (a classic failure of
     Vincenty) */
  double azi1, azi2, s12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_inverse(&g, -(41+19/60.0), 174+49/60.0, 40+58/60.0, -(5+30/60.0),
               &s12, &azi1, &azi2);
  result += checkEquals(azi1, 160.39137649664, 0.5e-11);
  result += checkEquals(azi2,  19.50042925176, 0.5e-11);
  result += checkEquals(s12,  19960543.857179, 0.5e-6);
  return result;
}
예제 #15
0
static int testarcdirect() {
  double lat1, lon1, azi1, lat2, lon2, azi2, s12, a12, m12, M12, M21, S12;
  double lat2a, lon2a, azi2a, s12a, m12a, M12a, M21a, S12a;
  struct geod_geodesic g;
  int i, result = 0;
  unsigned flags = GEOD_ARCMODE | GEOD_LONG_UNROLL;
  geod_init(&g, wgs84_a, wgs84_f);
  for (i = 0; i < ncases; ++i) {
    lat1 = testcases[i][0]; lon1 = testcases[i][1]; azi1 = testcases[i][2];
    lat2 = testcases[i][3]; lon2 = testcases[i][4]; azi2 = testcases[i][5];
    s12 = testcases[i][6]; a12 = testcases[i][7]; m12 = testcases[i][8];
    M12 = testcases[i][9]; M21 = testcases[i][10]; S12 = testcases[i][11];
    geod_gendirect(&g, lat1, lon1, azi1, flags, a12,
                   &lat2a, &lon2a, &azi2a, &s12a, &m12a, &M12a, &M21a, &S12a);
    result += checkEquals(lat2, lat2a, 1e-13);
    result += checkEquals(lon2, lon2a, 1e-13);
    result += checkEquals(azi2, azi2a, 1e-13);
    result += checkEquals(s12, s12a, 1e-8);
    result += checkEquals(m12, m12a, 1e-8);
    result += checkEquals(M12, M12a, 1e-15);
    result += checkEquals(M21, M21a, 1e-15);
    result += checkEquals(S12, S12a, 0.1);
  }
  return result;
}
예제 #16
0
static int GeodSolve73() {
  /* Check for backwards from the pole bug reported by Anon on 2016-02-13.
   * This only affected the Java implementation.  It was introduced in Java
   * version 1.44 and fixed in 1.46-SNAPSHOT on 2016-01-17. */
  double lat2, lon2, azi2;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_direct(&g, 90, 10, 180, -1e6,
              &lat2, &lon2, &azi2);
  result += checkEquals(lat2, 81.04623, 0.5e-5);
  result += checkEquals(lon2, -170, 0.5e-5);
  result += azi2 == 0 ? 0 : 1;
  result += 1/azi2 > 0 ? 0 : 1; /* Check that azi2 = +0.0 not -0.0 */
  return result;
}
예제 #17
0
static int GeodSolve5() {
  /* Check fix for point2=pole bug found 2010-05-03 */
  double lat2, lon2, azi2;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_direct(&g, 0.01777745589997, 30, 0, 10e6, &lat2, &lon2, &azi2);
  result += checkEquals(lat2, 90, 0.5e-5);
  if (lon2 < 0) {
    result += checkEquals(lon2, -150, 0.5e-5);
    result += checkEquals(fabs(azi2), 180, 0.5e-5);
  } else {
    result += checkEquals(lon2, 30, 0.5e-5);
    result += checkEquals(azi2, 0, 0.5e-5);
  }
  return result;
}
예제 #18
0
static int GeodSolve6() {
  /* Check fix for volatile sbet12a bug found 2011-06-25 (gcc 4.4.4
   * x86 -O3).  Found again on 2012-03-27 with tdm-mingw32 (g++ 4.6.1). */
  double s12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_inverse(&g, 88.202499451857, 0,
               -88.202499451857, 179.981022032992859592, &s12, nullptr, nullptr);
  result += checkEquals(s12, 20003898.214, 0.5e-3);
  geod_inverse(&g, 89.262080389218, 0,
               -89.262080389218, 179.992207982775375662, &s12, nullptr, nullptr);
  result += checkEquals(s12, 20003925.854, 0.5e-3);
  geod_inverse(&g, 89.333123580033, 0,
               -89.333123580032997687, 179.99295812360148422, &s12, nullptr, nullptr);
  result += checkEquals(s12, 20003926.881, 0.5e-3);
  return result;
}
예제 #19
0
int main() {
	LoadDictionary("dictionary.txt");
	
	const char * test1results[] = { "ait", "qat", "dae", "quiz", "zed", "zax", "zit", "zea", "aue", "eau", "eat", "adz", "tuque", "ita", "quat", "qua", "uta", "tui", "tix", "tai", "tae", "taxi", "tau", "tax", "tad", "daut", "daze", "zati", "aitu", "adze", "quai", "quad", "quit", "taed" };
	const int test1count = 34;
	const int test1score = 35;
	Results results1 = FindWords("dzxeaiqut", 3, 3);
	checkEquals(results1, test1results, test1count, test1score, "test1");
	FreeWords(results1);

	const char * test2results[] = { "ply", "flir", "eik", "oye", "yuk", "wye", "reik", "wey", "rei", "plue", "ewt", "euk", "ire", "rew", "rue", "tye", "kir", "top", "toph", "lure", "ruly", "toy", "ure", "puer", "tyer", "lie", "yup", "pot", "yew", "fly", "uey", "puli", "upo", "lye", "ilk", "opt", "plu", "lur", "eyot", "kue", "poh", "phot", "pho", "pye", "flukier", "puy", "pul", "hot", "pur", "jot", "joy", "hop", "hoy", "flu", "weir", "oyer", "weil", "plie", "typo", "yeuk", "iure", "pyot", "puir", "pulk", "puly", "pure", "puri", "lire", "lier", "lieu", "erupt", "kilp", "kier", "kuri", "toyer", "glue", "flue", "twyer", "plier", "plyer", "pulik", "gluer", "gluey", "glyph", "fluyt", "fluey", "flier", "flyer", "yukier", "pulier", "gluier", "fluier" };
	const int test2count = 92;
	const int test2score = 117;
	Results results2 = FindWords("qwertyuioplkjhgf", 4, 4);
	checkEquals(results2, test2results, test2count, test2score, "test2");
	FreeWords(results2);

	const char * test3results[] = { "lou", "mol", "cert", "wex", "holk", "rew", "jupon", "mon", "upon", "rec", "rev", "crew", "poh", "rex", "vex", "hom", "mop", "mou", "til", "noh", "nom", "jol", "only", "kit", "lit", "once", "pol", "noup", "pom", "oup", "lop", "ilk", "upo", "hop", "hon", "holy", "wert", "moly", "reck", "trew", "oncer", "vert", "verb", "brew", "moup", "klik", "polk", "poly", "loup", "treck", "ponce" };
	const int test3count = 51;
	const int test3score = 55;
	Results results3 = FindWords("qwertzxcvbmnjklpolkiujhyt", 5, 5);
	checkEquals(results3, test3results, test3count, test3score, "test3");
	FreeWords(results3);

	const char * test4results[] = { "dad", "add", "dada" };
	const int test4count = 3;
	const int test4score = 3;
	Results results4 = FindWords("dadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadadada", 10, 10);
	checkEquals(results4, test4results, test4count, test4score, "test4");
	FreeWords(results4);

	const char * test5results[] = { "not", "bos", "oon", "bone", "tote", "noo", "non", "nebs", "nos", "bosket", "tete", "nek", "tee", "oot", "nonettos", "keb", "ono", "kons", "tot", "bon", "oos", "sot", "ons", "ten", "snoeks", "tet", "ketones", "oke", "sooks", "ton", "bot", "sen", "books", "too", "tene", "otto", "een", "kon", "note", "ene", "obe", "set", "sneb", "boo", "eek", "bet", "toot", "bee", "ben", "tone", "teen", "toetoe", "obo", "bootee", "sob", "one", "skeet", "ket", "tes", "tokens", "toe", "bes", "skeen", "nene", "eon", "ken", "nob", "net", "knees", "nee", "onos", "neb", "betook", "ens", "bonnet", "bete", "son", "neon", "obs", "oes", "bonks", "ose", "see", "nott", "besee", "noon", "nook", "oons", "ketone", "oont", "toes", "tent", "toon", "tons", "beento", "nenes", "kens", "eons", "took", "ebon", "boose", "eten", "book", "boot", "knot", "boon", "bott", "been", "nonbook", "beet", "bene", "koto", "bent", "bonk", "onto", "keto", "seen", "kete", "ones", "keet", "botone", "toko", "toke", "none", "nett", "nete", "tonk", "sone", "teek", "snot", "snob", "sook", "etens", "soot", "neks", "soon", "nobs", "noes", "okes", "nose", "oose", "tose", "beset", "boos", "tenons", "knee", "keen", "sket", "kebs", "besot", "keno", "kent", "knob", "toetoes", "obos", "tees", "ebook", "tens", "sett", "sekt", "sent", "snee", "seek", "sene", "tenon", "skee", "sken", "skeo", "notebook", "esne", "bosk", "bees", "bens", "obes", "enes", "noons", "nooks", "ottos", "tenet", "tenno", "tenne", "toons", "botte", "bonne", "beton", "benet", "benne", "bento", "boons", "tokes", "token", "nonet", "obento", "neons", "snook", "noose", "nones", "tonne", "tonks", "beknot", "teens", "tones", "snoot", "snoke", "snoek", "soote", "nonette", "notes", "bones", "totes", "onset", "boson", "kotos", "keeno", "kenos", "kente", "netes", "teene", "tense", "tetes", "ebons", "sonne", "seton", "sente", "tenes", "betes", "benes", "obese", "nektons", "neese", "betokens", "nebek", "knobs", "tennos", "tennes", "betons", "entetee", "bennet", "bonnes", "bennes", "ketose", "tonnes", "snooks", "snokes", "sootes", "bookoo", "bottes", "ketene", "keenos", "kennet", "nekton", "tenson", "entete", "settee", "sonnes", "setons", "sennet", "sonnet", "beseen", "nebeks", "botonee", "boneset", "betoken", "nonetto", "tonette", "bookoos", "bootees", "kennett", "ketenes", "nonbooks", "botonnee", "nonettes", "tonettes", "nonobese" };
	const int test5count = 274;
	const int test5score = 559;
	Results results5 = FindWords("notebooknotenotesnotnotebooknotenotesnotnotebooknotenotesnotnotebooknotenotesnotnotebooknotenotesnotnotebooknotenotesnotnotebooknotenotesnotnotebooknotenotesnot", 8, 20);
	checkEquals(results5, test5results, test5count, test5score, "test5");
	FreeWords(results5);

	FreeDictionary();

	std::cout << "Done!" << std::endl;

	return 0;
}
예제 #20
0
static int GeodSolve26() {
  /* Check 0/0 problem with area calculation on sphere 2015-09-08 */
  double S12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, 6.4e6, 0);
  geod_geninverse(&g, 1, 2, 3, 4, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &S12);
  result += checkEquals(S12, 49911046115.0, 0.5);
  return result;
}
예제 #21
0
static int GeodSolve28() {
  /* Check for bad placement of assignment of r.a12 with |f| > 0.01 (bug in
   * Java implementation fixed on 2015-05-19). */
  double a12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, 6.4e6, 0.1);
  a12 = geod_gendirect(&g, 1, 2, 10, 0, 5e6, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
  result += checkEquals(a12, 48.55570690, 0.5e-8);
  return result;
}
예제 #22
0
static int GeodSolve4() {
  /* Check fix for short line bug found 2010-05-21 */
  double s12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_inverse(&g, 36.493349428792, 0, 36.49334942879201, .0000008,
               &s12, nullptr, nullptr);
  result += checkEquals(s12, 0.072, 0.5e-3);
  return result;
}
예제 #23
0
static int GeodSolve9() {
  /* Check fix for volatile x bug found 2011-06-25 (gcc 4.4.4 x86 -O3) */
  double s12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_inverse(&g, 56.320923501171, 0,
               -56.320923501171, 179.664747671772880215, &s12, nullptr, nullptr);
  result += checkEquals(s12, 19993558.287, 0.5e-3);
  return result;
}
예제 #24
0
static int GeodSolve15() {
  /* Initial implementation of Math::eatanhe was wrong for e^2 < 0.  This
   * checks that this is fixed. */
  double S12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, 6.4e6, -1/150.0);
  geod_gendirect(&g, 1, 2, 3, 0, 4,
                 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &S12);
  result += checkEquals(S12, 23700, 0.5);
  return result;
}
예제 #25
0
static int GeodSolve11() {
  /* Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio
   * 10 rel + debug) */
  double s12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_inverse(&g, 48.522876735459, 0,
               -48.52287673545898293, 179.599720456223079643, &s12, nullptr, nullptr);
  result += checkEquals(s12, 19989144.774, 0.5e-3);
  return result;
}
예제 #26
0
static int GeodSolve10() {
  /* Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio
   * 10 rel + debug) */
  double s12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_inverse(&g, 52.784459512564, 0,
               -52.784459512563990912, 179.634407464943777557, &s12, nullptr, nullptr);
  result += checkEquals(s12, 19991596.095, 0.5e-3);
  return result;
}
예제 #27
0
static int AddEdge1() {
  /* Check fix to transitdirect vs transit zero handling inconsistency */
  struct geod_geodesic g;
  struct geod_polygon p;
  double area;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  geod_polygon_init(&p, 0);
  geod_polygon_addpoint(&g, &p, 0, 0);
  geod_polygon_addedge(&g, &p,  90, 1000);
  geod_polygon_addedge(&g, &p,   0, 1000);
  geod_polygon_addedge(&g, &p, -90, 1000);
  geod_polygon_compute(&g, &p, 0, 1, &area, nullptr);
  result += checkEquals(area, 1000000.0, 0.01);
  return result;
}
예제 #28
0
static int GeodSolve74() {
  /* Check fix for inaccurate areas, bug introduced in v1.46, fixed
     2015-10-16. */
  double a12, s12, azi1, azi2, m12, M12, M21, S12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, wgs84_a, wgs84_f);
  a12 = geod_geninverse(&g, 54.1589, 15.3872, 54.1591, 15.3877,
                        &s12, &azi1, &azi2, &m12, &M12, &M21, &S12);
  result += checkEquals(azi1, 55.723110355, 5e-9);
  result += checkEquals(azi2, 55.723515675, 5e-9);
  result += checkEquals(s12,  39.527686385, 5e-9);
  result += checkEquals(a12,   0.000355495, 5e-9);
  result += checkEquals(m12,  39.527686385, 5e-9);
  result += checkEquals(M12,   0.999999995, 5e-9);
  result += checkEquals(M21,   0.999999995, 5e-9);
  result += checkEquals(S12, 286698586.30197, 5e-4);
  return result;
}
예제 #29
0
    bool Solver::calcStabilityForColumnB()
    {
        m_stabilityColumnB.resize(m_height, Interval());
        for(size_t i=0; i < m_height; i++)
        {
            Interval vals(
                    -std::numeric_limits<double>::infinity(),
                    std::numeric_limits<double>::infinity()
                    );

            size_t basisj = m_columnInitialBasis[i];
            if(m_limitType[i] == LimitMain)
            {
                for(size_t ii=0; ii < m_height; ii++)
                {
                    if(checkEquals(m_matrixA[ii][basisj], 0.0))
                        continue;

                    double deltab = m_columnB[ii] / m_matrixA[ii][basisj];

                    if(m_funcType == OptimizeToMin)
                        deltab = -deltab;

                    if(deltab < 0)
                    {
                        if(deltab > vals.start())
                             vals.setStart(deltab);
                    }
                    else if(deltab > 0)
                    {
                        if(deltab < vals.end())
                             vals.setEnd(deltab);
                    }
                }

                vals.setStart(m_columnInitialB[i] + vals.start());
                vals.setEnd(m_columnInitialB[i] + vals.end());
            }

            m_stabilityColumnB[i] = vals;
        }

        return true;
    }
예제 #30
0
static int GeodSolve2() {
  /* Check fix for antipodal prolate bug found 2010-09-04 */
  double azi1, azi2, s12;
  struct geod_geodesic g;
  int result = 0;
  geod_init(&g, 6.4e6, -1/150.0);
  geod_inverse(&g, 0.07476, 0, -0.07476, 180, &s12, &azi1, &azi2);
  result += checkEquals(azi1, 90.00078, 0.5e-5);
  result += checkEquals(azi2, 90.00078, 0.5e-5);
  result += checkEquals(s12, 20106193, 0.5);
  geod_inverse(&g, 0.1, 0, -0.1, 180, &s12, &azi1, &azi2);
  result += checkEquals(azi1, 90.00105, 0.5e-5);
  result += checkEquals(azi2, 90.00105, 0.5e-5);
  result += checkEquals(s12, 20106193, 0.5);
  return result;
}