Blender  V2.93
util_transform_test.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2020 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "testing/testing.h"
18 
19 #include "util/util_transform.h"
20 #include "util/util_vector.h"
21 
23 
25 {
26  // Simple case: single degenerated matrix.
27  {
28  vector<Transform> motion = {transform_scale(0.0f, 0.0f, 0.0f)};
29  vector<DecomposedTransform> decomp(motion.size());
30  transform_motion_decompose(decomp.data(), motion.data(), motion.size());
31  EXPECT_TRUE(transform_decomposed_isfinite_safe(&decomp[0]));
32  }
33 
34  // Copy from previous to current.
35  {
37  transform_scale(0.0f, 0.0f, 0.0f)};
38  vector<DecomposedTransform> decomp(motion.size());
39  transform_motion_decompose(decomp.data(), motion.data(), motion.size());
40  EXPECT_NEAR(len(decomp[1].x - decomp[0].x), 0.0f, 1e-6f);
41  }
42 
43  // Copy from next to current.
44  {
45  vector<Transform> motion = {transform_scale(0.0f, 0.0f, 0.0f),
47  vector<DecomposedTransform> decomp(motion.size());
48  transform_motion_decompose(decomp.data(), motion.data(), motion.size());
49  EXPECT_NEAR(len(decomp[0].x - decomp[1].x), 0.0f, 1e-6f);
50  }
51 }
52 
#define CCL_NAMESPACE_END
#define M_PI_4_F
Definition: util_math.h:49
ccl_device_inline float3 one_float3()
void transform_motion_decompose(DecomposedTransform *decomp, const Transform *motion, size_t size)
ccl_device_inline Transform transform_rotate(float angle, float3 axis)
ccl_device_inline Transform transform_scale(float3 s)
ccl_device_inline bool transform_decomposed_isfinite_safe(DecomposedTransform *decomp)
CCL_NAMESPACE_BEGIN TEST(transform_motion_decompose, Degenerated)
uint len