PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ test_vector_rotate()

static void test_vector_rotate ( void  )
static

Definition at line 1513 of file cu_geodetic.c.

1514{
1515 POINT3D p1, p2, n;
1516 double angle;
1517
1518 memset(&p1, 0, sizeof(POINT3D));
1519 memset(&p2, 0, sizeof(POINT3D));
1520 memset(&n, 0, sizeof(POINT3D));
1521
1522 p1.x = 1.0;
1523 p2.y = 1.0;
1524 angle = M_PI_4;
1525 vector_rotate(&p1, &p2, angle, &n);
1526 //printf("%g %g %g\n\n", n.x, n.y, n.z);
1527 CU_ASSERT_DOUBLE_EQUAL(n.x, 0.707107, 0.00001);
1528
1529 angle = 2*M_PI/400000000;
1530 vector_rotate(&p1, &p2, angle, &n);
1531 //printf("%.21g %.21g %.21g\n\n", n.x, n.y, n.z);
1532 CU_ASSERT_DOUBLE_EQUAL(n.x, 0.999999999999999888978, 0.0000000000000001);
1533 CU_ASSERT_DOUBLE_EQUAL(n.y, 1.57079632679489654446e-08, 0.0000000000000001);
1534
1535 angle = 0;
1536 vector_rotate(&p1, &p2, angle, &n);
1537 //printf("%.16g %.16g %.16g\n\n", n.x, n.y, n.z);
1538 CU_ASSERT_DOUBLE_EQUAL(n.x, 1.0, 0.00000001);
1539}
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:402
double y
Definition liblwgeom.h:402

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: