+ SGVec3<T> getCorner(unsigned i) const
+ { return SGVec3<T>((i&1) ? _min[0] : _max[0],
+ (i&2) ? _min[1] : _max[1],
+ (i&4) ? _min[2] : _max[2]); }
+
+ template<typename S>
+ SGVec3<T> getNearestCorner(const SGVec3<S>& pt) const
+ {
+ SGVec3<T> center = getCenter();
+ return SGVec3<T>((pt[0] <= center[0]) ? _min[0] : _max[0],
+ (pt[1] <= center[1]) ? _min[1] : _max[1],
+ (pt[2] <= center[2]) ? _min[2] : _max[2]);
+ }
+ template<typename S>
+ SGVec3<T> getFarestCorner(const SGVec3<S>& pt) const
+ {
+ SGVec3<T> center = getCenter();
+ return SGVec3<T>((pt[0] > center[0]) ? _min[0] : _max[0],
+ (pt[1] > center[1]) ? _min[1] : _max[1],
+ (pt[2] > center[2]) ? _min[2] : _max[2]);
+ }
+
+