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

Intersection.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 // Lamp : Open source game middleware
00003 // Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library 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 GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 //------------------------------------------------------------------------------
00019 
00020 /** @file
00021  * 交差ヘッダ
00022  * @author Junpee
00023  */
00024 
00025 #ifndef INTERSECTION_H_
00026 #define INTERSECTION_H_
00027 
00028 #include <Core/Primitive/Vector3.h>
00029 
00030 namespace Lamp{
00031 
00032 //------------------------------------------------------------------------------
00033 /**
00034  * 交差
00035  *
00036  * このクラスは継承しないで下さい。
00037  */
00038 class Intersection{
00039 public:
00040     /**
00041      * コンストラクタ
00042      *
00043      * このコンストラクタは初期値の設定を行わないため値は不定です。
00044      */
00045     Intersection(){}
00046 
00047     //--------------------------------------------------------------------------
00048     /**
00049      * 設定
00050      * @param position 交差位置
00051      * @param refrection 反射
00052      */
00053     void set(const Vector3& position, const Vector3& refrection){
00054         position_ = position;
00055         refrection_ = refrection;
00056     }
00057 
00058     /**
00059      * 反転
00060      */
00061     void reverse(){
00062         refrection_ = -refrection_;
00063         position_ = position_ + refrection_;
00064     }
00065 
00066     /**
00067      * 比較
00068      * @param compare 比較対象
00069      * @return 同じ値であればtrueを返す
00070      */
00071     inline bool operator ==(const Intersection& compare) const{
00072         return ((position_ == compare.position_) &&
00073             (refrection_ == compare.refrection_));
00074     }
00075 
00076     //--------------------------------------------------------------------------
00077     /**
00078      * 交差位置の設定
00079      * @param position 交差位置
00080      */
00081     void setPosition(const Vector3& position){ position_ = position; }
00082 
00083     /**
00084      * 交差位置の取得
00085      * @return 交差位置
00086      */
00087     const Vector3& getPosition() const{ return position_; }
00088 
00089     //--------------------------------------------------------------------------
00090     /**
00091      * 反射の設定
00092      * @param refrection 反射
00093      */
00094     void setRefrection(const Vector3& refrection){ refrection_ = refrection; }
00095 
00096     /**
00097      * 反射の取得
00098      * @return 反射
00099      */
00100     const Vector3& getRefrection() const{ return refrection_; }
00101 
00102 private:
00103     //--------------------------------------------------------------------------
00104     // 交差位置
00105     Vector3 position_;
00106     // 反射
00107     Vector3 refrection_;
00108 
00109 };
00110 
00111 //------------------------------------------------------------------------------
00112 } // End of namespace Lamp
00113 #endif // End of INTERSECTION_H_
00114 //------------------------------------------------------------------------------

Generated on Wed Mar 16 10:29:31 2005 for Lamp by doxygen 1.3.2