java.lang.Object
de.grogra.ray2.radiosity.PatchGroup
A PatchGroup is a triangle witch contains 4 sub triangles.
- Author:
- Ralf Kopsch
-
Constructor Summary
ConstructorDescriptionPatchGroup
(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
Modifier and TypeMethodDescriptionvoid
Clears all calculated radiosity values.Converts the patch group into a mesh.boolean
ffMapContains
(List<SubPatch> deprecatedPatches) Returns true, if this group contains a deprecated patch.getEmittance
(int patchNum) Returns the emittance color of the sub patch with the given number.getFormFactors
(int patchNum) Returns the form factors of the sub patch with the given number.int
Returns the parent id.getPatch
(int i) Returns the sub path with the given number.getRadiosity
(int patchNum) Returns the radiosity color of the sub patch with the given number.Returns the refectance color.boolean
needSubDevide
(float threshold) Checks if this patch group must be subdivided.void
project
(Vector<PatchGroup> allGroups) Projects the given groups on all hemicubes of the current patch group.boolean
subdivide
(Vector<PatchGroup> group, List<SubPatch> deprecatedPatches, Vector<PatchGroup> subDivList, float threshold) Subdivides this patch group.
-
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
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
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
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
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
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
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
Returns the refectance color.- Returns:
- Returns the refectance color.
-
createMesh
Converts the patch group into a mesh.- Returns:
- Converts the patch group into a mesh.
-
ffMapContains
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.
-