Flight Club


flightclub.client
Class Cloud

java.lang.Object
  |
  +--flightclub.client.Cloud
All Implemented Interfaces:
CameraSubject, ClockObserver

public class Cloud
extends java.lang.Object
implements CameraSubject, ClockObserver

This class implements a cumulus cloud being fed by a thermal. The wind makes things slope:

 
                 .--.
          cloud /   |
               .----.
                / /
         thermal /    wind ->
              / /
         --------------
         
    
Inside the inner class Shape3d we work in spherical polars. Four quadrants are defined as follows:
 
              2  |  1
                 |
              ---.--->y
                 |
              3  |  0
                 x
 
    


Field Summary
static int CLOUDBASE
           
 
Constructor Summary
Cloud(ModelViewer modelViewer, float x, float y)
          Creates a cloud with the default size.
Cloud(ModelViewer modelViewer, float x, float y, int size)
          Creates a cloud.
 
Method Summary
 void destroyMe()
          Destroys refences to this cloud and its child objects so it will be garbage collected.
protected  void finalize()
           
 void freeze()
           
 float[] getEye()
           
 float[] getFocus()
           
 float getLift(float x, float y, float z)
          Returns lift at a point.
 boolean isUnder(float x, float y, float z)
          Returns true if the point is 'under' the cloud.
 boolean noLift()
          Returns true is this cloud still has a thermal under it.
 void setWind(float wind_x, float wind_y)
          The thermal slope is a function of the wind.
 void tick(float t, float dt)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLOUDBASE

public static final int CLOUDBASE
See Also:
Constant Field Values
Constructor Detail

Cloud

public Cloud(ModelViewer modelViewer,
             float x,
             float y,
             int size)
Creates a cloud. The cloud will grow from nothing, drift along for a period of time and then evaporate. The cloud strength is measured in multiples of a glider's sink rate. Stronger clouds are bigger and darker than weaker clouds.


Cloud

public Cloud(ModelViewer modelViewer,
             float x,
             float y)
Creates a cloud with the default size.

Method Detail

destroyMe

public void destroyMe()
Destroys refences to this cloud and its child objects so it will be garbage collected.


isUnder

public boolean isUnder(float x,
                       float y,
                       float z)
Returns true if the point is 'under' the cloud. By 'under' we mean within the sloping column of rising air that is feeding this cloud.


tick

public void tick(float t,
                 float dt)
Specified by:
tick in interface ClockObserver

noLift

public boolean noLift()
Returns true is this cloud still has a thermal under it.


getFocus

public float[] getFocus()
Specified by:
getFocus in interface CameraSubject

getEye

public float[] getEye()
Specified by:
getEye in interface CameraSubject

getLift

public final float getLift(float x,
                           float y,
                           float z)
Returns lift at a point. The lift is a function of r, the distance from the thermal center:
 
                   ^ lift
               .---|---.
             /     |     \
           /       |       \
         .---------.---------.--->r
                   0
 
         


setWind

public void setWind(float wind_x,
                    float wind_y)
The thermal slope is a function of the wind. A thermal gets blown downwind as it climbs.
                 .--.
                /   |
               .----.
                 /
                /      wind ->
               /
         --------------
 
        
In nil wind a thermal rises vertically and we have zero slope.


freeze

public void freeze()

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

Dan Burton <danb@dircon.co.uk> | latest update: 20 Sep 2002;