00001 /* 00002 CLAW - a C++ Library Absolutely Wonderful 00003 00004 CLAW is a free library without any particular aim but being useful to 00005 anyone. 00006 00007 Copyright (C) 2005-2008 Julien Jorge 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with this library; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 00023 contact: julien_jorge@yahoo.fr 00024 */ 00030 #ifndef __CLAW_LINE_2D_HPP__ 00031 #define __CLAW_LINE_2D_HPP__ 00032 00033 #include <claw/coordinate_2d.hpp> 00034 #include <claw/vector_2d.hpp> 00035 00036 namespace claw 00037 { 00038 namespace math 00039 { 00044 template<class T> 00045 class line_2d 00046 { 00047 public: 00049 typedef T value_type; 00050 00052 typedef line_2d<value_type> self_type; 00053 00055 typedef coordinate_2d<value_type> point_type; 00056 00058 typedef vector_2d<value_type> direction_type; 00059 00060 public: 00061 line_2d(); 00062 template<class U> line_2d( const line_2d<U>& that ); 00063 line_2d( const point_type& _origin, const direction_type& _direction ); 00064 line_2d( const value_type& ox, const value_type& oy, 00065 const value_type& dx, const value_type& dy ); 00066 00067 bool parallel( const self_type& that ) const; 00068 bool orthogonal( const self_type& that ) const; 00069 point_type intersection( const self_type& that ) const; 00070 00071 value_type y_value( const value_type& x ) const; 00072 00073 public: 00075 point_type origin; 00076 00078 direction_type direction; 00079 00080 }; // class point_2d 00081 } // namespace math 00082 } // namespace claw 00083 00084 #include <claw/impl/line_2d.tpp> 00085 00086 #endif // __CLAW_LINE_2D_HPP__