PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwpoint_get_ordinate()

double lwpoint_get_ordinate ( const POINT4D p,
char  ordinate 
)

Given a POINT4D and an ordinate number, return the value of the ordinate.

Parameters
pinput point
ordinatenumber (1=x, 2=y, 3=z, 4=m)
Returns
d value at that ordinate

Definition at line 251 of file lwlinearreferencing.c.

252 {
253  if ( ! p )
254  {
255  lwerror("Null input geometry.");
256  return 0.0;
257  }
258 
259  if ( ! ( ordinate == 'X' || ordinate == 'Y' || ordinate == 'Z' || ordinate == 'M' ) )
260  {
261  lwerror("Cannot extract %c ordinate.", ordinate);
262  return 0.0;
263  }
264 
265  if ( ordinate == 'X' )
266  return p->x;
267  if ( ordinate == 'Y' )
268  return p->y;
269  if ( ordinate == 'Z' )
270  return p->z;
271  if ( ordinate == 'M' )
272  return p->m;
273 
274  /* X */
275  return p->x;
276 
277 }
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
double m
Definition: liblwgeom.h:355
double x
Definition: liblwgeom.h:355
double z
Definition: liblwgeom.h:355
double y
Definition: liblwgeom.h:355

References lwerror(), POINT4D::m, POINT4D::x, POINT4D::y, and POINT4D::z.

Referenced by lwline_clip_to_ordinate_range(), lwmpoint_clip_to_ordinate_range(), lwpoint_clip_to_ordinate_range(), point_interpolate(), and test_lwpoint_get_ordinate().

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