Skip to content

Commit d46cfed

Browse files
committed
Added more refractive index calculation methods
1 parent 2466452 commit d46cfed

2 files changed

Lines changed: 68 additions & 2 deletions

File tree

examples/complex.prc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@
77
; Settings
88
(integrator
99
:type 'DIRECT'
10-
:max_ray_depth 32
10+
:max_ray_depth 24
1111
:light_sampe_count 1
1212
:msi true
1313
)
1414
(sampler
1515
:slot 'aa'
1616
:type 'SOBOL'
17-
:sample_count 32
17+
:sample_count 8
18+
)
19+
(sampler
20+
:slot 'spectral'
21+
:type 'RANDOM'
22+
:sample_count 4
1823
)
1924
(filter
2025
:slot 'pixel'

src/base/math/Reflection.h

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,35 @@ inline Vector3f halfway(const Vector3f& V, const Vector3f& L)
118118
return (L - V).normalized();
119119
}
120120

121+
/**
122+
* @brief Returns the refractive index based on the simple cauchy equation
123+
* @param lambda_nm Wavelength in nano meters
124+
* @param A A base coefficient
125+
* @param B B coefficient given in squared micro meters
126+
* @return Refractive index
127+
*/
128+
inline float cauchy(float lambda_nm, float A, float B)
129+
{
130+
const float lambda_qm = lambda_nm / 1000;
131+
const float lambda_qm2 = lambda_qm * lambda_qm;
132+
return A + B / lambda_qm2;
133+
}
134+
135+
/**
136+
* @brief Returns the refractive index based on the basic cauchy equation
137+
* @param lambda_nm Wavelength in nano meters
138+
* @param A A base coefficient
139+
* @param B B coefficient given in squared micro meters
140+
* @param C C coefficient given in quadrupled micro meters
141+
* @return Refractive index
142+
*/
143+
inline float cauchy(float lambda_nm, float A, float B, float C)
144+
{
145+
const float lambda_qm = lambda_nm / 1000;
146+
const float lambda_qm2 = lambda_qm * lambda_qm;
147+
return A + B / lambda_qm2 + C / (lambda_qm2 * lambda_qm2);
148+
}
149+
121150
/**
122151
* @brief Returns the (squared) refractive index based on the sellmeier equation
123152
* @param lambda_nm Wavelength in nano meters
@@ -154,5 +183,37 @@ inline float sellmeier(float lambda_nm, float B1, float B2, float B3, float C1,
154183
{
155184
return std::sqrt(sellmeier2(lambda_nm, B1, B2, B3, C1, C2, C3));
156185
}
186+
187+
/**
188+
* @brief Returns the (squared) refractive index based on the polynom equation n^2=A+B1*l^2+B2*l^4+C1/l^2+C2/l^4
189+
* @param lambda_nm Wavelength in nano meters
190+
* @param A A base coefficient
191+
* @param B1 B1 coefficient given in inverse squared micro meters
192+
* @param B2 B2 coefficient given in inverse quadrupled micro meters
193+
* @param C1 C1 coefficient given in squared micro meters
194+
* @param C2 C2 coefficient given in quadrupled micro meters
195+
* @return Squared refractive index
196+
*/
197+
inline float poly2(float lambda_nm, float A, float B1, float B2, float C1, float C2)
198+
{
199+
float lambda_qm = lambda_nm / 1000;
200+
float lambda_qm2 = lambda_qm * lambda_qm;
201+
return A + B1 * lambda_qm2 + B2 * lambda_qm2 * lambda_qm2 + C1 / lambda_qm2 + C2 / (lambda_qm2 * lambda_qm2);
202+
}
203+
204+
/**
205+
* @brief Returns the refractive index based on the polynom equation n^2=A+B1*l^2+B2*l^4+C1/l^2+C2/l^4
206+
* @param lambda_nm Wavelength in nano meters
207+
* @param A A base coefficient
208+
* @param B1 B1 coefficient given in inverse squared micro meters
209+
* @param B2 B2 coefficient given in inverse quadrupled micro meters
210+
* @param C1 C1 coefficient given in squared micro meters
211+
* @param C2 C2 coefficient given in quadrupled micro meters
212+
* @return Refractive index
213+
*/
214+
inline float poly(float lambda_nm, float A, float B1, float B2, float C1, float C2)
215+
{
216+
return std::sqrt(poly2(lambda_nm, A, B1, B2, C1, C2));
217+
}
157218
} // namespace Reflection
158219
} // namespace PR

0 commit comments

Comments
 (0)