PixelLightAPI  .
Ray.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: Ray.h                                          *
00003  *
00004  *  Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight 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 Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLMATH_RAY_H__
00024 #define __PLMATH_RAY_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLMath/Vector3.h"
00032 
00033 
00034 //[-------------------------------------------------------]
00035 //[ Namespace                                             ]
00036 //[-------------------------------------------------------]
00037 namespace PLMath {
00038 
00039 
00040 //[-------------------------------------------------------]
00041 //[ Classes                                               ]
00042 //[-------------------------------------------------------]
00043 /**
00044 *  @brief
00045 *    Ray class (infinite length, in both directions)
00046 */
00047 class Ray {
00048 
00049 
00050     //[-------------------------------------------------------]
00051     //[ Public functions                                      ]
00052     //[-------------------------------------------------------]
00053     public:
00054         /**
00055         *  @brief
00056         *    Default constructor setting all position and direction components to 0
00057         */
00058         inline Ray();
00059 
00060         /**
00061         *  @brief
00062         *    Copy constructor
00063         *
00064         *  @param[in] cSource
00065         *    Source to copy from
00066         */
00067         inline Ray(const Ray &cSource);
00068 
00069         /**
00070         *  @brief
00071         *    Destructor
00072         */
00073         inline ~Ray();
00074 
00075         /**
00076         *  @brief
00077         *    Copy operator
00078         *
00079         *  @param[in] cSource
00080         *    Source to copy from
00081         *
00082         *  @return
00083         *    Reference to this instance
00084         */
00085         inline Ray &operator =(const Ray &cSource);
00086 
00087         /**
00088         *  @brief
00089         *    Set the current ray using a line
00090         *
00091         *  @param[in] vLineStartPos
00092         *    Line start position
00093         *  @param[in] vLineEndPos
00094         *    Line end position
00095         */
00096         inline void Set(const Vector3 &vLineStartPos, const Vector3 &vLineEndPos);
00097 
00098         /**
00099         *  @brief
00100         *    Returns the current position
00101         *
00102         *  @return
00103         *    Current position
00104         */
00105         inline const Vector3 &GetPos() const;
00106 
00107         /**
00108         *  @brief
00109         *    Set the current position
00110         *
00111         *  @param[in] fX
00112         *    X component of the new position
00113         *  @param[in] fY
00114         *    Y component of the new position
00115         *  @param[in] fZ
00116         *    Z component of the new position
00117         */
00118         inline void SetPos(float fX = 0.0f, float fY = 0.0f, float fZ = 0.0f);
00119 
00120         /**
00121         *  @brief
00122         *    Set the current position
00123         *
00124         *  @param[in] vPos
00125         *    New position
00126         */
00127         inline void SetPos(const Vector3 &vPos);
00128 
00129         /**
00130         *  @brief
00131         *    Returns the ray direction
00132         *
00133         *  @return
00134         *    Ray direction
00135         */
00136         inline const Vector3 &GetDir() const;
00137 
00138         /**
00139         *  @brief
00140         *    Set the ray direction
00141         *
00142         *  @param[in] fX
00143         *    X component of the new direction vector
00144         *  @param[in] fY
00145         *    Y component of the new direction vector
00146         *  @param[in] fZ
00147         *    Z component of the new direction vector
00148         */
00149         inline void SetDir(float fX = 0.0f, float fY = 0.0f, float fZ = 0.0f);
00150 
00151         /**
00152         *  @brief
00153         *    Set the ray direction
00154         *
00155         *  @param[in] vDir
00156         *    New ray direction
00157         */
00158         inline void SetDir(const Vector3 &vDir);
00159 
00160 
00161     //[-------------------------------------------------------]
00162     //[ Private data                                          ]
00163     //[-------------------------------------------------------]
00164     private:
00165         Vector3 m_vPos; /**< Ray origin */
00166         Vector3 m_vDir; /**< Ray direction */
00167 
00168 
00169 };
00170 
00171 
00172 //[-------------------------------------------------------]
00173 //[ Namespace                                             ]
00174 //[-------------------------------------------------------]
00175 } // PLMath
00176 
00177 
00178 //[-------------------------------------------------------]
00179 //[ Implementation                                        ]
00180 //[-------------------------------------------------------]
00181 #include "PLMath/Ray.inl"
00182 
00183 
00184 #endif // __PLMATH_RAY_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:58
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported