本文整理汇总了C++中Dual2::dx方法的典型用法代码示例。如果您正苦于以下问题:C++ Dual2::dx方法的具体用法?C++ Dual2::dx怎么用?C++ Dual2::dx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dual2
的用法示例。
在下文中一共展示了Dual2::dx方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: M_scr_tan
// set up the filter matrix
static void
gabor_setup_filter (const Dual2<Vec3> &P, GaborParams &gp)
{
// Make texture-space normal, tangent, bitangent
Vec3 n, t, b;
n = P.dx().cross (P.dy()); // normal to P
if (n.dot(n) < 1.0e-6f) { /* length of deriv < 1/1000 */
// No way to do filter if we have no derivs, and no reason to
// do it if it's too small to have any effect.
gp.do_filter = false;
return; // we won't need anything else if filtering is off
}
make_orthonormals (n, t, b);
// Rotations from tangent<->texture space
Matrix33 Mtex_to_tan = make_matrix33_cols (t, b, n); // M3_local
Matrix33 Mscreen_to_tex = make_matrix33_cols (P.dx(), P.dy(), Vec3(0.0f,0.0f,0.0f));
Matrix33 Mscreen_to_tan = Mscreen_to_tex * Mtex_to_tan; // M3_scr_tan
Matrix22 M_scr_tan (Mscreen_to_tan[0][0], Mscreen_to_tan[0][1],
Mscreen_to_tan[1][0], Mscreen_to_tan[1][1]);
float sigma_f_scr = 0.5f;
Matrix22 Sigma_f_scr (sigma_f_scr * sigma_f_scr, 0.0f,
0.0f, sigma_f_scr * sigma_f_scr);
Matrix22 M_scr_tan_t = M_scr_tan.transposed();
Matrix22 Sigma_f_tan = M_scr_tan_t * Sigma_f_scr * M_scr_tan;
gp.N = n;
gp.filter = Sigma_f_tan;
gp.det_filter = determinant(Sigma_f_tan);
gp.local = Mtex_to_tan;
if (gp.det_filter < 1.0e-18f) {
gp.do_filter = false;
// Turn off filtering when tiny values will lead to numerical
// errors later if we filter. Yes, it's kind of arbitrary.
}
}
示例2:
inline Dual2<float> safe_fmod (const Dual2<float> &a, const Dual2<float> &b) {
return Dual2<float> (safe_fmod (a.val(), b.val()), a.dx(), a.dy());
}