00001 /************************************************************** ggt-head beg 00002 * 00003 * GGT: Generic Graphics Toolkit 00004 * 00005 * Original Authors: 00006 * Allen Bierbaum 00007 * 00008 * ----------------------------------------------------------------- 00009 * File: $RCSfile: Ray.h,v $ 00010 * Date modified: $Date: 2003/02/23 07:16:49 $ 00011 * Version: $Revision: 1.2 $ 00012 * ----------------------------------------------------------------- 00013 * 00014 *********************************************************** ggt-head end */ 00015 /*************************************************************** ggt-cpr beg 00016 * 00017 * GGT: The Generic Graphics Toolkit 00018 * Copyright (C) 2001,2002 Allen Bierbaum 00019 * 00020 * This library is free software; you can redistribute it and/or 00021 * modify it under the terms of the GNU Lesser General Public 00022 * License as published by the Free Software Foundation; either 00023 * version 2.1 of the License, or (at your option) any later version. 00024 * 00025 * This library is distributed in the hope that it will be useful, 00026 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00027 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00028 * Lesser General Public License for more details. 00029 * 00030 * You should have received a copy of the GNU Lesser General Public 00031 * License along with this library; if not, write to the Free Software 00032 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00033 * 00034 ************************************************************ ggt-cpr end */ 00035 #ifndef _GMTL_RAY_H_ 00036 #define _GMTL_RAY_H_ 00037 00038 #include <gmtl/Point.h> 00039 #include <gmtl/Vec.h> 00040 #include <gmtl/VecOps.h> 00041 00042 namespace gmtl { 00043 00054 template< class DATA_TYPE > 00055 class Ray 00056 { 00057 public: 00061 Ray() 00062 {} 00063 00071 Ray( const Point<DATA_TYPE, 3>& origin, const Vec<DATA_TYPE, 3>& dir ) 00072 : mOrigin( origin ), mDir( dir ) 00073 {} 00074 00075 00076 00082 Ray( const Ray& lineseg ) 00083 { 00084 mOrigin = lineseg.mOrigin; 00085 mDir = lineseg.mDir; 00086 } 00087 00093 const Point<DATA_TYPE, 3>& getOrigin() const 00094 { 00095 return mOrigin; 00096 } 00097 00103 void setOrigin( const Point<DATA_TYPE, 3>& origin ) 00104 { 00105 mOrigin = origin; 00106 } 00107 00113 const Vec<DATA_TYPE, 3>& getDir() const 00114 { 00115 return mDir; 00116 } 00117 00123 void setDir( const Vec<DATA_TYPE, 3>& dir ) 00124 { 00125 mDir = dir; 00126 } 00127 00128 public: 00132 Point<DATA_TYPE, 3> mOrigin; 00133 00137 Vec<DATA_TYPE, 3> mDir; 00138 }; 00139 00140 00141 // --- helper types --- // 00142 typedef Ray<float> Rayf; 00143 typedef Ray<double> Rayd; 00144 } 00145 00146 #endif