-
Notifications
You must be signed in to change notification settings - Fork 31
/
ConvexSurfaceState.cc
46 lines (42 loc) · 1.67 KB
/
ConvexSurfaceState.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//----------------------------------*-C++-*----------------------------------//
// Copyright 2024 UT-Battelle, LLC, and other Celeritas developers.
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file orange/orangeinp/detail/ConvexSurfaceState.cc
//---------------------------------------------------------------------------//
#include "ConvexSurfaceState.hh"
#include "orange/transform/VariantTransform.hh"
namespace celeritas
{
namespace orangeinp
{
namespace detail
{
//---------------------------------------------------------------------------//
/*!
* Use the local and global bounding zones to create a better zone.
*
* This requires that the local and global zones have been set, and the
* transform be present.
*/
BoundingZone calc_merged_bzone(ConvexSurfaceState const& css)
{
CELER_EXPECT(css.transform);
CELER_EXPECT(
(!css.local_bzone.exterior && !css.local_bzone.interior)
|| encloses(css.local_bzone.exterior, css.local_bzone.interior));
CELER_EXPECT(!css.local_bzone.negated);
CELER_EXPECT(!css.global_bzone.negated);
BoundingZone transformed_local;
transformed_local.interior
= apply_transform(*css.transform, css.local_bzone.interior);
transformed_local.exterior
= apply_transform(*css.transform, css.local_bzone.exterior);
transformed_local.negated = false;
return calc_intersection(transformed_local, css.global_bzone);
}
//---------------------------------------------------------------------------//
} // namespace detail
} // namespace orangeinp
} // namespace celeritas