00001 /* This file is part of Annchienta. 00002 * Copyright 2008 (C) Jasper Van der Jeugt 00003 * 00004 * Annchienta is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 3 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * Annchienta is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with Annchienta. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef ANNCHIENTA_POINT_H 00019 #define ANNCHIENTA_POINT_H 00020 00021 namespace Annchienta 00022 { 00026 enum PointType 00027 { 00034 TilePoint=0, 00035 00041 IsometricPoint, 00042 00048 MapPoint, 00049 00055 ScreenPoint 00056 }; 00057 00085 class Point 00086 { 00087 private: 00088 PointType type; 00089 00090 public: 00091 float x, y, z; 00092 00101 Point( PointType type=TilePoint, float x=0, float y=0, float z=0 ); 00102 00106 Point( const Point &other ); 00107 00108 ~Point(); 00109 00110 #ifndef SWIG 00111 00114 Point &operator=(const Point &other); 00115 00121 void setType( PointType type ); 00122 #endif 00123 00126 PointType getPointType() const; 00127 00132 void convert( PointType newtype ); 00133 00140 Point to( PointType newtype ) const; 00141 00148 bool isEnclosedBy( Point *leftTop, Point *rightBottom ); 00149 00154 float distance( Point other ) const; 00155 00164 float noTypeCheckSquaredDistance( Point *other ) const; 00165 00166 }; 00167 00168 }; 00169 00170 #endif