Module raytracer

Class PatchGroup

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

public class PatchGroup extends Object
A PatchGroup is a triangle witch contains 4 sub triangles.
Author:
Ralf Kopsch
  • Constructor Details

    • 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.
    • 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.
  • Method Details

    • project

      public void project(Vector<PatchGroup> allGroups)
      Projects the given groups on all hemicubes of the current patch group.
      Parameters:
      allGroups - a list of patch groups.
    • 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.
    • subdivide

      public boolean subdivide(Vector<PatchGroup> group, List<SubPatch> deprecatedPatches, 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.
    • clearRadiosity

      public void clearRadiosity()
      Clears all calculated radiosity values.
    • 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.
    • getParentPatchID

      public int getParentPatchID()
      Returns the parent id.
      Returns:
      Returns the parent id.
    • 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.
    • getFormFactors

      public 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.
    • 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.
    • getReflectance

      public Color3f getReflectance()
      Returns the refectance color.
      Returns:
      Returns the refectance color.
    • createMesh

      public MyMeshVolume[] createMesh()
      Converts the patch group into a mesh.
      Returns:
      Converts the patch group into a mesh.
    • ffMapContains

      public boolean ffMapContains(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.