OpenVDB
0.104.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
tree
tree/Util.h
Go to the documentation of this file.
1
2
//
3
// Copyright (c) 2012 DreamWorks Animation LLC
4
//
5
// All rights reserved. This software is distributed under the
6
// Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
7
//
8
// Redistributions of source code must retain the above copyright
9
// and license notice and the following restrictions and disclaimer.
10
//
11
// * Neither the name of DreamWorks Animation nor the names of
12
// its contributors may be used to endorse or promote products derived
13
// from this software without specific prior written permission.
14
//
15
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
20
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
// IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
27
// LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
28
//
30
//
32
33
#ifndef OPENVDB_TREE_UTIL_HAS_BEEN_INCLUDED
34
#define OPENVDB_TREE_UTIL_HAS_BEEN_INCLUDED
35
36
namespace
openvdb {
37
OPENVDB_USE_VERSION_NAMESPACE
38
namespace
OPENVDB_VERSION_NAME
{
39
namespace
tree {
40
44
template
<
typename
ValueType>
45
struct
TolerancePrune
{
46
TolerancePrune
(
const
ValueType &tol) : tolerance(tol) {}
47
template
<
typename
ChildType>
48
bool
operator()
(ChildType &child) {
49
child.pruneOp(*
this
);
50
return
child.isConstant(value, state, tolerance);
51
}
52
bool
state
;
53
ValueType
value
;
54
const
ValueType
tolerance
;
55
};
56
61
template
<
typename
ValueType>
62
struct
InactivePrune
{
63
InactivePrune
(
const
ValueType &val) : value(val) {}
64
template
<
typename
ChildType>
65
bool
operator()
(ChildType &child)
const
{
66
child.pruneOp(*
this
);
67
return
child.isInactive();
68
}
69
static
const
bool
state =
false
;
70
const
ValueType
value
;
71
};
72
80
template
<
typename
ValueType>
81
struct
LevelSetPrune
{
82
template
<
typename
ChildType>
83
bool
operator()
(ChildType &child) {
84
child.pruneOp(*
this
);
85
if
(!child.isInactive())
return
false
;
86
value = child.getFirstValue();
87
return
true
;
88
}
89
static
const
bool
state =
false
;
90
ValueType
value
;
91
};
92
93
}
// namespace tree
94
}
// namespace OPENVDB_VERSION_NAME
95
}
// namespace openvdb
96
97
#endif // OPENVDB_TREE_TREE_HAS_BEEN_INCLUDED
98
99
// Copyright (c) 2012 DreamWorks Animation LLC
100
// All rights reserved. This software is distributed under the
101
// Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
Generated on Fri Mar 8 2013 19:17:33 for OpenVDB by
1.8.3.1