PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void normalize2d ( POINT2D p)
static

Normalize to a unit vector.

Definition at line 473 of file lwgeodetic.c.

References FP_IS_ZERO, POINT2D::x, and POINT2D::y.

Referenced by edge_calculate_gbox().

474 {
475  double d = sqrt(p->x*p->x + p->y*p->y);
476  if (FP_IS_ZERO(d))
477  {
478  p->x = p->y = 0.0;
479  return;
480  }
481  p->x = p->x / d;
482  p->y = p->y / d;
483  return;
484 }
#define FP_IS_ZERO(A)
double x
Definition: liblwgeom.h:284
double y
Definition: liblwgeom.h:284

Here is the caller graph for this function: