GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r73001
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
e_intersect.c File Reference

Vector library - intersection (lower level functions) More...

#include <stdlib.h>
#include <math.h>
#include <grass/gis.h>
#include "e_intersect.h"
Include dependency graph for e_intersect.c:

Go to the source code of this file.

Macros

#define SWAP(a, b)   {double t = a; a = b; b = t;}
 
#define MIN(X, Y)   ((X<Y)?X:Y)
 
#define MAX(X, Y)   ((X>Y)?X:Y)
 
#define D   ((ax2-ax1)*(by1-by2) - (ay2-ay1)*(bx1-bx2))
 
#define DA   ((bx1-ax1)*(by1-by2) - (by1-ay1)*(bx1-bx2))
 
#define DB   ((ax2-ax1)*(by1-ay1) - (ay2-ay1)*(bx1-ax1))
 
#define N   52 /* double's mantisa size in bits */
 

Functions

int segment_intersection_2d_tol (double ax1, double ay1, double ax2, double ay2, double bx1, double by1, double bx2, double by2, double *x1, double *y1, double *x2, double *y2, double tol)
 
int segment_intersection_2d (double ax1, double ay1, double ax2, double ay2, double bx1, double by1, double bx2, double by2, double *x1, double *y1, double *x2, double *y2)
 
int almost_equal (double a, double b, int bits)
 

Detailed Description

Vector library - intersection (lower level functions)

Higher level functions for reading/writing/manipulating vectors.

(C) 2008-2009 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Rewritten by Rosen Matev (Google Summer of Code 2008)

Definition in file e_intersect.c.

Macro Definition Documentation

#define D   ((ax2-ax1)*(by1-by2) - (ay2-ay1)*(bx1-bx2))

Definition at line 30 of file e_intersect.c.

Referenced by segment_intersection_2d().

#define DA   ((bx1-ax1)*(by1-by2) - (by1-ay1)*(bx1-bx2))

Definition at line 31 of file e_intersect.c.

Referenced by segment_intersection_2d().

#define DB   ((ax2-ax1)*(by1-ay1) - (ay2-ay1)*(bx1-ax1))

Definition at line 32 of file e_intersect.c.

Referenced by segment_intersection_2d().

#define MAX (   X,
  Y 
)    ((X>Y)?X:Y)

Definition at line 28 of file e_intersect.c.

Referenced by segment_intersection_2d(), and segment_intersection_2d_tol().

#define MIN (   X,
  Y 
)    ((X<Y)?X:Y)

Definition at line 25 of file e_intersect.c.

Referenced by segment_intersection_2d(), and segment_intersection_2d_tol().

#define SWAP (   a,
  b 
)    {double t = a; a = b; b = t;}

Definition at line 23 of file e_intersect.c.

Referenced by segment_intersection_2d().

Function Documentation

int almost_equal ( double  a,
double  b,
int  bits 
)

Definition at line 925 of file e_intersect.c.

References N.

int segment_intersection_2d ( double  ax1,
double  ay1,
double  ax2,
double  ay2,
double  bx1,
double  by1,
double  bx2,
double  by2,
double *  x1,
double *  y1,
double *  x2,
double *  y2 
)

Definition at line 692 of file e_intersect.c.

References D, DA, DB, G_debug(), G_warning(), MAX, MIN, and SWAP.

Referenced by find_all_intersections().

int segment_intersection_2d_tol ( double  ax1,
double  ay1,
double  ax2,
double  ay2,
double  bx1,
double  by1,
double  bx2,
double  by2,
double *  x1,
double *  y1,
double *  x2,
double *  y2,
double  tol 
)

Definition at line 360 of file e_intersect.c.

References FEQUAL, FZERO, G_debug(), G_warning(), MAX, MIN, and t.