add valid() method to box2d, and comment subtraction override as it does not have any function currently
This commit is contained in:
parent
a73bb9d2cd
commit
2d1e2ef998
3 changed files with 15 additions and 3 deletions
|
@ -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__
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue