de.grogra.ray2.radiosity
Class PatchGroup

java.lang.Object
  extended by de.grogra.ray2.radiosity.PatchGroup

public class PatchGroup
extends java.lang.Object

A PatchGroup is a triangle witch contains 4 sub triangles.

Author:
Ralf Kopsch

Constructor Summary
PatchGroup(SubPatch p, int id, Color3f refl, Color3f emitted, Color3f radios)
          Creates a new patch group by subdividing the given patch.
PatchGroup(Vector3d[] vertices, int id, Color3f emitted, Color3f reflected, Color3f radios, boolean visible)
          Creates a new patch group.
 
Method Summary
 void clearRadiosity()
          Clears all calculated radiosity values.
 MyMeshVolume[] createMesh()
          Converts the patch group into a mesh.
 boolean ffMapContains(java.util.List<SubPatch> deprecatedPatches)
          Returns true, if this group contains a deprecated patch.
 Color3f getEmittance(int patchNum)
          Returns the emittance color of the sub patch with the given number.
 java.util.Map<SubPatch,FormFactor> getFormFactors(int patchNum)
          Returns the form factors of the sub patch with the given number.
 int getParentPatchID()
          Returns the parent id.
 SubPatch getPatch(int i)
          Returns the sub path with the given number.
 Color3f getRadiosity(int patchNum)
          Returns the radiosity color of the sub patch with the given number.
 Color3f getReflectance()
          Returns the refectance color.
 boolean needSubDevide(float threshold)
          Checks if this patch group must be subdivided.
 void project(java.util.Vector<PatchGroup> allGroups)
          Projects the given groups on all hemicubes of the current patch group.
 boolean subdivide(java.util.Vector<PatchGroup> group, java.util.List<SubPatch> deprecatedPatches, java.util.Vector<PatchGroup> subDivList, float threshold)
          Subdivides this patch group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatchGroup

public PatchGroup(SubPatch p,
                  int id,
                  Color3f refl,
                  Color3f emitted,
                  Color3f radios)
Creates a new patch group by subdividing the given patch.

Parameters:
p - the patch to subdivide.
id - the group id.
refl - the refelcted color.
emitted - the emmited color.
radios - the radiosity color.

PatchGroup

public PatchGroup(Vector3d[] vertices,
                  int id,
                  Color3f emitted,
                  Color3f reflected,
                  Color3f radios,
                  boolean visible)
Creates a new patch group.

Parameters:
vertices - a list of 3 or 4 vertices.
id - the group id.
emitted - the emmited color.
reflected - the refelcted color.
radios - the radiosity color.
visible - false, if this group and all sub patches should be invisible.
Method Detail

clearRadiosity

public void clearRadiosity()
Clears all calculated radiosity values.


createMesh

public MyMeshVolume[] createMesh()
Converts the patch group into a mesh.

Returns:
Converts the patch group into a mesh.

ffMapContains

public boolean ffMapContains(java.util.List<SubPatch> deprecatedPatches)
Returns true, if this group contains a deprecated patch.

Parameters:
deprecatedPatches - a list of deprecated patches.
Returns:
Returns true, if this group contains a deprecated patch.

getEmittance

public Color3f getEmittance(int patchNum)
Returns the emittance color of the sub patch with the given number.

Parameters:
patchNum - the sub patch number.
Returns:
Returns the emittance color of the sub patch with the given number.

getFormFactors

public java.util.Map<SubPatch,FormFactor> getFormFactors(int patchNum)
Returns the form factors of the sub patch with the given number.

Parameters:
patchNum - the sub patch number.
Returns:
Returns the form factors of the sub patch with the given number.

getParentPatchID

public int getParentPatchID()
Returns the parent id.

Returns:
Returns the parent id.

getPatch

public SubPatch getPatch(int i)
Returns the sub path with the given number.

Parameters:
i - the number.
Returns:
Returns the sub path with the given number.

getRadiosity

public Color3f getRadiosity(int patchNum)
Returns the radiosity color of the sub patch with the given number.

Parameters:
patchNum - the sub patch number.
Returns:
Returns the radiosity color of the sub patch with the given number.

getReflectance

public Color3f getReflectance()
Returns the refectance color.

Returns:
Returns the refectance color.

needSubDevide

public boolean needSubDevide(float threshold)
Checks if this patch group must be subdivided.

Parameters:
threshold - the subdivision threshold.
Returns:
true, if this group must be subdivided.

project

public void project(java.util.Vector<PatchGroup> allGroups)
Projects the given groups on all hemicubes of the current patch group.

Parameters:
allGroups - a list of patch groups.

subdivide

public boolean subdivide(java.util.Vector<PatchGroup> group,
                         java.util.List<SubPatch> deprecatedPatches,
                         java.util.Vector<PatchGroup> subDivList,
                         float threshold)
Subdivides this patch group.

Parameters:
group - a global list of all groups.
deprecatedPatches - a list of deprecated patche groups.
subDivList - a list of divided patch groups.
threshold - the subdivision threshold.
Returns:
true, if this group was subdivided.