|
||||||||||
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.piece.MonteCarloFF
public class MonteCarloFF
This module provides stochastic Monte Carlo methods (hemisphere sampling, area sampling, area-to-area sampling) for form-factor solving.
RadiosityBasisFunctions
,
Brep
,
BitSet
,
MicroFacet
Nested Class Summary | |
---|---|
static class |
MonteCarloFF.Sampling
Supported sampling methods. |
Field Summary | |
---|---|
protected double[] |
area
Element areas. |
protected int |
attrNormal
Actual vertex-normal attribute. |
protected Brep |
brep
Accelerator: input B-rep database. |
static java.lang.String |
CACHE_SIZE
|
protected int |
cacheSize
How many rows will be cached? |
protected static java.lang.String |
CATEGORY
Object category. |
protected int |
ctx
Actual Brep context. |
protected double[][] |
fullCache
Full row-cache in case of cacheSize >= num . |
protected GeometrySearch |
geom
Accelerator: scene optimalization. |
protected boolean |
isInit
Accelerators are initialized? |
static java.lang.String |
NUMBER_RAYS
|
protected int |
numRays
Number of rays, which are shooted from one element. |
static RegPiece |
reg
Static registration instance for this class. |
protected RandomJames |
rnd
Random number generator. |
protected LRUCache<double[]> |
rowCache
FF row cache. |
protected MonteCarloFF.Sampling |
sampling
Actual sampling method. |
static java.lang.String |
SAMPLING
|
protected Solid |
solid
Accelerator: intersection computing. |
protected static java.lang.String |
TEMPLATE_NAME
Object template identifier. |
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 | |
---|---|
MonteCarloFF()
|
Method Summary | |
---|---|
protected void |
assertAreas()
Computes areas of all elements (if necessary). |
int |
coefficientsFromElement(int elem,
int[] result)
Returns coefficient indexes defining the given element. |
java.util.BitSet |
coefficientsFromElements(java.util.BitSet elements,
java.util.BitSet result)
Returns set of coefficients defining the given set of elements. |
double[] |
distribute(int elem,
double[] coords,
double[] result)
Computes distribution coefficients for the single point of the element. |
double |
elementArea(int i)
Computes area of the given element (triangle is presumed) . |
int |
elementsFromCoefficient(int coeff,
int[] result)
Returns elements which are affected by the given single coefficient. |
java.util.BitSet |
elementsFromCoefficients(java.util.BitSet coefficients,
java.util.BitSet result)
Returns set of elements which are affected by the given set of coefficients. |
double |
formFactor(int from,
int to)
Computes single form-factor (F_{from,to}). |
int |
formFactorsFrom(int coeff,
int[] ind,
double[] ff)
Computes "shooting" form-factors (single source coefficient is fixed). |
int |
formFactorsTo(int coeff,
int[] ind,
double[] ff)
Computes "gathering" form-factors (single target coefficient is fixed). |
protected double[] |
generateRays(int coeff,
double[][] origin,
double[][] direction)
Generates required number of rays for shooting throught the hemisphere. |
java.lang.Object |
get(java.lang.String key)
Gets the given property. |
int |
getOrder()
Order of the approximation (for information purposes only). |
protected double[][] |
getVertices(int handle,
double[][] vertex)
Return coords of all vertices of the triangle. |
protected boolean |
init()
Initialize accelerators.. |
protected double[] |
randomWeighted(double[][] v,
double[][] dir)
Generate uniform random directions by random generating numbers. |
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. |
int |
totalCoefficients()
Total number of coefficients. |
int |
totalElements()
Total number of elements in the scene. |
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 LRUCache<double[]> rowCache
protected double[][] fullCache
cacheSize
>= num
.
protected int cacheSize
protected MonteCarloFF.Sampling sampling
protected Brep brep
protected Solid solid
protected GeometrySearch geom
protected int ctx
Brep
context.
protected int attrNormal
protected final RandomJames rnd
protected int numRays
protected double[] area
protected boolean isInit
public static final java.lang.String SAMPLING
public static final java.lang.String NUMBER_RAYS
public static final java.lang.String CACHE_SIZE
protected static final java.lang.String TEMPLATE_NAME
protected static final java.lang.String CATEGORY
public static final RegPiece reg
Constructor Detail |
---|
public MonteCarloFF()
Method Detail |
---|
public int getOrder()
getOrder
in interface RadiosityBasisFunctions
public int coefficientsFromElement(int elem, int[] result)
coefficientsFromElement
in interface RadiosityBasisFunctions
elem
- Element handle.result
- Pre-allocated integer array to hold result (can be null
).
public int elementsFromCoefficient(int coeff, int[] result)
elementsFromCoefficient
in interface RadiosityBasisFunctions
coeff
- Coefficient index.result
- Pre-allocated integer array to hold result (can be null
).
public java.util.BitSet coefficientsFromElements(java.util.BitSet elements, java.util.BitSet result)
coefficientsFromElements
in interface RadiosityBasisFunctions
elements
- Set of elements.result
- Non-mandatory object to be filled.
public java.util.BitSet elementsFromCoefficients(java.util.BitSet coefficients, java.util.BitSet result)
elementsFromCoefficients
in interface RadiosityBasisFunctions
coefficients
- Set of coefficients.result
- Non-mandatory object to be filled.
public double[] distribute(int elem, double[] coords, double[] result)
distribute
in interface RadiosityBasisFunctions
elem
- Element handle.coords
- World-space (?) coordinates of the point lying on the given element.result
- Non-mandatory pre-allocated array to hold result.
coefficientsFromElement(int, int[])
).public int totalElements()
totalElements
in interface RadiosityBasisFunctions
public int totalCoefficients()
totalCoefficients
in interface RadiosityBasisFunctions
public int formFactorsFrom(int coeff, int[] ind, double[] ff)
formFactorsFrom
in interface RadiosityBasisFunctions
coeff
- Source-coefficient index.ind
- Array to hold affected (lit) coefficient indices (can be null
).ff
- Array to hold respective form-factors (can be null
).
public int formFactorsTo(int coeff, int[] ind, double[] ff)
formFactorsTo
in interface RadiosityBasisFunctions
coeff
- Target-coefficient index.ind
- Array to hold relevant (visible) coefficient indices (can be null
).ff
- Array to hold respective form-factors (can be null
).
public double formFactor(int from, int to)
formFactor
in interface RadiosityBasisFunctions
protected boolean init()
public double elementArea(int i)
protected double[][] getVertices(int handle, double[][] vertex)
protected void assertAreas()
protected double[] generateRays(int coeff, double[][] origin, double[][] direction)
coeff
- ID of element, which is shooting ray.origin
- Pre-allocated array to hold sampling points on element
in world coordinates.direction
- Pre-allocated array to hold sampling points
on hemisphere or area in world coordinates.protected double[] randomWeighted(double[][] v, double[][] dir)
v
- World-space coordinates of the triangle vertices.dir
- Pre-allocated array to hold normalized direction of ray in tangent space.
null
if all rays are equally important.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 |