# Class Fogger

java.lang.Object
uk.ac.starlink.ttools.plot.Fogger

public class Fogger extends Object
Defines how colours are changed at different depths (distances away from the viewer) by interposing a 'fog' which makes the colours gloomier the further away you go.

Various methods are provided to fog colours at a given Z coordinate. For reasonable rendering, `z` should be greater than or equal to zero, and of order of this renderer's scale distance.

Instances of this class are not thread safe.

The fogging algorithm comes from Eric Dumont's fog FAQ.

Since:
  18 Jan 2006
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`Fogger(double scale)`
Constructs a new depth tweaker for rendering distances of the order of a given scale.

## Method Summary

Modifier and Type
Method
Description
`DataColorTweaker`
`createTweaker(int ifog, int ncoord)`
Constructs a DataColorTweaker corresponding to this fogger which just takes care of fogging.
`DataColorTweaker`
`createTweaker(int ifog, DataColorTweaker base)`
Constructs a DataColorTweaker based on an existing one which appends the affect of this fogger.
`void`
`fogAt(double z, float[] rgba)`
Returns a fogged version of a given colour at a given depth using normalised components.
`int`
`fogAt(double z, int argb)`
Returns a fogged version of a given colour at a given depth.
`void`
`fogAt(double z, int[] rgba)`
Returns a fogged version of a given colour at a given depth.
`Color`
`fogAt(double z, Color color)`
Returns a fogged version of a given colour at a given depth.
`double`
`getFogginess()`
Returns the thickness of the fog.
`double`
`getScale()`
Returns the depth scale distance.
`void`
`setFogginess(double fogginess)`
Sets the thickness of the fog.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Fogger

public Fogger(double scale)
Constructs a new depth tweaker for rendering distances of the order of a given scale.

Parameters:
  `scale` - depth scale distance

## Method Details

### getScale

public double getScale()
Returns the depth scale distance.

Returns:
  depth scale distance

### setFogginess

public void setFogginess(double fogginess)
Sets the thickness of the fog. A given value of fogginess corresponds to a given amount of obscuration of a mark at a depth of the given multiple of the scale distance. Default value is zero (no fog).

Parameters:
  `fogginess` - intensity of fog per scale distance

### getFogginess

public double getFogginess()
Returns the thickness of the fog.

Returns:
  intensity of fog per scale distance

### fogAt

public Color fogAt(double z, Color color)
Returns a fogged version of a given colour at a given depth.

Parameters:
  `z` - distance at which the colour is being viewed
  `color` - original colour
Returns:
  fogged colour

### fogAt

public void fogAt(double z, int[] rgba)
Returns a fogged version of a given colour at a given depth.

Parameters:
  `z` - distance at which the colour is being viewed
  `rgba` - rgba colour components; these will be modified on exit to represent the fogged value

### fogAt

public void fogAt(double z, float[] rgba)
Returns a fogged version of a given colour at a given depth using normalised components.

Parameters:
  `z` - distance at which the colour is being viewed
  `rgba` - normalised rgba colour components; these will be modified on exit to represent the fogged value

### fogAt

public int fogAt(double z, int argb)
Returns a fogged version of a given colour at a given depth.

Parameters:
  `z` - distance at which the colour is being viewed
Returns:
  argb packed colour value for the fogged colour

### createTweaker

public DataColorTweaker createTweaker(int ifog, int ncoord)
Constructs a DataColorTweaker corresponding to this fogger which just takes care of fogging.

Parameters:
  `ifog` - index in coordinate array of Z coordinate
  `ncoord` - size of coordinate array

### createTweaker

public DataColorTweaker createTweaker(int ifog, DataColorTweaker base)
Constructs a DataColorTweaker based on an existing one which appends the affect of this fogger.

Parameters:
  `ifog` - index in coordinate array of Z coordinate
  `base` - color tweaker to be additionally fogged