navit  0.5.3-trunk
geom.h File Reference
#include <glib.h>
#include "config.h"
#include "coord.h"
#include "item.h"
#include "attr.h"

Go to the source code of this file.

Data Structures

struct  rect
 
struct  geom_poly_segment
 

Macros

#define sq(x)   ((double)(x)*(x))
 

Enumerations

enum  geom_poly_segment_type {
  geom_poly_segment_type_none, geom_poly_segment_type_way_inner, geom_poly_segment_type_way_outer, geom_poly_segment_type_way_left_side,
  geom_poly_segment_type_way_right_side, geom_poly_segment_type_way_unknown
}
 

Functions

void geom_coord_copy (struct coord *from, struct coord *to, int count, int reverse)
 
void geom_coord_revert (struct coord *c, int count)
 
int geom_line_middle (struct coord *p, int count, struct coord *c)
 
long long geom_poly_area (struct coord *c, int count)
 
int geom_poly_centroid (struct coord *c, int count, struct coord *r)
 
int geom_poly_point_inside (struct coord *cp, int count, struct coord *c)
 
int geom_poly_closest_point (struct coord *pl, int count, struct coord *p, 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)
 
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 (void)
 

Macro Definition Documentation

◆ sq

#define sq (   x)    ((double)(x)*(x))

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 ch_generate_ddsg(), and geom_line_middle().

Enumeration Type Documentation

◆ geom_poly_segment_type

Enumerator
geom_poly_segment_type_none 
geom_poly_segment_type_way_inner 
geom_poly_segment_type_way_outer 
geom_poly_segment_type_way_left_side 
geom_poly_segment_type_way_right_side 
geom_poly_segment_type_way_unknown 

Function Documentation

◆ 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 
)

◆ 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 
)

◆ 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 length, p, sq, coord::x, font_freetype_glyph::x, coord::y, and font_freetype_glyph::y.

Referenced by process_way2poi(), and search_list_street_new().

◆ geom_poly_area()

long long geom_poly_area ( struct coord c,
int  count 
)

◆ 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(), coord::x, and coord::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 coord::x, and coord::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.

Referenced by clip_polygon().

◆ 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 coord::x, and coord::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()