|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.j3d.geom.particle.WindParticleFunction
public class WindParticleFunction
WindParticleFunction models a directional wind source.
The wind has a direction and speed that control how it effects the individual particle. From the wind speed, a pressure is calculated using the following model:
pressure = 10^(2 * log(speed)) * 0.64615This is taken from the only I could find that would convert speed to a pressure applied on an object. The location of this convertor is http://www.cactus2000.de/uk/unit/masswsp.shtml
The force applied to the particle is thus proportional to it's surface area. Naturally this does not do a really good model, such as taking into account drag effects, etc, but it should be good-enough to model a gusty wind acting on a lot of small particles.
Further parameterisation is provided by allowing gustiness (speed variation) and turbulence (direction variation) per frame, controlling the strength and direction of the wind force.
Internationalisation Resource Names
Constructor Summary | |
---|---|
WindParticleFunction()
Construct a new default wind particle function. |
|
WindParticleFunction(float[] direction,
float speed,
float gustiness,
float turbulence)
Construct a new wind function with the parameters provided. |
Method Summary | |
---|---|
boolean |
apply(Particle particle)
Apply this function to the given particle right now. |
void |
getDirection(float[] dir)
Fetch the current direction of the wind speed direction. |
float |
getGustiness()
Get the current gustiness that particles effected by. |
float |
getSpeed()
Get the current speed of the wind. |
float |
getTurbulence()
Get the current turbulence that particles are effected by. |
boolean |
isEnabled()
Check to see if this function has been enabled or not currently. |
boolean |
newFrame(int deltaT)
Notification that the system is about to do an update of the particles and to do any system-level initialisation. |
void |
setDirection(float x,
float y,
float z)
Change the direction of the wind. |
void |
setEnabled(boolean state)
Set the enabled state of this function. |
void |
setGustiness(float gustiness)
Change the gustiness that wind is blowing at. |
void |
setSpeed(float speed)
Change the speed that wind is blowing at. |
void |
setTurbulence(float turbulence)
Change the turbulence of the wind. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WindParticleFunction()
public WindParticleFunction(float[] direction, float speed, float gustiness, float turbulence)
direction
- The direction of the windspeed
- The speed of the windgustiness
- Speed variation per-frame, non-negativeturbulence
- Amount of per-particle varianceMethod Detail |
---|
public boolean isEnabled()
isEnabled
in interface ParticleFunction
public void setEnabled(boolean state)
setEnabled
in interface ParticleFunction
state
- The new enabled state to set it topublic boolean newFrame(int deltaT)
newFrame
in interface ParticleFunction
deltaT
- The elapsed time in milliseconds since the last frame
public boolean apply(Particle particle)
apply
in interface ParticleFunction
particle
- The particle to apply the function to
public void setSpeed(float speed)
speed
- The magnitude of the wind speed to usepublic float getSpeed()
public void setDirection(float x, float y, float z)
x
- The x component of the wind directiony
- The y component of the wind directionz
- The z component of the wind directionpublic void getDirection(float[] dir)
dir
- An array of length 3 to copy the values intopublic void setGustiness(float gustiness) throws java.lang.IllegalArgumentException
gustiness
- The magnitude of the wind gustiness to use
java.lang.IllegalArgumentException
- The value was negativepublic float getGustiness()
public void setTurbulence(float turbulence)
turbulence
- The magnitude of the wind turbulence to usepublic float getTurbulence()
|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |