PostGIS  2.2.7dev-r@@SVN_REVISION@@
double vector_angle ( const POINT3D v1,
const POINT3D v2 
)

Angle between two unit vectors.

Definition at line 455 of file lwgeodetic.c.

References cross_product(), dot_product(), normalize(), pixval::x, and pixval::y.

Referenced by test_vector_angle().

456 {
457  POINT3D v3, normal;
458  double angle, x, y;
459 
460  cross_product(v1, v2, &normal);
461  normalize(&normal);
462  cross_product(&normal, v1, &v3);
463 
464  x = dot_product(v1, v2);
465  y = dot_product(v2, &v3);
466 
467  angle = atan2(y, x);
468  return angle;
469 }
void normalize(POINT3D *p)
Normalize to a unit vector.
Definition: lwgeodetic.c:565
static double dot_product(const POINT3D *p1, const POINT3D *p2)
Convert cartesion coordinates on unit sphere to lon/lat coordinates static void cart2ll(const POINT3D...
Definition: lwgeodetic.c:396
tuple x
Definition: pixval.py:53
static void cross_product(const POINT3D *a, const POINT3D *b, POINT3D *n)
Calculate the cross product of two vectors.
Definition: lwgeodetic.c:404
tuple y
Definition: pixval.py:54

Here is the call graph for this function:

Here is the caller graph for this function: