PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ normalize2d()

static void normalize2d ( POINT2D p)
static

Normalize to a unit vector.

Definition at line 493 of file lwgeodetic.c.

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

Referenced by edge_calculate_gbox().

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