PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ test_lwline_clip_big()

static void test_lwline_clip_big ( void  )
static

Definition at line 885 of file cu_algorithm.c.

886 {
887  POINTARRAY *pa = ptarray_construct(1, 0, 3);
888  LWGEOM *line = (LWGEOM *)lwline_construct(SRID_UNKNOWN, NULL, pa);
889  LWCOLLECTION *c;
890  char *ewkt;
891  POINT4D p;
892 
893  p.x = 0.0;
894  p.y = 0.0;
895  p.z = 0.0;
896  ptarray_set_point4d(pa, 0, &p);
897 
898  p.x = 1.0;
899  p.y = 1.0;
900  p.z = 1.0;
901  ptarray_set_point4d(pa, 1, &p);
902 
903  p.x = 2.0;
904  p.y = 2.0;
905  p.z = 2.0;
906  ptarray_set_point4d(pa, 2, &p);
907 
908  c = lwgeom_clip_to_ordinate_range(line, 'Z', 0.5, 1.5, 0);
909  ewkt = lwgeom_to_ewkt((LWGEOM*)c);
910  //printf("c = %s\n", ewkt);
911  ASSERT_STRING_EQUAL(ewkt, "MULTILINESTRING((0.5 0.5 0.5,1 1 1,1.5 1.5 1.5))");
912 
913  lwfree(ewkt);
915  lwgeom_free(line);
916 }
#define ASSERT_STRING_EQUAL(o, e)
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
POINTARRAY * ptarray_construct(char hasz, char hasm, uint32_t npoints)
Construct an empty pointarray, allocating storage and setting the npoints, but not filling in any inf...
Definition: ptarray.c:51
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:547
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
Definition: lwline.c:42
void lwfree(void *mem)
Definition: lwutil.c:242
LWCOLLECTION * lwgeom_clip_to_ordinate_range(const LWGEOM *lwin, char ordinate, double from, double to, double offset)
Given a geometry clip based on the from/to range of one of its ordinates (x, y, z,...
void lwcollection_free(LWCOLLECTION *col)
Definition: lwcollection.c:357
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:229
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
Definition: lwgeom_api.c:376
double x
Definition: liblwgeom.h:400
double z
Definition: liblwgeom.h:400
double y
Definition: liblwgeom.h:400

References ASSERT_STRING_EQUAL, lwcollection_free(), lwfree(), lwgeom_clip_to_ordinate_range(), lwgeom_free(), lwgeom_to_ewkt(), lwline_construct(), ptarray_construct(), ptarray_set_point4d(), SRID_UNKNOWN, POINT4D::x, POINT4D::y, and POINT4D::z.

Referenced by algorithms_suite_setup().

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