16#include <Eigen/Eigenvalues>
30 __m128
A0 = _mm_load_ps(a[0]);
31 __m128
A1 = _mm_load_ps(a[1]);
32 __m128
A2 = _mm_load_ps(a[2]);
33 __m128 A3 = _mm_load_ps(a[3]);
35 for (
int i = 0; i < 4; i++) {
36 __m128 B0 = _mm_set1_ps(
b[i][0]);
37 __m128 B1 = _mm_set1_ps(
b[i][1]);
38 __m128 B2 = _mm_set1_ps(
b[i][2]);
39 __m128 B3 = _mm_set1_ps(
b[i][3]);
41 __m128
sum = _mm_add_ps(_mm_add_ps(_mm_mul_ps(B0,
A0), _mm_mul_ps(B1,
A1)),
42 _mm_add_ps(_mm_mul_ps(B2,
A2), _mm_mul_ps(B3, A3)));
47 result[0][0] =
b[0][0] * a[0][0] +
b[0][1] * a[1][0] +
b[0][2] * a[2][0] +
b[0][3] * a[3][0];
48 result[0][1] =
b[0][0] * a[0][1] +
b[0][1] * a[1][1] +
b[0][2] * a[2][1] +
b[0][3] * a[3][1];
49 result[0][2] =
b[0][0] * a[0][2] +
b[0][1] * a[1][2] +
b[0][2] * a[2][2] +
b[0][3] * a[3][2];
50 result[0][3] =
b[0][0] * a[0][3] +
b[0][1] * a[1][3] +
b[0][2] * a[2][3] +
b[0][3] * a[3][3];
52 result[1][0] =
b[1][0] * a[0][0] +
b[1][1] * a[1][0] +
b[1][2] * a[2][0] +
b[1][3] * a[3][0];
53 result[1][1] =
b[1][0] * a[0][1] +
b[1][1] * a[1][1] +
b[1][2] * a[2][1] +
b[1][3] * a[3][1];
54 result[1][2] =
b[1][0] * a[0][2] +
b[1][1] * a[1][2] +
b[1][2] * a[2][2] +
b[1][3] * a[3][2];
55 result[1][3] =
b[1][0] * a[0][3] +
b[1][1] * a[1][3] +
b[1][2] * a[2][3] +
b[1][3] * a[3][3];
57 result[2][0] =
b[2][0] * a[0][0] +
b[2][1] * a[1][0] +
b[2][2] * a[2][0] +
b[2][3] * a[3][0];
58 result[2][1] =
b[2][0] * a[0][1] +
b[2][1] * a[1][1] +
b[2][2] * a[2][1] +
b[2][3] * a[3][1];
59 result[2][2] =
b[2][0] * a[0][2] +
b[2][1] * a[1][2] +
b[2][2] * a[2][2] +
b[2][3] * a[3][2];
60 result[2][3] =
b[2][0] * a[0][3] +
b[2][1] * a[1][3] +
b[2][2] * a[2][3] +
b[2][3] * a[3][3];
62 result[3][0] =
b[3][0] * a[0][0] +
b[3][1] * a[1][0] +
b[3][2] * a[2][0] +
b[3][3] * a[3][0];
63 result[3][1] =
b[3][0] * a[0][1] +
b[3][1] * a[1][1] +
b[3][2] * a[2][1] +
b[3][3] * a[3][1];
64 result[3][2] =
b[3][0] * a[0][2] +
b[3][1] * a[1][2] +
b[3][2] * a[2][2] +
b[3][3] * a[3][2];
65 result[3][3] =
b[3][0] * a[0][3] +
b[3][1] * a[1][3] +
b[3][2] * a[2][3] +
b[3][3] * a[3][3];
77 __m128
A0 = _mm_set_ps(0, a[0][2], a[0][1], a[0][0]);
78 __m128
A1 = _mm_set_ps(0, a[1][2], a[1][1], a[1][0]);
79 __m128
A2 = _mm_set_ps(0, a[2][2], a[2][1], a[2][0]);
81 for (
int i = 0; i < 2; i++) {
82 __m128 B0 = _mm_set1_ps(
b[i][0]);
83 __m128 B1 = _mm_set1_ps(
b[i][1]);
84 __m128 B2 = _mm_set1_ps(
b[i][2]);
85 __m128
sum = _mm_add_ps(_mm_add_ps(_mm_mul_ps(B0,
A0), _mm_mul_ps(B1,
A1)),
93 sum[2] = _mm_shuffle_ps(
sum[2],
sum[2], _MM_SHUFFLE(3, 2, 1, 1));
95 sum[2] = _mm_shuffle_ps(
sum[2],
sum[2], _MM_SHUFFLE(3, 2, 1, 2));
100 result[0][0] =
b[0][0] * a[0][0] +
b[0][1] * a[1][0] +
b[0][2] * a[2][0];
101 result[0][1] =
b[0][0] * a[0][1] +
b[0][1] * a[1][1] +
b[0][2] * a[2][1];
102 result[0][2] =
b[0][0] * a[0][2] +
b[0][1] * a[1][2] +
b[0][2] * a[2][2];
104 result[1][0] =
b[1][0] * a[0][0] +
b[1][1] * a[1][0] +
b[1][2] * a[2][0];
105 result[1][1] =
b[1][0] * a[0][1] +
b[1][1] * a[1][1] +
b[1][2] * a[2][1];
106 result[1][2] =
b[1][0] * a[0][2] +
b[1][1] * a[1][2] +
b[1][2] * a[2][2];
108 result[2][0] =
b[2][0] * a[0][0] +
b[2][1] * a[1][0] +
b[2][2] * a[2][0];
109 result[2][1] =
b[2][0] * a[0][1] +
b[2][1] * a[1][1] +
b[2][2] * a[2][1];
110 result[2][2] =
b[2][0] * a[0][2] +
b[2][1] * a[1][2] +
b[2][2] * a[2][2];
132 return Eigen::Map<const Eigen::Matrix<T, Size, Size>>(mat.
base_ptr()).determinant();
144 return Eigen::Map<const Eigen::Matrix<T, 3, 3>, 0, Eigen::Stride<4, 1>>(mat.
base_ptr())
145 .determinant() <
T(0);
166 if (m_c != c && m_r != r) {
167 int d_c = (m_c < c) ? m_c : (m_c - 1);
168 int d_r = (m_r < r) ? m_r : (m_r - 1);
169 tmp[d_c][d_r] = mat[m_c][m_r];
175 adj[r][c] = ((c + r) & 1) ? -minor : minor;
194template<
typename T,
int Size>
198 Eigen::Map<const Eigen::Matrix<T, Size, Size>>
M(mat.
base_ptr());
199 Eigen::Map<Eigen::Matrix<T, Size, Size>>
R(
result.base_ptr());
200 M.computeInverseWithCheck(
R, r_success, 0.0f);
214template<
typename T,
int Size>
235 using namespace Eigen;
236 using MatrixT = Eigen::Matrix<T, Size, Size>;
237 using VectorT = Eigen::Matrix<T, Size, 1>;
245 using MatrixDynamicT = Eigen::Matrix<T, Dynamic, Dynamic>;
246 JacobiSVD<MatrixDynamicT, NoQRPreconditioner> svd(
247 Eigen::Map<const MatrixDynamicT>(mat.
base_ptr(), Size, Size), ComputeThinU | ComputeThinV);
249 Eigen::Map<MatrixT>(
U.base_ptr()) = svd.matrixU();
250 (Eigen::Map<VectorT>(S_val)) = svd.singularValues();
251 Eigen::Map<MatrixT>(
V.base_ptr()) = svd.matrixV();
255 unroll<Size>([&](
auto i) { S_val[i] = (S_val[i] < epsilon) ?
T(0) : (
T(1) / S_val[i]); });
296 using namespace Eigen;
297 using MatrixT = Eigen::Matrix<T, 3, 3>;
298 using VectorT = Eigen::Matrix<T, 3, 1>;
305 using MatrixDynamicT = Eigen::Matrix<T, Dynamic, Dynamic>;
306 JacobiSVD<MatrixDynamicT, NoQRPreconditioner> svd(
307 Eigen::Map<const MatrixDynamicT>(mat3.
base_ptr(), 3, 3), ComputeThinU | ComputeThinV);
309 Eigen::Map<MatrixT>(
W.base_ptr()) = svd.matrixU();
310 (Eigen::Map<VectorT>(S_val)) = svd.singularValues();
394 Vec3T a_scale, b_scale;
395 QuaternionT a_quat, b_quat;
400 const QuaternionT rotation =
interpolate(a_quat, b_quat, t);
414 Vec3T a_scale, b_scale;
415 QuaternionT a_quat, b_quat;
419 const Vec3T location =
interpolate(a_loc, b_loc, t);
421 const QuaternionT rotation =
interpolate(a_quat, b_quat, t);
451 float ha2 = 0.5f *
math::atan2(x_axis.y, x_axis.x);
465template void normalized_to_eul2(
const float3x3 &mat,
466 Euler3Base<float> &eul1,
467 Euler3Base<float> &eul2);
468template void normalized_to_eul2(
const float3x3 &mat,
469 EulerXYZBase<float> &eul1,
470 EulerXYZBase<float> &eul2);
471template void normalized_to_eul2(
const double3x3 &mat,
472 EulerXYZBase<double> &eul1,
473 EulerXYZBase<double> &eul2);
475template QuaternionBase<float> normalized_to_quat_with_checks(
const float3x3 &mat);
476template QuaternionBase<double> normalized_to_quat_with_checks(
const double3x3 &mat);
500namespace projection {
503 float left,
float right,
float bottom,
float top,
float near_clip,
float far_clip);
505 float left,
float right,
float bottom,
float top,
float near_clip,
float far_clip);
507 float left,
float right,
float bottom,
float top,
float near_clip);
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Map
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
btMatrix3x3 adjoint() const
Return the adjoint of the matrix.
btMatrix3x3 transpose() const
Return the transpose of the matrix.
btScalar determinant() const
Return the determinant of the matrix.
static T sum(const btAlignedObjectArray< T > &items)
SIMD_FORCE_INLINE btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
VecBase< float, 3 > float3
local_group_size(16, 16) .push_constant(Type b
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
MatBase< T, 4, 4 > perspective_infinite(T left, T right, T bottom, T top, T near_clip)
Create a perspective projection matrix using OpenGL coordinate convention: Maps each axis range to [-...
QuaternionBase< T > conjugate(const QuaternionBase< T > &a)
QuaternionBase< float > Quaternion
T cos(const AngleRadianBase< T > &a)
QuaternionBase< T > to_quaternion(const AxisAngleBase< T, AngleT > &axis_angle)
MatBase< T, NumCol, NumRow > scale(const MatBase< T, NumCol, NumRow > &mat, const VectorT &scale)
Quaternion to_quaternion_legacy(const float3x3 &mat)
bool is_negative(const MatBase< T, Size, Size > &mat)
MatBase< T, Size, Size > pseudo_invert(const MatBase< T, Size, Size > &mat, T epsilon=1e-8)
MatT from_scale(const VecBase< typename MatT::base_type, ScaleDim > &scale)
T interpolate(const T &a, const T &b, const FactorT &t)
T atan2(const T &y, const T &x)
MatBase< T, 3, 3 > interpolate_fast(const MatBase< T, 3, 3 > &a, const MatBase< T, 3, 3 > &b, T t)
static void polar_decompose(const MatBase< T, 3, 3 > &mat3, MatBase< T, 3, 3 > &r_U, MatBase< T, 3, 3 > &r_P)
T sin(const AngleRadianBase< T > &a)
void to_rot_scale(const MatBase< T, 2, 2 > &mat, AngleRadianBase< T > &r_rotation, VecBase< T, 2 > &r_scale)
MatBase< T, NumCol, NumRow > interpolate_linear(const MatBase< T, NumCol, NumRow > &a, const MatBase< T, NumCol, NumRow > &b, T t)
void to_loc_rot_scale(const MatBase< T, 3, 3 > &mat, VecBase< T, 2 > &r_location, AngleRadianBase< T > &r_rotation, VecBase< T, 2 > &r_scale)
MatT from_rot_scale(const RotationT &rotation, const VectorT &scale)
MatT from_rotation(const RotationT &rotation)
MatT from_loc_rot_scale(const typename MatT::loc_type &location, const RotationT &rotation, const VecBase< typename MatT::base_type, ScaleDim > &scale)
MatBase< float, 2, 2 > float2x2
MatBase< float, 4, 4 > float4x4
MatBase< double, 3, 3 > double3x3
MatBase< double, 2, 2 > double2x2
MatBase< float, 3, 3 > float3x3
VecBase< float, 3 > float3
MatBase< T, B_NumCol, A_NumRow > operator*(const MatBase< T, A_NumCol, A_NumRow > &a, const MatBase< T, B_NumCol, B_NumRow > &b)
MatBase< double, 4, 4 > double4x4
MatBase< float, 4, 4 > float4x4
MatBase< double, 4, 4 > double4x4
Frequency::GEOMETRY nor[]
VecBase< T, 3 > vec3_type
const T * base_ptr() const
MatBase< float, 2, 2 > float2x2
MatBase< float, 3, 3 > float3x3
CCL_NAMESPACE_BEGIN struct Window V