GRASS Programmer's Manual  6.4.1(2011)
buffer2.c File Reference

Vector library - nearest, adjust, parallel lines. More...

#include <stdlib.h>
#include <math.h>
#include <grass/Vect.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include "dgraph.h"
Include dependency graph for buffer2.c:

Go to the source code of this file.

Defines

#define LENGTH(DX, DY)   (sqrt((DX*DX)+(DY*DY)))
#define MIN(X, Y)   ((X<Y)?X:Y)
#define MAX(X, Y)   ((X>Y)?X:Y)
#define PI   M_PI
#define RIGHT_SIDE   1
#define LEFT_SIDE   -1
#define LOOPED_LINE   1
#define NON_LOOPED_LINE   0

Functions

void Vect_line_buffer2 (struct line_pnts *Points, double da, double db, double dalpha, int round, int caps, double tol, struct line_pnts **oPoints, struct line_pnts ***iPoints, int *inner_count)
 Creates buffer around line.
void Vect_area_buffer2 (struct Map_info *Map, int area, double da, double db, double dalpha, int round, int caps, double tol, struct line_pnts **oPoints, struct line_pnts ***iPoints, int *inner_count)
 Creates buffer around area.
void Vect_point_buffer2 (double px, double py, double da, double db, double dalpha, int round, double tol, struct line_pnts **oPoints)
 Creates buffer around the point (px, py).
void Vect_line_parallel2 (struct line_pnts *InPoints, double da, double db, double dalpha, int side, int round, double tol, struct line_pnts *OutPoints)

Detailed Description

Vector library - nearest, adjust, parallel lines.

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.

Author:
Original author Radim Blazek (see buffer.c)
Rewritten by Rosen Matev (Google Summer of Code 2008)
Date:
2008

Definition in file buffer2.c.


Define Documentation

#define LEFT_SIDE   -1

Definition at line 38 of file buffer2.c.

#define LENGTH (   DX,
  DY 
)    (sqrt((DX*DX)+(DY*DY)))

Definition at line 29 of file buffer2.c.

#define LOOPED_LINE   1

Definition at line 39 of file buffer2.c.

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

Definition at line 34 of file buffer2.c.

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

Definition at line 31 of file buffer2.c.

#define NON_LOOPED_LINE   0

Definition at line 40 of file buffer2.c.

Referenced by Vect_line_parallel2().

#define PI   M_PI

Definition at line 36 of file buffer2.c.

Referenced by Vect_point_buffer2().

#define RIGHT_SIDE   1

Definition at line 37 of file buffer2.c.

Referenced by Vect_line_buffer2().


Function Documentation

void Vect_area_buffer2 ( struct Map_info *  Map,
int  area,
double  da,
double  db,
double  dalpha,
int  round,
int  caps,
double  tol,
struct line_pnts **  oPoints,
struct line_pnts ***  iPoints,
int *  inner_count 
)

Creates buffer around area.

Parameters:
Mapvector map
areaarea id
dadistance along major axis
dbdistance along minor axis
dalphaangle between 0x and major axis
roundmake corners round
capsadd caps at line ends
tolmaximum distance between theoretical arc and output segments
[out]oPointsoutput polygon outer border (ccw order)
[out]inner_countnumber of holes
[out]iPointsarray of output polygon's holes (cw order)

Definition at line 1031 of file buffer2.c.

References Vect_destroy_line_struct(), Vect_get_area_isle(), Vect_get_area_num_isles(), Vect_get_area_points(), Vect_get_isle_points(), Vect_line_prune(), and Vect_new_line_struct().

void Vect_line_buffer2 ( struct line_pnts *  Points,
double  da,
double  db,
double  dalpha,
int  round,
int  caps,
double  tol,
struct line_pnts **  oPoints,
struct line_pnts ***  iPoints,
int *  inner_count 
)

Creates buffer around line.

See also Vect_line_buffer().

Parameters:
InPointsinput line geometry
dadistance along major axis
dbdistance along minor axis
dalphaangle between 0x and major axis
roundmake corners round
capsadd caps at line ends
tolmaximum distance between theoretical arc and output segments
[out]oPointsoutput polygon outer border (ccw order)
[out]inner_countnumber of holes
[out]iPointsarray of output polygon's holes (cw order)

Definition at line 966 of file buffer2.c.

References pg_create(), pg_destroy_struct(), RIGHT_SIDE, Vect_destroy_line_struct(), Vect_line_prune(), Vect_new_line_struct(), and Vect_point_buffer2().

void Vect_line_parallel2 ( struct line_pnts *  InPoints,
double  da,
double  db,
double  dalpha,
int  side,
int  round,
double  tol,
struct line_pnts *  OutPoints 
)

Definition at line 1149 of file buffer2.c.

References NON_LOOPED_LINE.

void Vect_point_buffer2 ( double  px,
double  py,
double  da,
double  db,
double  dalpha,
int  round,
double  tol,
struct line_pnts **  oPoints 
)

Creates buffer around the point (px, py).

Parameters:
pxinput point x-coordinate
pyinput point y-coordinate
dadistance along major axis
dadistance along minor axis
dalphaangle between 0x and major axis
roundmake corners round
tolmaximum distance between theoretical arc and output segments
[out]nPointsoutput polygon outer border (ccw order)

Definition at line 1096 of file buffer2.c.

References PI, Vect_append_point(), and Vect_new_line_struct().

Referenced by Vect_line_buffer2().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines