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

◆ asx3d3_tin_sb()

static int asx3d3_tin_sb ( const LWTIN tin,
int  precision,
int  opts,
const char *  defid,
stringbuffer_t sb 
)
static

Fill in triangle index

Definition at line 414 of file lwout_x3d.c.

415{
416 uint32_t i;
417 uint32_t k;
418 /* int dimension=2; */
419
420 stringbuffer_aprintf(sb,"<IndexedTriangleSet %s index='",defid);
421 k = 0;
423 for (i=0; i<tin->ngeoms; i++)
424 {
425 stringbuffer_aprintf(sb, "%d %d %d", k, (k+1), (k+2));
426 if (i < (tin->ngeoms - 1) )
427 {
428 stringbuffer_aprintf(sb, " ");
429 }
430 k += 3;
431 }
432
433 if ( X3D_USE_GEOCOORDS(opts) ) stringbuffer_aprintf(sb, "'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"%s\"' point='", ( (opts & LW_X3D_FLIP_XY) ? "latitude_first" : "longitude_first") );
434 else stringbuffer_aprintf(sb, "'><Coordinate point='");
435
436 for (i=0; i<tin->ngeoms; i++)
437 {
438 asx3d3_triangle_sb(tin->geoms[i], precision, opts, defid, sb);
439 if (i < (tin->ngeoms - 1) )
440 {
441 stringbuffer_aprintf(sb, " ");
442 }
443 }
444
445 /* Close outmost tag */
446
447 return stringbuffer_aprintf(sb, "'/></IndexedTriangleSet>");
448}
static uint8_t precision
Definition cu_in_twkb.c:25
#define LW_X3D_FLIP_XY
Macros for specifying X3D options.
Definition liblwgeom.h:1730
#define X3D_USE_GEOCOORDS(x)
Definition liblwgeom.h:1732
static int asx3d3_triangle_sb(const LWTRIANGLE *triangle, int precision, int opts, __attribute__((__unused__)) const char *defid, stringbuffer_t *sb)
Definition lwout_x3d.c:268
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.
uint32_t ngeoms
Definition liblwgeom.h:664
LWTRIANGLE ** geoms
Definition liblwgeom.h:659

References asx3d3_triangle_sb(), LWTIN::geoms, LW_X3D_FLIP_XY, LWTIN::ngeoms, precision, stringbuffer_aprintf(), and X3D_USE_GEOCOORDS.

Referenced by asx3d3_collection_sb(), and lwgeom_to_x3d3_sb().

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