add valid() method to box2d, and comment subtraction override as it does not have any function currently

This commit is contained in:
Dane Springmeyer 2011-04-04 03:50:09 +00:00
parent a73bb9d2cd
commit 2d1e2ef998
3 changed files with 15 additions and 3 deletions

View file

@ -246,7 +246,7 @@ void export_envelope()
)
.def(self == self) // __eq__
.def(self + self) // __add__
.def(self - self) // __sub__
//.def(self - self) // __sub__
.def(self * float()) // __mult__
.def(float() * self)
.def(self / float()) // __div__

View file

@ -80,6 +80,7 @@ public:
void re_center(const coord<T,2>& c);
void init(T x0,T y0,T x1,T y1);
bool from_string(const std::string& s);
bool valid() const;
// define some operators
box2d_type& operator+=(box2d_type const& other);

View file

@ -348,20 +348,31 @@ bool box2d<T>::from_string(const std::string& s)
return success;
}
template <typename T>
#if !defined(__SUNPRO_CC)
inline
#endif
bool box2d<T>::valid() const
{
return (minx_ <= maxx_ && miny_ <= maxy_) ;
}
template <typename T>
box2d<T>& box2d<T>::operator+=(box2d<T> const& other)
{
expand_to_include(other);
return *this;
}
/*
template <typename T>
box2d<T>& box2d<T>::operator-=(box2d<T> const& other)
{
// not sure what to do here. intersect?
return *this;
}
*/
template <typename T>
box2d<T>& box2d<T>::operator*=(T t)