libprop: geom.h Source File

- Main Page
- Namespaces
- Classes
- Files

# geom.h

Go to the documentation of this file.

    00001 /*
    00002         libprop -- library to simulate and measure radio signal propagation
    00003
    00004         Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org
    00005
    00006         This program is free software: you can redistribute it and/or modify
    00007         it under the terms of the GNU General Public License as published by
    00008         the Free Software Foundation, either version 3 of the License, or
    00009         (at your option) any later version.
    00010
    00011         This program is distributed in the hope that it will be useful,
    00012         but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00014         GNU General Public License for more details.
    00015
    00016         You should have received a copy of the GNU General Public License
    00017         along with this program.  If not, see <http://www.gnu.org/licenses/>.
    00018 */
    00019
    00020 #pragma once
    00021
    00022 #include <iostream>
    00023 #include <fstream>
    00024
    00025 #include <vector>
    00026
    00027 using namespace std;
    00028
    00029 #include "utils.h"
    00030
    00031
    00033 class Point {
    00035         friend ostream& operator<<(ostream& output, const Point& p);
    00037         friend ofstream& operator<<(ofstream& output, const Point& p);
    00039         friend ifstream& operator>>(ifstream& input, Point& p);
    00040
    00041 public:
    00043         double lat;
    00045         double lon;
    00047         double elev;
    00049         double towerHeight;
    00051         double vegHeight;
    00053         int vegType;
    00055         int vegCover;
    00057         int landType;
    00058
    00059         Point();
    00060
    00064         Point(double _lat, double _lon);
    00065
    00070         Point(double _lat, double _lon, double _towerHeight);
    00071
    00075         double distance(Point* p);
    00076
    00080         double bearing(Point* p);
    00081
    00086         Point* project(double bearing, double distance);
    00087
    00088 };
    00089
    00090
    00091
    00093 class Region {
    00094 public:
    00098         virtual vector<Point*> discrete(double resolution) = 0;
    00099
    00103         virtual bool contains(Point* p) = 0;
    00104
    00107         virtual void add(Point* p) = 0;
    00108 };
    00109
    00110
    00112 class RegionArea : Region {
    00114         friend ostream& operator<<(ostream& output, const RegionArea& r);
    00115 private:
    00116 public:
    00118         Point* bottomLeft;
    00120         Point* topRight;
    00121
    00122         RegionArea();
    00123
    00127         RegionArea(Point* bottomLeft, Point* topRight);
    00128
    00132         RegionArea(Point* center, double radius);
    00133
    00134         ~RegionArea();
    00135
    00139         vector<Point*> discrete(double resolution);
    00140
    00144         bool contains(Point* p);
    00145
    00148         void add(Point* p);
    00149
    00150 };
    00151
    00152
    00154 class RegionLine : Region {
    00156         friend ofstream& operator<<(ofstream& output, const RegionLine& r);
    00157 private:
    00159         vector<Point*> list;
    00160 public:
    00161         RegionLine();
    00162
    00165         RegionLine(vector<Point*> list);
    00166
    00170         RegionLine(Point* p, Point* q);
    00171
    00174         RegionLine(string filename);
    00175
    00176         ~RegionLine();
    00177
    00180         double length();
    00181
    00185         vector<Point*> discrete(double resolution);
    00186
    00190         bool contains(Point* p);
    00191
    00194         void add(Point* p);
    00195
    00196 };
    00197
    00198