Blender
V5.0
intern
cycles
test
util_boundbox_test.cpp
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2011-2025 Blender Foundation
2
*
3
* SPDX-License-Identifier: Apache-2.0 */
4
5
#include <gtest/gtest.h>
6
7
#include "
util/boundbox.h
"
8
#include "
util/transform.h
"
9
10
CCL_NAMESPACE_BEGIN
11
12
TEST
(
BoundBox
, transformed)
13
{
14
{
15
const
Transform
tfm =
transform_translate
(
make_float3
(1, 2, 3));
16
const
BoundBox
orig_bounds(
make_float3
(-2, -3, -4),
make_float3
(3, 4, 5));
17
const
BoundBox
transformed_bounds = orig_bounds.
transformed
(&tfm);
18
EXPECT_LE(
len
(transformed_bounds.
min
-
make_float3
(-1, -1, -1)), 1e-6f);
19
EXPECT_LE(
len
(transformed_bounds.
max
-
make_float3
(4, 6, 8)), 1e-6f);
20
}
21
22
/* Non-valid boundbox should result in non-valid after transform. */
23
{
24
const
Transform
tfm =
transform_scale
(
make_float3
(1, 1, 1));
25
EXPECT_FALSE(
BoundBox
(
BoundBox::empty
).transformed(&tfm).valid());
26
}
27
}
28
29
CCL_NAMESPACE_END
BoundBox
struct BoundBox BoundBox
boundbox.h
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition
device/cuda/compat.h:10
make_float3
ccl_device_forceinline float3 make_float3(const float x, const float y, const float z)
Definition
device/metal/compat.h:204
CCL_NAMESPACE_BEGIN
Definition
python.cpp:37
BoundBox
Definition
DNA_object_types.h:101
BoundBox::transformed
BoundBox transformed(const Transform *tfm) const
Definition
boundbox.h:134
BoundBox::empty
@ empty
Definition
boundbox.h:28
BoundBox::max
float3 max
Definition
boundbox.h:20
BoundBox::min
float3 min
Definition
boundbox.h:20
Transform
Definition
transform.h:22
transform.h
transform_scale
ccl_device_inline Transform transform_scale(const float3 s)
Definition
transform.h:280
transform_translate
ccl_device_inline Transform transform_translate(const float3 t)
Definition
transform.h:270
TEST
CCL_NAMESPACE_BEGIN TEST(BoundBox, transformed)
Definition
util_boundbox_test.cpp:12
len
uint len
Definition
uvedit_unwrap_ops.cc:2126
Generated on
for Blender by
doxygen
1.16.1