MOAB: Mesh Oriented datABase  (version 5.4.1)
arc_intx_tests.cpp
Go to the documentation of this file.
00001 /*
00002  * arc_intx_tests.cpp
00003  */
00004 #include <iostream>
00005 #include <sstream>
00006 #include <ctime>
00007 #include <cstdlib>
00008 #include <cstdio>
00009 #include <cstring>
00010 #include "moab/Types.hpp"
00011 #include "moab/IntxMesh/IntxUtils.hpp"
00012 
00013 #include "TestUtil.hpp"
00014 
00015 using namespace moab;
00016 void test_great_arc_intx()
00017 {
00018     double A[3] = { 0., 0., 1. };
00019     double B[3] = { 1., 0., 0. };
00020     double C[3] = { 0., 0.6, 0.8 };
00021     double D[3] = { 0.6, -0.8, 0. };
00022 
00023     double E[3];
00024     double R       = 1.0;
00025     ErrorCode rval = moab::IntxUtils::intersect_great_circle_arcs( A, B, C, D, R, E );CHECK_ERR( rval );
00026     std::cout << "E: " << E[0] << " " << E[1] << " " << E[2] << "\n";
00027     rval = moab::IntxUtils::intersect_great_circle_arcs( A, C, B, D, R, E );
00028     CHECK( rval == MB_FAILURE );
00029 }
00030 void test_great_arc_clat_intx()
00031 {
00032     double d3   = 1 / sqrt( 3. );
00033     double A[3] = { 0., 0., 1. };
00034     double B[3] = { 1., 0., 0. };
00035     double C[3] = { d3, d3, d3 };
00036     double D[3] = { d3, -d3, d3 };
00037 
00038     double E[9];
00039     double R       = 1.0;
00040     int np         = 0;
00041     ErrorCode rval = moab::IntxUtils::intersect_great_circle_arc_with_clat_arc( A, B, C, D, R, E, np );CHECK_ERR( rval );
00042     std::cout << "E: " << E[0] << " " << E[1] << " " << E[2] << "\n";
00043     double F[3] = { -d3, d3, d3 };
00044     rval        = moab::IntxUtils::intersect_great_circle_arc_with_clat_arc( A, B, C, F, R, E, np );
00045     CHECK( rval == MB_FAILURE );
00046 }
00047 int main()
00048 {
00049     int failures = 0;
00050     failures += RUN_TEST( test_great_arc_intx );
00051     failures += RUN_TEST( test_great_arc_clat_intx );
00052     return failures;
00053 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines