Vlib/poly.c File Reference

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

Include dependency graph for Vlib/poly.c:

Go to the source code of this file.

Data Structures

struct  Slink

Functions

int Vect__intersect_line_with_poly ()
int Vect_get_point_in_area (struct Map_info *Map, int area, double *X, double *Y)
 get point inside area and outside all islands Take a line and intersect it with the polygon and any islands. sort the list of X values from these intersections. This will be a list of segments alternating IN/OUT/IN/OUT of the polygon. Pick the largest IN segment and take the midpoint.
int Vect__intersect_line_with_poly (struct line_pnts *Points, double y, struct line_pnts *Inter)
int Vect_get_point_in_poly (struct line_pnts *Points, double *X, double *Y)
 get point inside polygon. This does NOT consider ISLANDS!
int Vect_find_poly_centroid (struct line_pnts *points, double *cent_x, double *cent_y)
 get centroid of polygon
int Vect_get_point_in_poly_isl (struct line_pnts *Points, struct line_pnts **IPoints, int n_isles, double *att_x, double *att_y)
 get point inside polygon but outside the islands specifiled in IPoints. Take a line and intersect it with the polygon and any islands. sort the list of X values from these intersections. This will be a list of segments alternating IN/OUT/IN/OUt of the polygon. Pick the largest IN segment and take the midpoint.
int segments_x_ray (double X, double Y, struct line_pnts *Points)
int Vect_point_in_poly (double X, double Y, struct line_pnts *Points)
int Vect_point_in_area_outer_ring (double X, double Y, struct Map_info *Map, int area)
int Vect_point_in_island (double X, double Y, struct Map_info *Map, int isle)


Function Documentation

int segments_x_ray ( double  X,
double  Y,
struct line_pnts *  Points 
)

int Vect__intersect_line_with_poly ( struct line_pnts *  Points,
double  y,
struct line_pnts *  Inter 
)

Definition at line 127 of file Vlib/poly.c.

References Vect_append_point().

int Vect__intersect_line_with_poly (  ) 

int Vect_find_poly_centroid ( struct line_pnts *  points,
double *  cent_x,
double *  cent_y 
)

get centroid of polygon

Returns:
0 on success, -1 on error
Parameters:
line_pnts * structure, x, y of centroid

Definition at line 316 of file Vlib/poly.c.

Referenced by clean_parallel(), Vect_get_point_in_poly(), and Vect_get_point_in_poly_isl().

int Vect_get_point_in_area ( struct Map_info *  Map,
int  area,
double *  X,
double *  Y 
)

get point inside area and outside all islands Take a line and intersect it with the polygon and any islands. sort the list of X values from these intersections. This will be a list of segments alternating IN/OUT/IN/OUT of the polygon. Pick the largest IN segment and take the midpoint.

Returns:
0 on success, -1 on error
Parameters:
Map_info structure, area number, x, y

Definition at line 51 of file Vlib/poly.c.

References Vect_get_area_isle(), Vect_get_area_num_isles(), Vect_get_area_points(), Vect_get_isle_points(), Vect_get_point_in_poly_isl(), and Vect_new_line_struct().

int Vect_get_point_in_poly ( struct line_pnts *  Points,
double *  X,
double *  Y 
)

get point inside polygon. This does NOT consider ISLANDS!

Returns:
0 on success, -1 on error
Parameters:
line_pnts structure

Definition at line 166 of file Vlib/poly.c.

References Slink::next, Vect_find_poly_centroid(), Vect_point_in_poly(), and Slink::x.

int Vect_get_point_in_poly_isl ( struct line_pnts *  Points,
struct line_pnts **  IPoints,
int  n_isles,
double *  att_x,
double *  att_y 
)

get point inside polygon but outside the islands specifiled in IPoints. Take a line and intersect it with the polygon and any islands. sort the list of X values from these intersections. This will be a list of segments alternating IN/OUT/IN/OUt of the polygon. Pick the largest IN segment and take the midpoint.

Returns:
0 on success, -1 on error
Parameters:
Map_info structure

Definition at line 408 of file Vlib/poly.c.

References Vect__intersect_line_with_poly(), Vect_find_poly_centroid(), Vect_new_line_struct(), and Vect_point_in_poly().

Referenced by Vect_get_point_in_area().

int Vect_point_in_area_outer_ring ( double  X,
double  Y,
struct Map_info *  Map,
int  area 
)

Definition at line 667 of file Vlib/poly.c.

References segments_x_ray(), Vect_new_line_struct(), and Vect_read_line().

Referenced by Vect_isle_find_area(), and Vect_point_in_area().

int Vect_point_in_island ( double  X,
double  Y,
struct Map_info *  Map,
int  isle 
)

Definition at line 724 of file Vlib/poly.c.

References segments_x_ray(), Vect_new_line_struct(), and Vect_read_line().

Referenced by Vect_find_island(), and Vect_point_in_area().

int Vect_point_in_poly ( double  X,
double  Y,
struct line_pnts *  Points 
)


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