navit  0.5.3-trunk
geom.c File Reference
#include <string.h>
#include <math.h>
#include "geom.h"

Functions

void geom_coord_copy (struct coord *from, struct coord *to, int count, int reverse)
 
int geom_line_middle (struct coord *p, int count, struct coord *c)
 
void geom_coord_revert (struct coord *c, int count)
 
long long geom_poly_area (struct coord *c, int count)
 
int geom_poly_centroid (struct coord *p, int count, struct coord *c)
 
int geom_poly_closest_point (struct coord *pl, int count, struct coord *p, struct coord *c)
 
int geom_poly_point_inside (struct coord *cp, int count, struct coord *c)
 
GListgeom_poly_segments_insert (GList *list, struct geom_poly_segment *first, struct geom_poly_segment *second, struct geom_poly_segment *third)
 
void geom_poly_segment_destroy (struct geom_poly_segment *seg, void *unused)
 
GListgeom_poly_segments_remove (GList *list, struct geom_poly_segment *seg)
 
int geom_poly_segment_compatible (struct geom_poly_segment *s1, struct geom_poly_segment *s2, int dir)
 
GListgeom_poly_segments_sort (GList *in, enum geom_poly_segment_type type)
 
int geom_poly_segments_point_inside (GList *in, struct coord *c)
 
static int clipcode (struct coord *p, struct rect *r)
 
int geom_clip_line_code (struct coord *p1, struct coord *p2, struct rect *r)
 
int geom_is_inside (struct coord *p, struct rect *r, int edge)
 
void geom_poly_intersection (struct coord *p1, struct coord *p2, struct rect *r, int edge, struct coord *ret)
 
void geom_init ()
 

Function Documentation

◆ clipcode()

static int clipcode ( struct coord p,
struct rect r 
)
static

References rect::h, p, coord::x, and coord::y.

Referenced by geom_clip_line_code().

◆ geom_clip_line_code()

int geom_clip_line_code ( struct coord p1,
struct coord p2,
struct rect r 
)

References clipcode(), rect::h, coord::x, and coord::y.

Referenced by clip_line().

◆ geom_coord_copy()

void geom_coord_copy ( struct coord from,
struct coord to,
int  count,
int  reverse 
)

Navit, a modular navigation system. Copyright (C) 2005-2011 Navit Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Referenced by geom_poly_segments_insert(), and item_bin_to_poly_segment().

◆ geom_coord_revert()

void geom_coord_revert ( struct coord c,
int  count 
)

References c.

◆ geom_init()

void geom_init ( void  )

Referenced by main_real().

◆ geom_is_inside()

int geom_is_inside ( struct coord p,
struct rect r,
int  edge 
)

References rect::h, p, coord::x, and coord::y.

Referenced by itembin_slice_part_direction().

◆ geom_line_middle()

int geom_line_middle ( struct coord p,
int  count,
struct coord c 
)

Get coordinates of polyline middle point.

Parameters
in*p array of poly vertex coordinates
incount count of poly vertexes
out*c coordinates of middle point
Returns
number of first vertex of segment containing middle point

References c, length, p, sq, pcoord::x, and pcoord::y.

Referenced by process_way2poi(), and search_list_street_new().

◆ geom_poly_area()

long long geom_poly_area ( struct coord c,
int  count 
)

References area(), c, coord::x, and pcoord::y.

Referenced by geom_poly_segments_sort().

◆ geom_poly_centroid()

int geom_poly_centroid ( struct coord p,
int  count,
struct coord c 
)

Get poly centroid coordinates.

Parameters
in*p array of poly vertex coordinates
incount count of poly vertexes
out*c coordinates of poly centroid
Returns
1 on success, 0 if poly area is 0

References area(), c, p, pcoord::x, and pcoord::y.

Referenced by process_way2poi().

◆ geom_poly_closest_point()

int geom_poly_closest_point ( struct coord pl,
int  count,
struct coord p,
struct coord c 
)

Get coordinates of polyline point c most close to given point p.

Parameters
in*pl array of polyline vertex coordinates
incount count of polyline vertexes
in*p point coordinates
out*c coordinates of polyline point most close to given point.
Returns
first vertex number of polyline segment to which c belongs

References c, p, coord::x, pcoord::x, coord::y, and pcoord::y.

Referenced by process_way2poi().

◆ geom_poly_intersection()

void geom_poly_intersection ( struct coord p1,
struct coord p2,
struct rect r,
int  edge,
struct coord ret 
)

References rect::h, coord::x, and coord::y.

◆ geom_poly_point_inside()

int geom_poly_point_inside ( struct coord cp,
int  count,
struct coord c 
)

Check if point is inside polgone.

Parameters
in*cp array of polygon vertex coordinates
incount count of polygon vertexes
in*c point coordinates
Returns
1 - inside, 0 - outside

References c, coord::x, pcoord::x, coord::y, and pcoord::y.

Referenced by geom_poly_segments_point_inside(), item_inside_poly_list(), and process_way2poi().

◆ geom_poly_segment_compatible()

◆ geom_poly_segment_destroy()

void geom_poly_segment_destroy ( struct geom_poly_segment seg,
void *  unused 
)

◆ geom_poly_segments_insert()

GList* geom_poly_segments_insert ( GList list,
struct geom_poly_segment first,
struct geom_poly_segment second,
struct geom_poly_segment third 
)

◆ geom_poly_segments_point_inside()

int geom_poly_segments_point_inside ( GList in,
struct coord c 
)

◆ geom_poly_segments_remove()

GList* geom_poly_segments_remove ( GList list,
struct geom_poly_segment seg 
)

◆ geom_poly_segments_sort()