1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 //    names, trademarks, service marks, or product names of the Licensor
11 //    and its affiliates, except as required to comply with Section 4(c) of
12 //    the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 //     http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 // This file is generated by a script.  Do not edit directly.  Edit the
26 // wrapRange.template.cpp file to make changes.
27 
28 #include "pxr/pxr.h"
29 #include "pxr/base/gf/range3f.h"
30 #include "pxr/base/gf/range3d.h"
31 
32 #include "pxr/base/tf/pyUtils.h"
33 #include "pxr/base/tf/wrapTypeHelpers.h"
34 #include "pxr/base/tf/pyContainerConversions.h"
35 
36 #include <boost/python/class.hpp>
37 #include <boost/python/copy_const_reference.hpp>
38 #include <boost/python/operators.hpp>
39 #include <boost/python/return_arg.hpp>
40 
41 #include <string>
42 
43 using namespace boost::python;
44 
45 using std::string;
46 
47 PXR_NAMESPACE_USING_DIRECTIVE
48 
49 namespace {
50 
51 static const int _dimension = 3;
52 
_Repr(GfRange3f const & self)53 static string _Repr(GfRange3f const &self) {
54     return TF_PY_REPR_PREFIX + "Range3f(" +
55         TfPyRepr(self.GetMin()) + ", " + TfPyRepr(self.GetMax()) + ")";
56 }
57 
58 #if PY_MAJOR_VERSION == 2
__truediv__(const GfRange3f & self,double value)59 static GfRange3f __truediv__(const GfRange3f &self, double value)
60 {
61     return self / value;
62 }
63 
__itruediv__(GfRange3f & self,double value)64 static GfRange3f __itruediv__(GfRange3f &self, double value)
65 {
66     return self /= value;
67 }
68 #endif
69 
__hash__(GfRange3f const & r)70 static size_t __hash__(GfRange3f const &r) { return hash_value(r); }
71 
72 } // anonymous namespace
73 
wrapRange3f()74 void wrapRange3f()
75 {
76     object getMin = make_function(&GfRange3f::GetMin,
77                                   return_value_policy<return_by_value>());
78 
79     object getMax = make_function(&GfRange3f::GetMax,
80                                   return_value_policy<return_by_value>());
81 
82     class_<GfRange3f>("Range3f", init<>())
83         .def(init<GfRange3f>())
84         .def(init<const GfVec3f &, const GfVec3f &>())
85 
86         .def(TfTypePythonClass())
87 
88         .def_readonly("dimension", _dimension)
89 
90         .add_property("min", getMin, &GfRange3f::SetMin)
91         .add_property("max", getMax, &GfRange3f::SetMax)
92 
93         .def("GetMin", getMin)
94         .def("GetMax", getMax)
95 
96         .def("GetSize", &GfRange3f::GetSize)
97         .def("GetMidpoint", &GfRange3f::GetMidpoint)
98 
99         .def("SetMin", &GfRange3f::SetMin)
100         .def("SetMax", &GfRange3f::SetMax)
101 
102         .def("IsEmpty", &GfRange3f::IsEmpty)
103 
104         .def("SetEmpty", &GfRange3f::SetEmpty)
105 
106         .def("Contains", (bool (GfRange3f::*)(const GfVec3f &) const)
107              &GfRange3f::Contains)
108         .def("Contains", (bool (GfRange3f::*)(const GfRange3f &) const)
109              &GfRange3f::Contains)
110 
111         .def("GetUnion", &GfRange3f::GetUnion)
112         .staticmethod("GetUnion")
113 
114         .def("UnionWith", (const GfRange3f & (GfRange3f::*)(const GfVec3f &))
115              &GfRange3f::UnionWith, return_self<>())
116         .def("UnionWith", (const GfRange3f & (GfRange3f::*)(const GfRange3f &))
117              &GfRange3f::UnionWith, return_self<>())
118 
119         .def("GetIntersection", &GfRange3f::GetIntersection)
120         .staticmethod("GetIntersection")
121 
122         .def("IntersectWith", (const GfRange3f & (GfRange3f::*)(const GfRange3f &))
123              &GfRange3f::IntersectWith, return_self<>())
124 
125         .def("GetDistanceSquared", &GfRange3f::GetDistanceSquared)
126 
127         .def(str(self))
128         .def(self += self)
129         .def(self -= self)
130         .def(self *= double())
131         .def(self /= double())
132         .def(self + self)
133         .def(self - self)
134         .def(double() * self)
135         .def(self * double())
136         .def(self / double())
137         .def(self == GfRange3d())
138         .def(self != GfRange3d())
139         .def(self == self)
140         .def(self != self)
141 
142 #if PY_MAJOR_VERSION == 2
143         // Needed only to support "from __future__ import division" in
144         // python 2. In python 3 builds boost::python adds this for us.
145         .def("__truediv__", __truediv__ )
146         .def("__itruediv__", __itruediv__ )
147 #endif
148 
149         .def("__repr__", _Repr)
150         .def("__hash__", __hash__)
151 
152         .def("GetCorner", &GfRange3f::GetCorner)
153         .def("GetOctant", &GfRange3f::GetOctant)
154         .def_readonly("unitCube", &GfRange3f::UnitCube)
155 
156         ;
157     to_python_converter<std::vector<GfRange3f>,
158         TfPySequenceToPython<std::vector<GfRange3f> > >();
159 
160 }
161