GRASS 8 Programmer's Manual 8.6.0dev(2026)-ddeab64dbf
Loading...
Searching...
No Matches
dgraph.c File Reference

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

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

Go to the source code of this file.

Macros

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

Functions

struct seg_intersections * create_si_struct (int segments_count)
 
void destroy_si_struct (struct seg_intersections *si)
 
void add_ipoint1 (struct seg_intersection_list *il, int with, double dist, int ip)
 
void add_ipoint (const struct line_pnts *Points, int first_seg, int second_seg, double x, double y, struct seg_intersections *si)
 
void sort_intersection_list (struct seg_intersection_list *il)
 
int compare (const void *a, const void *b)
 
double get_epsilon (struct line_pnts *Points)
 
struct seg_intersections * find_all_intersections (const struct line_pnts *Points)
 
struct planar_graphpg_create_struct (int n, int e)
 
void pg_destroy_struct (struct planar_graph *pg)
 
int pg_existsedge (struct planar_graph *pg, int v1, int v2)
 
void pg_addedge1 (struct pg_vertex *v, struct pg_edge *e)
 
void pg_addedge (struct planar_graph *pg, int v1, int v2)
 
struct planar_graphpg_create (const struct line_pnts *Points)
 

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 dgraph.c.

Macro Definition Documentation

◆ LENGTH

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

Definition at line 25 of file dgraph.c.

◆ PI

#define PI   M_PI

Definition at line 26 of file dgraph.c.

Function Documentation

◆ add_ipoint()

void add_ipoint ( const struct line_pnts Points,
int  first_seg,
int  second_seg,
double  x,
double  y,
struct seg_intersections *  si 
)

Definition at line 111 of file dgraph.c.

References add_ipoint1(), G_debug(), G_realloc, LENGTH, t, line_pnts::x, x, and line_pnts::y.

Referenced by find_all_intersections().

◆ add_ipoint1()

void add_ipoint1 ( struct seg_intersection_list *  il,
int  with,
double  dist,
int  ip 
)

Definition at line 91 of file dgraph.c.

References G_realloc.

Referenced by add_ipoint().

◆ compare()

int compare ( const void a,
const void b 
)

Definition at line 168 of file dgraph.c.

References b.

Referenced by avl_create(), datetime_difference(), find_all_intersections(), rbtree_create(), and tavl_create().

◆ create_si_struct()

struct seg_intersections * create_si_struct ( int  segments_count)

Definition at line 56 of file dgraph.c.

References G_malloc, and NULL.

Referenced by find_all_intersections().

◆ destroy_si_struct()

void destroy_si_struct ( struct seg_intersections *  si)

Definition at line 77 of file dgraph.c.

References G_free().

Referenced by pg_create().

◆ find_all_intersections()

◆ get_epsilon()

double get_epsilon ( struct line_pnts Points)

Definition at line 184 of file dgraph.c.

References MAX, min, line_pnts::n_points, t, line_pnts::x, x, and line_pnts::y.

◆ pg_addedge()

◆ pg_addedge1()

void pg_addedge1 ( struct pg_vertex v,
struct pg_edge e 
)

Definition at line 399 of file dgraph.c.

References pg_vertex::eallocated, pg_vertex::ecount, pg_vertex::edges, and G_realloc.

Referenced by pg_addedge().

◆ pg_create()

◆ pg_create_struct()

struct planar_graph * pg_create_struct ( int  n,
int  e 
)

◆ pg_destroy_struct()

void pg_destroy_struct ( struct planar_graph pg)

Definition at line 362 of file dgraph.c.

References planar_graph::e, G_free(), planar_graph::v, and planar_graph::vcount.

Referenced by Vect_line_buffer2().

◆ pg_existsedge()

int pg_existsedge ( struct planar_graph pg,
int  v1,
int  v2 
)

Definition at line 376 of file dgraph.c.

References pg_vertex::ecount, pg_vertex::edges, planar_graph::v, pg_edge::v1, and pg_edge::v2.

Referenced by pg_addedge().

◆ sort_intersection_list()

void sort_intersection_list ( struct seg_intersection_list *  il)

Definition at line 142 of file dgraph.c.

References G_debug(), min, and t.

Referenced by find_all_intersections().