25 const double trace = (double)(tfm[0][0] + tfm[1][1] + tfm[2][2]);
29 double s =
sqrt(trace + 1.0);
34 qt.
x = (
float)((
double)(tfm[2][1] - tfm[1][2]) * s);
35 qt.
y = (
float)((
double)(tfm[0][2] - tfm[2][0]) * s);
36 qt.
z = (
float)((
double)(tfm[1][0] - tfm[0][1]) * s);
41 if (tfm[1][1] > tfm[i][i]) {
44 if (tfm[2][2] > tfm[i][i]) {
48 const int j = (i + 1) % 3;
49 const int k = (j + 1) % 3;
51 double s =
sqrt((
double)(tfm[i][i] - (tfm[j][j] + tfm[k][k])) + 1.0);
59 const double w = (double)(tfm[k][j] - tfm[j][k]) * s;
60 q[j] = (double)(tfm[j][i] + tfm[i][j]) * s;
61 q[k] = (double)(tfm[k][i] + tfm[i][k]) * s;
92 for (
int i = 0; i < 3; i++) {
93 for (
int j = 0; j < 4; j++) {
94 Rnext[i][j] = 0.5f * (
R[i][j] + Rit[i][j]);
99 for (
int i = 0; i < 3; i++) {
101 fabsf(
R[i][0] - Rnext[i][0]) +
fabsf(
R[i][1] - Rnext[i][1]) +
102 fabsf(
R[i][2] - Rnext[i][2]));
107 }
while (iteration < 100 && norm > 1e-4f);
130 shear.
z =
dot(colx, coly);
131 coly -= shear.
z * colx;
134 shear.
y =
dot(colx, colz);
135 colz -= shear.
y * colx;
136 shear.
x =
dot(coly, colz);
137 colz -= shear.
x * coly;
163 for (
size_t i = 0; i <
size; i++) {
169 if (
dot(decomp[i - 1].
x, decomp[i].
x) < 0.0f) {
170 decomp[i].
x = -decomp[i].
x;
182 for (
size_t i = 0; i <
size; i++) {
189 decomp[i].
x = decomp[i - 1].
x;
191 else if (i <
size - 1) {
192 decomp[i].
x = decomp[i + 1].
x;
200 1.0f / (viewplane.
top - viewplane.
bottom),
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
ccl_device_inline Transform projection_to_transform(const ProjectionTransform &a)
ccl_device_inline ProjectionTransform projection_transpose(const ProjectionTransform a)
#define CCL_NAMESPACE_END
float dot(VecOp< float, D >, VecOp< float, D >) RET
float3x3 scale(float3x3 mat, float2 scale)
float safe_divide(float a, float b)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float