00001 /* 00002 spacegameengine is a portable easy to use game engine written in C++. 00003 Copyright (C) 2006-2007 Carl Philipp Reh (sefi@s-e-f-i.de) 00004 00005 This program is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public License 00007 as published by the Free Software Foundation; either version 2 00008 of the License, or (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 00021 #ifndef SGE_MATH_CIRCLE_IMPL_HPP_INCLUDED 00022 #define SGE_MATH_CIRCLE_IMPL_HPP_INCLUDED 00023 00024 #include "circle.hpp" 00025 00026 template<typename T> 00027 sge::math::basic_circle<T>::basic_circle( 00028 const_reference x, 00029 const_reference y, 00030 const_reference radius_) 00031 : origin_(x, y), 00032 radius_(radius_) 00033 {} 00034 00035 template<typename T> 00036 sge::math::basic_circle<T>::basic_circle( 00037 const point_type& origin_, 00038 const_reference radius_) 00039 : origin_(origin_), 00040 radius_(radius_) 00041 {} 00042 00043 template<typename T> 00044 typename sge::math::basic_circle<T>::point_type& 00045 sge::math::basic_circle<T>::origin() 00046 { 00047 return origin_; 00048 } 00049 00050 template<typename T> 00051 const typename sge::math::basic_circle<T>::point_type& 00052 sge::math::basic_circle<T>::origin() const 00053 { 00054 return origin_; 00055 } 00056 00057 template<typename T> 00058 typename sge::math::basic_circle<T>::reference 00059 sge::math::basic_circle<T>::radius() 00060 { 00061 return radius_; 00062 } 00063 00064 template<typename T> 00065 typename sge::math::basic_circle<T>::const_reference 00066 sge::math::basic_circle<T>::radius() const 00067 { 00068 return radius_; 00069 } 00070 00071 template<typename T> 00072 bool sge::math::intersects( 00073 basic_circle<T> const &a, 00074 basic_circle<T> const &b) 00075 { 00076 return (a.origin() - b.origin()).length() 00077 < a.radius() + b.radius(); 00078 } 00079 00080 #endif
1.5.5