mp3splt-gtk
douglas_peucker.h
1 /**********************************************************
2  *
3  * mp3splt-gtk -- utility based on mp3splt,
4  * for mp3/ogg splitting without decoding
5  *
6  * Copyright (c) 2005-2012 Alexandru Munteanu - m@ioalex.net
7  *
8  * http://mp3splt.sourceforge.net/
9  *
10  *********************************************************/
11 
12 /**********************************************************
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
27  * USA.
28  *
29  *********************************************************/
30 
31 #ifndef DOUGLAS_PEUCKER_H
32 #define DOUGLAS_PEUCKER_H
33 
34 #include "external_includes.h"
35 #include "ui_types.h"
36 
37 typedef struct {
38  gdouble distance;
39  gint index;
41 
42 typedef struct {
43  GdkPoint point;
44  gint index;
46 
47 GPtrArray *splt_douglas_peucker(GArray *gdk_points, void (*callback)(ui_state *ui),
48  ui_state *ui, gdouble threshold_to_discard_points, ...);
49 void splt_douglas_peucker_free(GPtrArray *douglas_peucker_ptr_array);
50 
51 //for unit tests
52 gdouble splt_find_distance(GdkPoint first, GdkPoint second);
53 gdouble splt_find_perpendicular_distance(GdkPoint point,
54  GdkPoint segment_begin_point, GdkPoint segment_end_point);
55 distance_and_index *splt_find_point_with_maximum_distance(GArray *douglas_points,
56  GdkPoint first_point, GdkPoint last_point);
57 
58 #endif
59