PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ normalize2d()

static void normalize2d ( POINT2D p)
static

Normalize to a unit vector.

Definition at line 520 of file lwgeodetic.c.

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

Referenced by edge_calculate_gbox().

521 {
522  double d = sqrt(p->x*p->x + p->y*p->y);
523  if (FP_IS_ZERO(d))
524  {
525  p->x = p->y = 0.0;
526  return;
527  }
528  p->x = p->x / d;
529  p->y = p->y / d;
530  return;
531 }
#define FP_IS_ZERO(A)
double x
Definition: liblwgeom.h:328
double y
Definition: liblwgeom.h:328
Here is the caller graph for this function: