|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.jagrlib.DefaultProperty
cz.cuni.jagrlib.Piece
cz.cuni.jagrlib.testing.PhotonMap
public class PhotonMap
Module for photon storing. Primary intended for photon mapping application.
Nested Class Summary | |
---|---|
protected static class |
PhotonMap.Filter
Supported filters used in a radiance/irradiance estimation. |
protected static class |
PhotonMap.Type
Types of searching of nearest photons. |
protected static class |
PhotonMap.Volume
Volumes used for finding photons. |
Field Summary | |
---|---|
protected static double |
ALPHA
For Gaussian filte. |
protected double[] |
bboxMax
Maximals of bounding box. |
protected double[] |
bboxMin
Minimals of bounding box. |
protected static double |
BETA
For Gaussian filter. |
protected static java.lang.String |
CATEGORY
Object category. |
protected float[] |
cosphi
Cosinus of angle phi. |
protected float[] |
costheta
Cosinus of angle theta. |
static java.lang.String |
DIR_ERROR
|
protected double |
dirError
Maximal error of normal and direction of photon is radiance/irradiance estimate. |
protected int |
estimate
Maximal number of photons which can be used for radiosity estimate. |
static java.lang.String |
ESTIMATE
|
protected PhotonMap.Filter |
filter
Actual filter for radiance/irradiance estimate. |
static java.lang.String |
FILTER
|
protected int |
halfStoredPhotons
Half of stored photons. |
protected boolean |
isBalanced
Was the photon map balanced? |
protected boolean |
isInit
Was the photon map initialized? |
protected double |
k
Filter constant characterizing the cone filter. |
static java.lang.String |
K
|
static java.lang.String |
LOG_ESTIMATE
|
static java.lang.String |
LOG_PHOTONS
|
protected boolean |
logEstimate
Log information about estimates? |
protected boolean |
logPhotons
Log all photons stored in photon map? |
static java.lang.String |
MAX_PHOTONS
|
protected int |
maxPhotons
Maximal number of stored photons. |
protected cz.cuni.jagrlib.testing.PhotonMap.Photon[] |
photon
The list of photons stored in the photon map. |
protected int |
prevScale
Number of already scaled photons. |
protected double |
radius
Maximal radius of the sphere/circle (maximal distance between estimate point and a photon). |
static java.lang.String |
RADIUS
|
static RegPiece |
reg
Static registration instance for this class. |
protected float[] |
sinphi
Sinus of angle phi. |
protected float[] |
sintheta
Sinus of angle theta. |
protected int |
storedPhotons
Number of stored photons. |
protected static java.lang.String |
TEMPLATE_NAME
Object template identifier. |
protected PhotonMap.Type |
type
Actual type of searching nearest photons. |
static java.lang.String |
TYPE
|
protected PhotonMap.Volume |
volume
Actual volume used for finding photons. |
static java.lang.String |
VOLUME
|
Fields inherited from class cz.cuni.jagrlib.Piece |
---|
channels, info, pl, plugs, TEMPLATE_TYPE, userBreak |
Fields inherited from interface cz.cuni.jagrlib.iface.Property |
---|
LOGGING, STATISTICS, TEXT_DESCRIPTION |
Constructor Summary | |
---|---|
PhotonMap()
|
Method Summary | |
---|---|
void |
addPencil(double[] center,
double[][] dir,
float[] radiance,
double distance)
Add single pencil. |
void |
addPhoton(double[] origin,
double[] dir,
float[] power)
Add single photon. |
void |
addRadiosity(int handle,
float[] amount)
Add single contribution of energy to the some element. |
void |
addRays(double[] origin,
double[] dir)
Add single ray. |
protected void |
balance()
Creates a left-balanced KD-tree from the flat photon array. |
protected void |
balanceSegment(int index,
int start,
int end,
cz.cuni.jagrlib.testing.PhotonMap.Photon[] organiz,
cz.cuni.jagrlib.testing.PhotonMap.Photon[] balance)
Recursively balances KD-tree. |
java.lang.Object |
get(java.lang.String key)
Gets the given property. |
int |
getNumberElements()
Returns number of saved elements. |
int |
getNumberPencils()
Returns number of saved pencils. |
int |
getNumberPhotons()
Returns number of saved photons. |
int |
getNumberRays()
Returns number of saved rays. |
double[] |
irradiance(double[] position,
double[] normal,
double[] irrad)
Computes irradiance at some point. |
boolean |
isFull()
Is light map full? |
protected cz.cuni.jagrlib.testing.PhotonMap.NearestPhotons |
locatePhotons(int index,
cz.cuni.jagrlib.testing.PhotonMap.NearestPhotons np)
Finds the nearest photons in the photon map under the given conditions (np). |
protected cz.cuni.jagrlib.testing.PhotonMap.NearestPhotons |
locatePhotons(cz.cuni.jagrlib.testing.PhotonMap.NearestPhotons np)
Finds the nearest photons in the photon map under the given conditions (np). |
protected void |
medianSplit(int start,
int end,
int median,
int axis,
cz.cuni.jagrlib.testing.PhotonMap.Photon[] p)
Splits photon array into two separates pieces around the median, with all photons below the median in the lower half and all photons above the median in the upper half. |
protected double[] |
photonDir(cz.cuni.jagrlib.testing.PhotonMap.Photon p,
double[] dir)
Returns the direction of a photon. |
protected void |
prepare()
|
double[] |
radiance(double[] position,
double[] dir,
double[] rad)
Computes irradiance at some point. |
float[] |
radiosity(int handle)
Computes the radiosity of the single element. |
void |
scalePhotonPower(float scale)
Scales the power of all photons in the once they have been emitted from the light source. |
void |
set(java.lang.String key,
java.lang.Object value)
Sets the given property. |
static int |
setTemplate(Template t,
int ord)
General-purpose registration routine. |
protected void |
swap(cz.cuni.jagrlib.testing.PhotonMap.Photon[] ph,
int a,
int b)
Swap two photons (a, b) in the list. |
Methods inherited from class cz.cuni.jagrlib.Piece |
---|
className, connect, findPlug, findPlug, getInfo, getInterface, getInterface, getPlug, getReg, init, isCompatible, isCompatible, isConnected, logError, logWarning, myInterface, newInputPlug, newOptOutputPlug, newOutputPlug, newPlug, noTemplates, propBegin, propBounds, propDefault, propEnd, propEnum, propManipulator, propManipulator, setProgressListener, setRegStrings, setTemplateDynamic, stop |
Methods inherited from class cz.cuni.jagrlib.DefaultProperty |
---|
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, commit, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, stringProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PhotonMap.Volume volume
protected PhotonMap.Filter filter
protected PhotonMap.Type type
protected int maxPhotons
protected int storedPhotons
protected int halfStoredPhotons
protected cz.cuni.jagrlib.testing.PhotonMap.Photon[] photon
protected float[] sintheta
protected float[] costheta
protected float[] sinphi
protected float[] cosphi
protected double[] bboxMin
protected double[] bboxMax
protected int prevScale
protected int estimate
protected double radius
protected double dirError
protected double k
protected boolean isInit
protected boolean isBalanced
protected boolean logEstimate
protected boolean logPhotons
protected static final double ALPHA
protected static final double BETA
public static final java.lang.String VOLUME
public static final java.lang.String TYPE
public static final java.lang.String FILTER
public static final java.lang.String MAX_PHOTONS
public static final java.lang.String ESTIMATE
public static final java.lang.String RADIUS
public static final java.lang.String DIR_ERROR
public static final java.lang.String K
public static final java.lang.String LOG_ESTIMATE
public static final java.lang.String LOG_PHOTONS
protected static final java.lang.String TEMPLATE_NAME
protected static final java.lang.String CATEGORY
public static final RegPiece reg
Constructor Detail |
---|
public PhotonMap()
Method Detail |
---|
protected void prepare()
protected cz.cuni.jagrlib.testing.PhotonMap.NearestPhotons locatePhotons(int index, cz.cuni.jagrlib.testing.PhotonMap.NearestPhotons np)
index
- Index of starting photon.np
- NearestPhotons class as a photon-store.protected cz.cuni.jagrlib.testing.PhotonMap.NearestPhotons locatePhotons(cz.cuni.jagrlib.testing.PhotonMap.NearestPhotons np)
index
- Index of starting photon.np
- NearestPhotons class as a photon-store.protected double[] photonDir(cz.cuni.jagrlib.testing.PhotonMap.Photon p, double[] dir)
public void scalePhotonPower(float scale)
scalePhotonPower
in interface LightMap
protected void balance()
protected void medianSplit(int start, int end, int median, int axis, cz.cuni.jagrlib.testing.PhotonMap.Photon[] p)
start
- Start of photon block in array.end
- End of photon block in array.median
- Desired median number.axis
- Axis to split along.p
- Photons for splitting.protected void balanceSegment(int index, int start, int end, cz.cuni.jagrlib.testing.PhotonMap.Photon[] organiz, cz.cuni.jagrlib.testing.PhotonMap.Photon[] balance)
index
- start
- Start of photon block in array.end
- End of photon block in array.organiz
- Array for organization of photons which is used when
splitting comes up (input variable).balance
- Balanced array of photons (output variable).protected void swap(cz.cuni.jagrlib.testing.PhotonMap.Photon[] ph, int a, int b)
public void addPhoton(double[] origin, double[] dir, float[] power)
addPhoton
in interface LightMap
public void addRays(double[] origin, double[] dir)
addRays
in interface LightMap
public void addPencil(double[] center, double[][] dir, float[] radiance, double distance)
addPencil
in interface LightMap
public void addRadiosity(int handle, float[] amount)
addRadiosity
in interface LightMap
public double[] radiance(double[] position, double[] dir, double[] rad)
radiance
in interface LightMap
position
- Position of point in which is irradiance computing.direction
- rad
- Pre-allocated array to hold resulting irradiance.
public double[] irradiance(double[] position, double[] normal, double[] irrad)
irradiance
in interface LightMap
position
- Position of point in which is irradiance computing.irrad
- Pre-allocated array to hold resulting irradiance.
public float[] radiosity(int handle)
radiosity
in interface LightMap
public int getNumberPhotons()
getNumberPhotons
in interface LightMap
public int getNumberRays()
getNumberRays
in interface LightMap
public int getNumberPencils()
getNumberPencils
in interface LightMap
public int getNumberElements()
getNumberElements
in interface LightMap
public boolean isFull()
isFull
in interface LightMap
public void set(java.lang.String key, java.lang.Object value)
set
in interface Property
set
in class DefaultProperty
key
- Key string.value
- The new value.Property.commit()
public java.lang.Object get(java.lang.String key)
get
in interface Property
get
in class DefaultProperty
key
- Key string.
null
.public static int setTemplate(Template t, int ord)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |