PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ test_vector_rotate()

static void test_vector_rotate ( void  )
static

Definition at line 1496 of file cu_geodetic.c.

1497 {
1498  POINT3D p1, p2, n;
1499  double angle;
1500 
1501  memset(&p1, 0, sizeof(POINT3D));
1502  memset(&p2, 0, sizeof(POINT3D));
1503  memset(&n, 0, sizeof(POINT3D));
1504 
1505  p1.x = 1.0;
1506  p2.y = 1.0;
1507  angle = M_PI_4;
1508  vector_rotate(&p1, &p2, angle, &n);
1509  //printf("%g %g %g\n\n", n.x, n.y, n.z);
1510  CU_ASSERT_DOUBLE_EQUAL(n.x, 0.707107, 0.00001);
1511 
1512  angle = 2*M_PI/400000000;
1513  vector_rotate(&p1, &p2, angle, &n);
1514  //printf("%.21g %.21g %.21g\n\n", n.x, n.y, n.z);
1515  CU_ASSERT_DOUBLE_EQUAL(n.x, 0.999999999999999888978, 0.0000000000000001);
1516  CU_ASSERT_DOUBLE_EQUAL(n.y, 1.57079632679489654446e-08, 0.0000000000000001);
1517 
1518  angle = 0;
1519  vector_rotate(&p1, &p2, angle, &n);
1520  //printf("%.16g %.16g %.16g\n\n", n.x, n.y, n.z);
1521  CU_ASSERT_DOUBLE_EQUAL(n.x, 1.0, 0.00000001);
1522 }
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:573
double x
Definition: liblwgeom.h:343
double y
Definition: liblwgeom.h:343

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

Referenced by geodetic_suite_setup().

Here is the call graph for this function:
Here is the caller graph for this function: