PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void test_vector_rotate ( void  )
static

Definition at line 1418 of file cu_geodetic.c.

References vector_rotate(), POINT3D::x, and POINT3D::y.

Referenced by geodetic_suite_setup().

1419 {
1420  POINT3D p1, p2, n;
1421  double angle;
1422 
1423  memset(&p1, 0, sizeof(POINT3D));
1424  memset(&p2, 0, sizeof(POINT3D));
1425  memset(&n, 0, sizeof(POINT3D));
1426 
1427  p1.x = 1.0;
1428  p2.y = 1.0;
1429  angle = M_PI/4;
1430  vector_rotate(&p1, &p2, angle, &n);
1431  //printf("%g %g %g\n\n", n.x, n.y, n.z);
1432  CU_ASSERT_DOUBLE_EQUAL(n.x, 0.707107, 0.00001);
1433 
1434  angle = 2*M_PI/400000000;
1435  vector_rotate(&p1, &p2, angle, &n);
1436  //printf("%.21g %.21g %.21g\n\n", n.x, n.y, n.z);
1437  CU_ASSERT_DOUBLE_EQUAL(n.x, 0.999999999999999888978, 0.0000000000000001);
1438  CU_ASSERT_DOUBLE_EQUAL(n.y, 1.57079632679489654446e-08, 0.0000000000000001);
1439 
1440  angle = 0;
1441  vector_rotate(&p1, &p2, angle, &n);
1442  //printf("%.16g %.16g %.16g\n\n", n.x, n.y, n.z);
1443  CU_ASSERT_DOUBLE_EQUAL(n.x, 1.0, 0.00000001);
1444 }
double y
Definition: liblwgeom.h:296
double x
Definition: liblwgeom.h:296
void vector_rotate(const POINT3D *v1, const POINT3D *v2, double angle, POINT3D *n)
Rotates v1 through an angle (in radians) within the plane defined by v1/v2, returns the rotated vecto...
Definition: lwgeodetic.c:522

Here is the call graph for this function:

Here is the caller graph for this function: