PostGIS  3.6.1dev-r@@SVN_REVISION@@

◆ test_lw_arc_length()

static void test_lw_arc_length ( void  )
static

Definition at line 1124 of file cu_measures.c.

1125 {
1126 /* double lw_arc_length(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3) */
1127 
1128  POINT2D A1, A2, A3;
1129  double d;
1130 
1131  /* Unit semicircle at 0,0 */
1132  A1.x = -1; A1.y = 0;
1133  A2.x = 0 ; A2.y = 1;
1134  A3.x = 1 ; A3.y = 0;
1135 
1136  /* Arc above the unit semicircle */
1137  d = lw_arc_length(&A1, &A2, &A3);
1138  CU_ASSERT_DOUBLE_EQUAL(d, M_PI, 0.000001);
1139  d = lw_arc_length(&A3, &A2, &A1);
1140  CU_ASSERT_DOUBLE_EQUAL(d, M_PI, 0.000001);
1141 
1142  /* Unit semicircle at 0,0 */
1143  A1.x = 0; A1.y = 1;
1144  A2.x = 1; A2.y = 0;
1145  A3.x = 0; A3.y = -1;
1146 
1147  /* Arc to right of the unit semicircle */
1148  d = lw_arc_length(&A1, &A2, &A3);
1149  CU_ASSERT_DOUBLE_EQUAL(d, M_PI, 0.000001);
1150  d = lw_arc_length(&A3, &A2, &A1);
1151  CU_ASSERT_DOUBLE_EQUAL(d, M_PI, 0.000001);
1152 
1153  /* Unit 3/4 circle at 0,0 */
1154  A1.x = -1; A1.y = 0;
1155  A2.x = 1; A2.y = 0;
1156  A3.x = 0; A3.y = -1;
1157 
1158  /* Arc to right of the unit semicircle */
1159  d = lw_arc_length(&A1, &A2, &A3);
1160  CU_ASSERT_DOUBLE_EQUAL(d, 3*M_PI_2, 0.000001);
1161  d = lw_arc_length(&A3, &A2, &A1);
1162  CU_ASSERT_DOUBLE_EQUAL(d, 3*M_PI_2, 0.000001);
1163 }
double lw_arc_length(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3)
Returns the length of a circular arc segment.
Definition: lwalgorithm.c:134
double y
Definition: liblwgeom.h:390
double x
Definition: liblwgeom.h:390

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

Referenced by measures_suite_setup().

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