PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ normalize2d()

static void normalize2d ( POINT2D p)
static

Normalize to a unit vector.

Definition at line 489 of file lwgeodetic.c.

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

Referenced by edge_calculate_gbox().

490 {
491  double d = sqrt(p->x*p->x + p->y*p->y);
492  if (FP_IS_ZERO(d))
493  {
494  p->x = p->y = 0.0;
495  return;
496  }
497  p->x = p->x / d;
498  p->y = p->y / d;
499  return;
500 }
#define FP_IS_ZERO(A)
double x
Definition: liblwgeom.h:327
double y
Definition: liblwgeom.h:327
Here is the caller graph for this function: