PostGIS  2.1.10dev-r@@SVN_REVISION@@
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 229 of file lwlinearreferencing.c.

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().

230 {
231  if ( ! p )
232  {
233  lwerror("Null input geometry.");
234  return 0.0;
235  }
236 
237  if ( ! ( ordinate == 'X' || ordinate == 'Y' || ordinate == 'Z' || ordinate == 'M' ) )
238  {
239  lwerror("Cannot extract %c ordinate.", ordinate);
240  return 0.0;
241  }
242 
243  if ( ordinate == 'X' )
244  return p->x;
245  if ( ordinate == 'Y' )
246  return p->y;
247  if ( ordinate == 'Z' )
248  return p->z;
249  if ( ordinate == 'M' )
250  return p->m;
251 
252  /* X */
253  return p->x;
254 
255 }
double x
Definition: liblwgeom.h:308
double m
Definition: liblwgeom.h:308
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
double z
Definition: liblwgeom.h:308
double y
Definition: liblwgeom.h:308

Here is the call graph for this function:

Here is the caller graph for this function: