PostGIS  2.3.7dev-r@@SVN_REVISION@@
static void test_lw_arc_length ( void  )
static

Definition at line 813 of file cu_measures.c.

References lw_arc_length(), POINT2D::x, and POINT2D::y.

Referenced by measures_suite_setup().

814 {
815 /* double lw_arc_length(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3) */
816 
817  POINT2D A1, A2, A3;
818  double d;
819 
820  /* Unit semicircle at 0,0 */
821  A1.x = -1; A1.y = 0;
822  A2.x = 0 ; A2.y = 1;
823  A3.x = 1 ; A3.y = 0;
824 
825  /* Arc above the unit semicircle */
826  d = lw_arc_length(&A1, &A2, &A3);
827  CU_ASSERT_DOUBLE_EQUAL(d, M_PI, 0.000001);
828  d = lw_arc_length(&A3, &A2, &A1);
829  CU_ASSERT_DOUBLE_EQUAL(d, M_PI, 0.000001);
830 
831  /* Unit semicircle at 0,0 */
832  A1.x = 0; A1.y = 1;
833  A2.x = 1; A2.y = 0;
834  A3.x = 0; A3.y = -1;
835 
836  /* Arc to right of the unit semicircle */
837  d = lw_arc_length(&A1, &A2, &A3);
838  CU_ASSERT_DOUBLE_EQUAL(d, M_PI, 0.000001);
839  d = lw_arc_length(&A3, &A2, &A1);
840  CU_ASSERT_DOUBLE_EQUAL(d, M_PI, 0.000001);
841 
842  /* Unit 3/4 circle at 0,0 */
843  A1.x = -1; A1.y = 0;
844  A2.x = 1; A2.y = 0;
845  A3.x = 0; A3.y = -1;
846 
847  /* Arc to right of the unit semicircle */
848  d = lw_arc_length(&A1, &A2, &A3);
849  CU_ASSERT_DOUBLE_EQUAL(d, 3*M_PI_2, 0.000001);
850  d = lw_arc_length(&A3, &A2, &A1);
851  CU_ASSERT_DOUBLE_EQUAL(d, 3*M_PI_2, 0.000001);
852 }
double x
Definition: liblwgeom.h:327
double lw_arc_length(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3)
Returns the length of a circular arc segment.
Definition: lwalgorithm.c:118
double y
Definition: liblwgeom.h:327

Here is the call graph for this function:

Here is the caller graph for this function: