1 /* 2 * Stellarium Scenery3d Plug-in 3 * 4 * Copyright (C) 2011 Simon Parzer, Peter Neubauer, Georg Zotti, Andrei Borza 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 19 */ 20 21 #ifndef PLANE_HPP 22 #define PLANE_HPP 23 24 #include "GeomMath.hpp" 25 #include "SPolygon.hpp" 26 27 class Plane 28 { 29 public: 30 Plane(); 31 Plane(Vec3f &v1, Vec3f &v2, Vec3f &v3); 32 Plane(const Vec4f &e); 33 Plane(const Vec3f &v1, const Vec3f &v2, const Vec3f &v3, SPolygon::Order o); 34 ~Plane(); 35 36 Vec3f normal, sNormal; 37 Vec3f p, sP; 38 float distance, sDistance; 39 40 void setPoints(const Vec3f &v1, const Vec3f &v2, const Vec3f &v3, SPolygon::Order o = SPolygon::CCW); 41 float calcDistance(const Vec3f p) const; 42 bool isBehind(const Vec3f& p) const; 43 void saveValues(); 44 void resetValues(); 45 46 bool intersect(const Line &l, float &val) const; 47 }; 48 49 #endif 50