#include <stdlib.h>
#include <math.h>
#include <grass/gis.h>
#include <grass/Vect.h>
#include <grass/glocale.h>
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) |
Intersect 2 lines. | |
int | Vect_line_check_intersection (struct line_pnts *APoints, struct line_pnts *BPoints, int with_z) |
Check if 2 lines intersect. | |
int | Vect_line_get_intersections (struct line_pnts *APoints, struct line_pnts *BPoints, struct line_pnts *IPoints, int with_z) |
Get 2 lines intersection points. |
Higher level functions for reading/writing/manipulating vectors.
(C) 2001-2008 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.
Definition in file intersect.c.
#define D ((ax2-ax1)*(by1-by2) - (ay2-ay1)*(bx1-bx2)) |
Definition at line 52 of file intersect.c.
#define D1 ((bx1-ax1)*(by1-by2) - (by1-ay1)*(bx1-bx2)) |
Definition at line 53 of file intersect.c.
#define D2 ((ax2-ax1)*(by1-ay1) - (ay2-ay1)*(bx1-ax1)) |
Definition at line 54 of file intersect.c.
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.
[in] | APoints | first input line |
[in] | BPoints | second input line |
[in] | with_z | 3D, not supported (only if one or both are points)! |
1 intersection found
Definition at line 1131 of file intersect.c.
References Rect::boundary, RTreeDestroyNode(), RTreeInsertRect(), RTreeNewIndex(), RTreeSearch(), Vect_copy_xyz_to_pnts(), Vect_line_distance(), and Vect_new_line_struct().
Referenced by Vect_line_get_intersections(), Vect_select_lines_by_polygon(), and Vedit_bulk_labeling().
int Vect_line_get_intersections | ( | struct line_pnts * | APoints, | |
struct line_pnts * | BPoints, | |||
struct line_pnts * | IPoints, | |||
int | with_z | |||
) |
Get 2 lines intersection points.
A wrapper around Vect_line_check_intersection() function.
[in] | APoints | first input line |
[in] | BPoints | second input line |
[out] | IPoints | output with intersection points |
[in] | with_z | 3D, not supported (only if one or both are points)! |
1 intersection found
Definition at line 1306 of file intersect.c.
References Vect_line_check_intersection().
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 | |||
) |
Intersect 2 lines.
Creates array of new lines created from original A line, by intersection with B line. Points (Points->n_points == 1) are not supported.
[in] | APoints | first input line |
[in] | BPoints | second input line |
[out] | ALines | array of new lines created from original A line |
[out] | BLines | array of new lines created from original B line |
[out] | nalines | number of new lines (ALines) |
[out] | nblines | number of new lines (BLines) |
[in] | with_z | 3D, not supported! |
1 intersection found
Definition at line 601 of file intersect.c.
References Rect::boundary, dig_line_degenerate(), CROSS::distance, RTreeDestroyNode(), RTreeInsertRect(), RTreeNewIndex(), RTreeSearch(), CROSS::segment, Vect_append_point(), Vect_destroy_line_struct(), Vect_new_line_struct(), CROSS::x, and CROSS::y.
Referenced by Vect_break_lines_list(), and Vedit_bulk_labeling().
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.
[in] | ax1,ay1,az1,ax2,ay2,az2 | input line a |
[in] | bx1,by1,bz1,bx2,by2,bz2 | input line b |
[out] | x1,y1,z1 | intersection point1 (case 2-4) |
[out] | x2,y2,z2 | intersection point2 (case 2-4) |
[in] | with_z | use z coordinate (3D) (TODO) |
1 - intersect at one point,
2 - partial overlap,
3 - a contains b,
4 - b contains a,
5 - identical
Definition at line 109 of file intersect.c.