Cortex  10.0.0-a4
BoxOps.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2008-2011, Image Engine Design Inc. All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // * Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // * Neither the name of Image Engine Design nor the names of any
17 // other contributors to this software may be used to endorse or
18 // promote products derived from this software without specific prior
19 // written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 //
34 
43 
44 #ifndef IE_CORE_BOXOPS_H
45 #define IE_CORE_BOXOPS_H
46 
47 #include "IECore/BoxTraits.h"
48 #include "IECore/VectorTraits.h"
49 
50 namespace IECore
51 {
52 
54 template<typename T>
55 inline typename BoxTraits<T>::BaseType boxSize( const T &box );
56 
58 template<typename T>
59 inline typename BoxTraits<T>::BaseType boxCenter( const T &box );
60 
62 template<typename T>
63 inline void boxExtend( T &box, const typename BoxTraits<T>::BaseType &p );
64 
66 template<typename T>
67 inline void boxExtend( T &box, const T &box2 );
68 
70 template <typename T>
71 T boxIntersection( const T &box, const T &box2 );
72 
74 template <typename T>
75 bool boxIntersects( const T &box, const typename BoxTraits<T>::BaseType &p );
76 
78 template <typename T>
79 bool boxIntersects( const T &box, const T &box2 );
80 
82 template <typename T>
83 bool boxContains( const T &box, const T &containee );
84 
87 template<typename T>
88 bool boxIntersects(
89  const T &box,
90  const typename BoxTraits<T>::BaseType &origin,
91  const typename BoxTraits<T>::BaseType &direction,
92  typename BoxTraits<T>::BaseType &result
93 );
94 
96 template<typename T>
97 void boxSplit( const T &box, T &low, T &high, int axis );
98 
100 template<typename T>
101 void boxSplit( const T &box, T &low, T &high );
102 
104 template<typename T>
105 int boxMajorAxis( const T &box );
106 
107 } // namespace IECore
108 
109 #include "IECore/BoxOps.inl"
110 
111 #endif // IE_CORE_BOXOPS_H
int boxMajorAxis(const T &box)
Returns the longest axis of the box.
void boxSplit(const T &box, T &low, T &high, int axis)
Splits the box into two across the specified axis.
void boxExtend(T &box, const typename BoxTraits< T >::BaseType &p)
Extends the box by the given point.
bool boxContains(const T &box, const T &containee)
Returns true if box contains containee.
BoxTraits< T >::BaseType boxSize(const T &box)
Returns a vector representing the length of each side of the box.
T boxIntersection(const T &box, const T &box2)
Returns the intersection between two boxes, or the empty box if there is no intersection.
bool boxIntersects(const T &box, const typename BoxTraits< T >::BaseType &p)
Returns true if the box intersects (contains) the given point.
This namespace contains all components of the core library.
Definition: AddSmoothSkinningInfluencesOp.h:43
BoxTraits< T >::BaseType boxCenter(const T &box)
Returns the center point of the box.