RigsofRods
Soft-body Physics Simulation
Ellipsoid.h
Go to the documentation of this file.
1 /*
2 --------------------------------------------------------------------------------
3 This source file is part of SkyX.
4 Visit http://www.paradise-studios.net/products/skyx/
5 
6 Copyright (C) 2009-2012 Xavier Verguín González <xavyiy@gmail.com>
7 
8 This program is free software; you can redistribute it and/or modify it under
9 the terms of the GNU Lesser General Public License as published by the Free Software
10 Foundation; either version 2 of the License, or (at your option) any later
11 version.
12 
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License along with
18 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20 http://www.gnu.org/copyleft/lesser.txt.
21 --------------------------------------------------------------------------------
22 */
23 
24 #ifndef _SkyX_VClouds_Ellipsoid_H_
25 #define _SkyX_VClouds_Ellipsoid_H_
26 
27 #include "Prerequisites.h"
28 
29 #include "DataManager.h"
30 
31 namespace SkyX { namespace VClouds{
32 
38  class Ellipsoid
39  {
40  public:
53  Ellipsoid(const int& a, const int& b, const int& c,
54  const int& nx, const int& ny, const int& nz,
55  const int& x, const int& y, const int& z,
56  const Ogre::Real& DynLibManager = 1.0f);
57 
60  ~Ellipsoid();
61 
67  void move(const int& Ax, const int& Ay, const int& Az);
68 
75  const Ogre::Vector3 getProbabilities(const int& x, const int& y, const int& z) const;
76 
84  void updateProbabilities(DataManager::Cell ***c, const int &nx, const int &ny, const int &nz, const bool& delayedResponse = true);
85 
88  const bool isOutOfCells() const;
89 
93  inline const Ogre::Vector3 getDimensions() const
94  {
95  return Ogre::Vector3(mA, mB, mC);
96  }
97 
101  inline const Ogre::Vector3 getPosition() const
102  {
103  return Ogre::Vector3(mX, mY, mZ);
104  }
105 
109  void setDimensions(const Ogre::Vector3& Dimensions);
110 
114  inline void setPosition(const Ogre::Vector3& Position)
115  {
116  mX = Position.x;
117  mY = Position.y;
118  mZ = Position.z;
119  }
120 
121  private:
128  const float _getLength(const int& x, const int& y, const int& z) const;
129 
131  int mA, mB, mC, mA2, mB2, mC2;
132 
134  int mX, mY, mZ;
135 
137  int mNx, mNy, mNz;
138 
140  Ogre::Real mDensity;
141  };
142 
143 }}
144 
145 #endif
SkyX::VClouds::Ellipsoid::mZ
int mZ
Definition: Ellipsoid.h:134
SkyX::VClouds::Ellipsoid::mNx
int mNx
Cells size.
Definition: Ellipsoid.h:137
y
float y
Definition: (ValueTypes) quaternion.h:6
DataManager.h
z
float z
Definition: (ValueTypes) quaternion.h:7
SkyX::VClouds::Ellipsoid::getProbabilities
const Ogre::Vector3 getProbabilities(const int &x, const int &y, const int &z) const
Get probabilities at a point.
Definition: Ellipsoid.cpp:75
SkyX::VClouds::Ellipsoid::mNz
int mNz
Definition: Ellipsoid.h:137
SkyX
Definition: AtmosphereManager.cpp:30
SkyX::VClouds::Ellipsoid::mDensity
Ogre::Real mDensity
Cloud density.
Definition: Ellipsoid.h:140
SkyX::VClouds::Ellipsoid::setPosition
void setPosition(const Ogre::Vector3 &Position)
Set position.
Definition: Ellipsoid.h:114
SkyX::VClouds::Ellipsoid::mB2
int mB2
Definition: Ellipsoid.h:131
SkyX::VClouds::Ellipsoid::mA
int mA
Ellipsoid parameters.
Definition: Ellipsoid.h:131
SkyX::VClouds::Ellipsoid::isOutOfCells
const bool isOutOfCells() const
Determines if the ellipsoid is out of the cells domain and needs to be removed.
Definition: Ellipsoid.cpp:121
SkyX::VClouds::Ellipsoid::mC2
int mC2
Definition: Ellipsoid.h:131
SkyX::VClouds::Ellipsoid::getDimensions
const Ogre::Vector3 getDimensions() const
Get dimensions.
Definition: Ellipsoid.h:93
SkyX::VClouds::Ellipsoid::setDimensions
void setDimensions(const Ogre::Vector3 &Dimensions)
Set dimensions.
Definition: Ellipsoid.cpp:133
SkyX::VClouds::Ellipsoid::updateProbabilities
void updateProbabilities(DataManager::Cell ***c, const int &nx, const int &ny, const int &nz, const bool &delayedResponse=true)
Update probabilities.
Definition: Ellipsoid.cpp:82
SkyX::VClouds::DataManager::Cell
Cell struct.
Definition: DataManager.h:41
SkyX::VClouds::Ellipsoid::mNy
int mNy
Definition: Ellipsoid.h:137
SkyX::VClouds::Ellipsoid::mC
int mC
Definition: Ellipsoid.h:131
SkyX::VClouds::Ellipsoid::getPosition
const Ogre::Vector3 getPosition() const
Get position.
Definition: Ellipsoid.h:101
SkyX::VClouds::Ellipsoid::move
void move(const int &Ax, const int &Ay, const int &Az)
Move the ellipsoid.
Definition: Ellipsoid.cpp:116
SkyX::VClouds::Ellipsoid::~Ellipsoid
~Ellipsoid()
Destructor.
Definition: Ellipsoid.cpp:42
SkyX::VClouds::Ellipsoid::mB
int mB
Definition: Ellipsoid.h:131
SkyX::VClouds::Ellipsoid
Ellipsoid class x^2 y^2 z^2 / + / + / = 1 a^2 b^2 c^2.
Definition: Ellipsoid.h:38
SkyX::VClouds::Ellipsoid::mA2
int mA2
Definition: Ellipsoid.h:131
SkyX::VClouds::Ellipsoid::mY
int mY
Definition: Ellipsoid.h:134
SkyX::VClouds::Ellipsoid::Ellipsoid
Ellipsoid(const int &a, const int &b, const int &c, const int &nx, const int &ny, const int &nz, const int &x, const int &y, const int &z, const Ogre::Real &DynLibManager=1.0f)
Constructor.
Definition: Ellipsoid.cpp:29
SkyX::VClouds::Ellipsoid::_getLength
const float _getLength(const int &x, const int &y, const int &z) const
Get length.
Definition: Ellipsoid.cpp:46
x
float x
Definition: (ValueTypes) quaternion.h:5
SkyX::VClouds::Ellipsoid::mX
int mX
Position.
Definition: Ellipsoid.h:134