RigsofRods
Soft-body Physics Simulation
PressurePoint.h
Go to the documentation of this file.
1 /*
2 --------------------------------------------------------------------------------
3 This source file is part of Hydrax.
4 Visit http://www.ogre3d.org/tikiwiki/Hydrax
5 
6 Copyright (C) 2011 Jose Luis Cercós Pita <jlcercos@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 PRESSUREPOINT_H_INCLUDED
25 #define PRESSUREPOINT_H_INCLUDED
26 
27 // ----------------------------------------------------------------------------
28 // Include standar libraries
29 // ----------------------------------------------------------------------------
30 #include <math.h>
31 
32 // ----------------------------------------------------------------------------
33 // Include the hydrax prerequisites
34 // ----------------------------------------------------------------------------
35 #include "Prerequisites.h"
36 
37 // ----------------------------------------------------------------------------
38 // Include the noise module
39 // ----------------------------------------------------------------------------
40 #include "Noise.h"
41 
42 // ----------------------------------------------------------------------------
43 // Include the perlin noise
44 // ----------------------------------------------------------------------------
45 #include "Perlin.h"
46 
47 #ifndef _HydraxDensity_
48  #define _HydraxDensity_ 1025
49 #endif
50 #ifndef _HydraxGravity_
51  #define _HydraxGravity_ 9.81
52 #endif
53 
56 
59 
60 namespace Hydrax{ namespace Noise
61 {
62 
70 {
71 public:
84  PressurePoint(Ogre::Vector2 Orig, float p, float T, float L);
85 
89 
95  bool update(const Ogre::Real &timeSinceLastFrame);
96 
103  float getValue(const float &x, const float &y);
104 
108  inline Ogre::Vector2 getOrigin() const{return mPos;}
112  inline float GetTyrePressure() const{return mP;}
116  inline float getMaximumTime() const{return mT;}
120  inline float getTime() const{return mTime;}
124  inline float getLength() const{return mL;}
125 
126 protected:
127 
128 
129 private:
131  double mTime;
132 
134  Ogre::Vector2 mPos;
136  float mP;
138  float mT;
140  float mL;
142  float mA;
144  float mK;
146  float mC;
148  float mW;
150  float mK1;
152  float mK2;
153 
154 };
155 
156 }} // Namespace
157 
160 
161 #endif // PRESSUREPOINT_H_INCLUDED
Hydrax::Noise::PressurePoint::mPos
Ogre::Vector2 mPos
Direction (must be normalised)
Definition: PressurePoint.h:134
y
float y
Definition: (ValueTypes) quaternion.h:6
Hydrax::Noise::PressurePoint::mT
float mT
Period.
Definition: PressurePoint.h:138
Hydrax
Definition: CfgFileManager.cpp:28
Hydrax::Noise::PressurePoint::update
bool update(const Ogre::Real &timeSinceLastFrame)
Call it each frame.
Definition: PressurePoint.cpp:64
Hydrax::Noise::PressurePoint::getValue
float getValue(const float &x, const float &y)
Get the especified x/y noise value.
Definition: PressurePoint.cpp:77
Noise.h
Hydrax::Noise::PressurePoint::mK1
float mK1
Time decay term.
Definition: PressurePoint.h:150
Hydrax::Noise::PressurePoint::mW
float mW
Angular frec.
Definition: PressurePoint.h:148
Perlin.h
Hydrax::Noise::PressurePoint::getMaximumTime
float getMaximumTime() const
Returns maximum time.
Definition: PressurePoint.h:116
Hydrax::Noise::PressurePoint::PressurePoint
PressurePoint(Ogre::Vector2 Orig, float p, float T, float L)
Default constructor.
Definition: PressurePoint.cpp:47
Hydrax::Noise::PressurePoint::mK2
float mK2
Distance decay term.
Definition: PressurePoint.h:152
Hydrax::Noise::PressurePoint::mP
float mP
Pressure.
Definition: PressurePoint.h:136
Prerequisites.h
Hydrax::Noise::PressurePoint::mL
float mL
Lenght.
Definition: PressurePoint.h:140
Hydrax::Noise::PressurePoint::GetTyrePressure
float GetTyrePressure() const
Returns pressure pulse.
Definition: PressurePoint.h:112
Hydrax::Noise::PressurePoint::mTime
double mTime
Elapsed time.
Definition: PressurePoint.h:131
Hydrax::Noise::PressurePoint::getTime
float getTime() const
Returns time ellapsed.
Definition: PressurePoint.h:120
Hydrax::Noise::PressurePoint::getOrigin
Ogre::Vector2 getOrigin() const
Returns origin of the PressurePoint.
Definition: PressurePoint.h:108
Hydrax::Noise::PressurePoint
A PressurePoint defined by the origen, pressure pulse, Maximum time of perturbation and wave longitud...
Definition: PressurePoint.h:69
Hydrax::Noise::PressurePoint::mC
float mC
Speed (calculated)
Definition: PressurePoint.h:146
Hydrax::Noise::PressurePoint::getLength
float getLength() const
Returns wave length.
Definition: PressurePoint.h:124
Hydrax::Noise::PressurePoint::~PressurePoint
~PressurePoint()
Destructor.
Definition: PressurePoint.cpp:60
x
float x
Definition: (ValueTypes) quaternion.h:5
Hydrax::Noise::PressurePoint::mA
float mA
Ampliutde.
Definition: PressurePoint.h:142
Hydrax::Noise::PressurePoint::mK
float mK
Dispersion factor.
Definition: PressurePoint.h:144