PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ test_vector_rotate()

static void test_vector_rotate ( void  )
static

Definition at line 1490 of file cu_geodetic.c.

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

Referenced by geodetic_suite_setup().

1491 {
1492  POINT3D p1, p2, n;
1493  double angle;
1494 
1495  memset(&p1, 0, sizeof(POINT3D));
1496  memset(&p2, 0, sizeof(POINT3D));
1497  memset(&n, 0, sizeof(POINT3D));
1498 
1499  p1.x = 1.0;
1500  p2.y = 1.0;
1501  angle = M_PI_4;
1502  vector_rotate(&p1, &p2, angle, &n);
1503  //printf("%g %g %g\n\n", n.x, n.y, n.z);
1504  CU_ASSERT_DOUBLE_EQUAL(n.x, 0.707107, 0.00001);
1505 
1506  angle = 2*M_PI/400000000;
1507  vector_rotate(&p1, &p2, angle, &n);
1508  //printf("%.21g %.21g %.21g\n\n", n.x, n.y, n.z);
1509  CU_ASSERT_DOUBLE_EQUAL(n.x, 0.999999999999999888978, 0.0000000000000001);
1510  CU_ASSERT_DOUBLE_EQUAL(n.y, 1.57079632679489654446e-08, 0.0000000000000001);
1511 
1512  angle = 0;
1513  vector_rotate(&p1, &p2, angle, &n);
1514  //printf("%.16g %.16g %.16g\n\n", n.x, n.y, n.z);
1515  CU_ASSERT_DOUBLE_EQUAL(n.x, 1.0, 0.00000001);
1516 }
double y
Definition: liblwgeom.h:339
double x
Definition: liblwgeom.h:339
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:538
Here is the call graph for this function:
Here is the caller graph for this function: