Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members

line.h

00001 00003 // This software is distributed as part of the Improla library. 00004 // Improla is a GUI framework for image processing. 00005 // 00006 // Copyright (c) 2004, B. R. Siva Chandra, India 00007 // 00008 // This program is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU General Public License 00010 // as published by the Free Software Foundation; either version 2 00011 // of the License, or (at your option) any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with this program; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00021 // 00022 // In case you would like to contact the author, use the following e-mail 00023 // address: sivachandra_br@yahoo.com 00025 00026 #ifndef __UTILITY_LINE_H__ 00027 #define __UTILITY_LINE_H__ 00028 00029 #include <tnt/tnt_array1d.h> 00030 #include <point.h> 00031 #include <cmath> 00032 00033 namespace gutk 00034 { // Start of namespace brace. 00035 00038 enum State { INTERSECT, COINCIDE, PARALLEL, INF, FINITE }; 00039 00042 class Line 00043 { 00047 friend State getIntersection(const Line& l1, const Line& l2, Point& p); 00048 00049 public: 00052 Line(void); 00053 00056 Line(double x1, double y1, double x2, double y2); // Line from (x1, y1) to (x2, y2). 00057 00059 virtual ~Line(); 00060 00063 bool isLine(void); 00064 00067 virtual double side(double x, double y); 00068 00071 double getSlope(void); 00072 00077 virtual TNT::Array1D< double > equation(void); 00078 00081 virtual double distance(double x, double y); 00082 00085 Line getParallelLine(double d, bool s); 00086 00089 Line getParallelLine(double x, double y); 00090 00091 private: 00092 double a, b, c; // Store coefficients of the line ax + by + c = 0. 00093 double slope; 00094 bool SET; 00095 State slopeState; 00096 }; 00097 00098 } // End of namespace brace. 00099 00100 #endif // __UTILITY_LINE_H__ 00101

Generated on Mon Nov 22 11:12:41 2004 for ImprolaLib by doxygen 1.3.7