本文整理汇总了C++中InterfaceList::getInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ InterfaceList::getInterface方法的具体用法?C++ InterfaceList::getInterface怎么用?C++ InterfaceList::getInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InterfaceList
的用法示例。
在下文中一共展示了InterfaceList::getInterface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runABM
ReflectPair runABM(int nSamples, double azimuthalAngle,
double polarAngle, bool disableSieve, InterfaceList &interfaceList) {
int startState;
int reflectedState;
int transmittedState;
int absorbedState = -2;
int numReflected = 0;
int numTransmitted = 0;
int numAbsorbed = 0;
double sp = sin(polarAngle);
vec3 startingPosition(
cos(azimuthalAngle)*sp,
sin(azimuthalAngle)*sp,
cos(polarAngle)
);
startingPosition.z *= -1; /* Leaf interfaces are listed adaxial-first,
orientation is generally assumed with respect to abaxial */
if(startingPosition.z < 0) {
startState = 0;
reflectedState = -1;
transmittedState = interfaceList.size();
} else {
startState = interfaceList.size() - 1;
reflectedState = startState + 1;
transmittedState = -1;
}
for(int i = 0; i < nSamples; i++) {
vec3 direction(startingPosition);
int state = startState;
interfaceList.prepareForSample();
while(state != reflectedState && state != transmittedState && state != absorbedState) {
const ABMInterface &interface = interfaceList.getInterface(state);
double n1;
double n2;
double perturbanceReflect;
double perturbanceRefract;
int reflectState;
int refractState;
double thickness;
double absorption;
vec3 normal(0,0,0);
if(direction.z < 0) {
normal.z = 1.0;
n1 = interface.nAbove;
n2 = interface.nBelow;
perturbanceReflect = interface.perturbanceDownAbove;
perturbanceRefract = interface.perturbanceDownBelow;
refractState = state + 1;
reflectState = state - 1;
thickness = interface.thicknessAbove;
absorption = interface.absorptionAbove;
} else {
normal.z = -1.0;
n1 = interface.nBelow;
n2 = interface.nAbove;
perturbanceReflect = interface.perturbanceUpBelow;
perturbanceRefract = interface.perturbanceUpAbove;
reflectState = state + 1;
refractState = state - 1;
thickness = interface.thicknessBelow;
absorption = interface.absorptionBelow;
}
double normalAngle = -direction.Dot(normal);
if(thickness > 0 && freePathLength(direction, normal, normalAngle, absorption, disableSieve) < thickness) {
state = absorbedState;
break;
} else {
if(RANDOM_FUNCTION() < fresnellCoefficient(direction, normal, normalAngle, n1, n2)) {
state = reflectState;
direction = reflect(direction, normal, normalAngle);
if(perturbanceReflect != INFINITY) {
direction = brakkeScattering(direction, perturbanceReflect);
}
} else {
state = refractState;
direction = refract(direction, normal, normalAngle, n1, n2);
if(perturbanceRefract != INFINITY) {
direction = brakkeScattering(direction, perturbanceRefract);
}
}
}
}
if(state == reflectedState) {
numReflected++;
} else if(state == transmittedState) {
numTransmitted++;
} else {
numAbsorbed++;
}
}
return ReflectPair((double)numReflected / nSamples, (double)numTransmitted / nSamples);
//.........这里部分代码省略.........