]> git.mxchange.org Git - flightgear.git/blob - src/WeatherCM/FGVoronoi.h
Added first stab at a socket class.
[flightgear.git] / src / WeatherCM / FGVoronoi.h
1 /*****************************************************************************
2
3  Header:       FGVoronoi.h      
4  Author:       Christian Mayer
5  Date started: 28.05.99
6
7  -------- Copyright (C) 1999 Christian Mayer (fgfs@christianmayer.de) --------
8
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17  details.
18
19  You should have received a copy of the GNU General Public License along with
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21  Place - Suite 330, Boston, MA  02111-1307, USA.
22
23  Further information about the GNU General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25
26 FUNCTIONAL DESCRIPTION
27 ------------------------------------------------------------------------------
28 library for Voronoi Diagram calculation based on Steven Fortune 'Sweep2'
29 FGVoronoi is the wraper to feed the voronoi calulation with a vetor of points
30 and any class you want, as it uses templates
31 NOTE: Sweep2 didn't free *any* memory. So I'm doing what I can, but that's not
32       good enough...
33
34 HISTORY
35 ------------------------------------------------------------------------------
36 30.05.1999 Christian Mayer      Created
37 16.06.1999 Durk Talsma          Portability for Linux
38 20.06.1999 Christian Mayer      added lots of consts
39 30.06.1999 Christian Mayer      STL portability
40 11.10.1999 Christian Mayer      changed set<> to map<> on Bernie Bright's 
41                                 suggestion
42 19.10.1999 Christian Mayer      change to use PLIB's sg instead of Point[2/3]D
43                                 and lots of wee code cleaning
44 *****************************************************************************/
45
46 /****************************************************************************/
47 /* SENTRY                                                                   */
48 /****************************************************************************/
49 #ifndef FGVoronoi_H
50 #define FGVoronoi_H
51
52 /****************************************************************************/
53 /* INCLUDES                                                                 */
54 /****************************************************************************/
55 #ifdef HAVE_CONFIG_H
56 #  include <config.h>
57 #endif
58
59 #include <Include/compiler.h>
60
61 #ifdef HAVE_WINDOWS_H
62 #  include <windows.h>
63 #endif
64
65 #include <vector>
66
67 #include "sg.h"
68
69 #include "FGWeatherVectorWrap.h"
70 #include "FGPhysicalProperties.h"
71                 
72 /****************************************************************************/
73 /* DEFINES                                                                  */
74 /****************************************************************************/
75 FG_USING_STD(vector);
76 FG_USING_NAMESPACE(std);
77
78 typedef vector<sgVec2Wrap>      Point2DList;
79
80 struct FGVoronoiInput
81 {
82     sgVec2 position;
83     FGPhysicalProperties2D value;
84
85     FGVoronoiInput(const sgVec2& p, const FGPhysicalProperties2D& v) 
86     { 
87         sgCopyVec2(position, p); 
88         value = v; 
89     }
90 };
91
92 struct FGVoronoiOutput
93 {
94     Point2DList boundary;
95     FGPhysicalProperties2D value;
96
97     FGVoronoiOutput(const Point2DList& b, const FGPhysicalProperties2D& v) 
98     {
99         boundary = b; 
100         value = v;
101     };
102 };
103
104 typedef vector<FGVoronoiInput>  FGVoronoiInputList;
105 typedef vector<FGVoronoiOutput> FGVoronoiOutputList;
106
107 /****************************************************************************/
108 /* FUNCTION DECLARATION                                                     */
109 /****************************************************************************/
110 FGVoronoiOutputList Voronoiate(const FGVoronoiInputList& input);
111
112 #endif /*FGVoronoi_H*/