de.grogra.ray2.photonmap
Class PhotonMap

java.lang.Object
  extended by de.grogra.ray2.photonmap.PhotonMap

public class PhotonMap
extends java.lang.Object

This class provides a photon map. The photon map uses a kd-tree data structure for fast access.

Author:
Ralf Kopsch

Constructor Summary
PhotonMap(double photonArea)
          Creates a new Photon Map.
 
Method Summary
 int getEntryCount()
          Returns the number of photon map entries.
 void insertPhoton(Color3f col, Point3d pos, Vector3f dir)
          Inserts a new Photon into this map.
 void sumPhotons(Point3d point, Vector3f normal, Tuple3d color)
          Calculates the color for the given point.
 float traceRay(Intersection desc, Tuple3d color)
          This is only a debug function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhotonMap

public PhotonMap(double photonArea)
Creates a new Photon Map.

Parameters:
photonArea - the scanning area.
Method Detail

getEntryCount

public int getEntryCount()
Returns the number of photon map entries.

Returns:
Returns the number of photon map entries.

insertPhoton

public void insertPhoton(Color3f col,
                         Point3d pos,
                         Vector3f dir)
Inserts a new Photon into this map.

Parameters:
col - The Photon color.
pos - The Photon position.
dir - The Photon impact direction.

sumPhotons

public void sumPhotons(Point3d point,
                       Vector3f normal,
                       Tuple3d color)
Calculates the color for the given point.

Parameters:
point - the impact point.
normal - the impact normal vector.
color - output - the calculated color

traceRay

public float traceRay(Intersection desc,
                      Tuple3d color)
This is only a debug function. It direct visualise the photon map.

Parameters:
desc - the intersection description
color - output - the calculated color
Returns:
transparent value