Blender
V2.93
intern
cycles
test
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
22
CCL_NAMESPACE_BEGIN
23
24
TEST
(
transform_motion_decompose
, Degenerated)
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
{
36
vector<Transform>
motion = {
transform_rotate
(
M_PI_4_F
,
one_float3
()),
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),
46
transform_rotate
(
M_PI_4_F
,
one_float3
())};
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
53
CCL_NAMESPACE_END
x
x
Definition:
BLI_expr_pylike_eval_test.cc:342
vector
Definition:
util_vector.h:36
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition:
kernel_compat_cuda.h:23
CCL_NAMESPACE_BEGIN
Definition:
blender_python.cpp:54
M_PI_4_F
#define M_PI_4_F
Definition:
util_math.h:49
one_float3
ccl_device_inline float3 one_float3()
Definition:
util_math_float3.h:103
transform_motion_decompose
void transform_motion_decompose(DecomposedTransform *decomp, const Transform *motion, size_t size)
Definition:
util_transform.cpp:301
util_transform.h
transform_rotate
ccl_device_inline Transform transform_rotate(float angle, float3 axis)
Definition:
util_transform.h:238
transform_scale
ccl_device_inline Transform transform_scale(float3 s)
Definition:
util_transform.h:228
transform_decomposed_isfinite_safe
ccl_device_inline bool transform_decomposed_isfinite_safe(DecomposedTransform *decomp)
Definition:
util_transform.h:480
TEST
CCL_NAMESPACE_BEGIN TEST(transform_motion_decompose, Degenerated)
Definition:
util_transform_test.cpp:24
util_vector.h
len
uint len
Definition:
uvedit_unwrap_ops.c:1146
Generated on Tue Jan 31 2023 14:37:24 for Blender by
doxygen
1.9.1