intersect.c File Reference

#include <stdlib.h>
#include <math.h>
#include <grass/gis.h>
#include <grass/Vect.h>

Include dependency graph for intersect.c:

Go to the source code of this file.

Data Structures

struct  CROSS

Defines

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

Functions

int Vect_segment_intersection (double ax1, double ay1, double az1, double ax2, double ay2, double az2, double bx1, double by1, double bz1, double bx2, double by2, double bz2, double *x1, double *y1, double *z1, double *x2, double *y2, double *z2, int with_z)
 check for intersect of 2 line segments
int Vect_line_intersection (struct line_pnts *APoints, struct line_pnts *BPoints, struct line_pnts ***ALines, struct line_pnts ***BLines, int *nalines, int *nblines, int with_z)
int Vect_line_check_intersection (struct line_pnts *APoints, struct line_pnts *BPoints, int with_z)
 Check if 2 lines intersect. Points (Points->n_points == 1) are also supported.


Define Documentation

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

Definition at line 48 of file intersect.c.

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

Definition at line 49 of file intersect.c.

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

Definition at line 50 of file intersect.c.


Function Documentation

int Vect_line_check_intersection ( struct line_pnts *  APoints,
struct line_pnts *  BPoints,
int  with_z 
)

Check if 2 lines intersect. Points (Points->n_points == 1) are also supported.

Returns:
0 no intersection

1 intersection found

Parameters:
APoints first input line
BPoints second input line
with_z 3D, not supported (only if one or both are points) !

Definition at line 926 of file intersect.c.

References Rect::boundary, find_cross(), RTreeDestroyNode(), RTreeInsertRect(), RTreeNewIndex(), RTreeSearch(), and Vect_line_distance().

Referenced by Vect_select_lines_by_polygon().

int Vect_line_intersection ( struct line_pnts *  APoints,
struct line_pnts *  BPoints,
struct line_pnts ***  ALines,
struct line_pnts ***  BLines,
int *  nalines,
int *  nblines,
int  with_z 
)

int Vect_segment_intersection ( double  ax1,
double  ay1,
double  az1,
double  ax2,
double  ay2,
double  az2,
double  bx1,
double  by1,
double  bz1,
double  bx2,
double  by2,
double  bz2,
double *  x1,
double *  y1,
double *  z1,
double *  x2,
double *  y2,
double *  z2,
int  with_z 
)

check for intersect of 2 line segments

Returns:
0 - do not intersect, 1 - intersect at one point, 2 - partial overlap, 3 - a contains b, 4 - b contains a, 5 - identical
Parameters:
input line a, input line b, intersection point1 (case 2-4), intersection point2 (case 2-4), use z coordinate (3D)

Definition at line 107 of file intersect.c.

References D, D1, and D2.


Generated on Sun Apr 6 17:32:49 2008 for GRASS by  doxygen 1.5.5