PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ normalize2d()

static void normalize2d ( POINT2D p)
static

Normalize to a unit vector.

Definition at line 474 of file lwgeodetic.c.

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

Referenced by edge_calculate_gbox().

475 {
476  double d = sqrt(p->x*p->x + p->y*p->y);
477  if (FP_IS_ZERO(d))
478  {
479  p->x = p->y = 0.0;
480  return;
481  }
482  p->x = p->x / d;
483  p->y = p->y / d;
484  return;
485 }
#define FP_IS_ZERO(A)
double x
Definition: liblwgeom.h:312
double y
Definition: liblwgeom.h:312
Here is the caller graph for this function: