sphere: check radius is positive at construction
This commit is contained in:
parent
3decd9e0ab
commit
ed38fd0491
10
sphere.cpp
10
sphere.cpp
@ -19,4 +19,14 @@
|
|||||||
using util::sphere;
|
using util::sphere;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
template <size_t S, typename T>
|
||||||
|
sphere<S,T>::sphere (point<S,T> _centre, T _radius):
|
||||||
|
centre (_centre),
|
||||||
|
radius (_radius)
|
||||||
|
{
|
||||||
|
CHECK_GE (_radius, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
template struct util::sphere<2,float>;
|
||||||
template struct util::sphere<3,float>;
|
template struct util::sphere<3,float>;
|
||||||
|
@ -22,10 +22,13 @@
|
|||||||
namespace util {
|
namespace util {
|
||||||
template <size_t S, typename T>
|
template <size_t S, typename T>
|
||||||
struct sphere {
|
struct sphere {
|
||||||
|
sphere (point<S,T> centre, T radius);
|
||||||
|
|
||||||
point<S,T> centre;
|
point<S,T> centre;
|
||||||
T radius;
|
T radius;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef sphere<2,float> sphere2f;
|
||||||
typedef sphere<3,float> sphere3f;
|
typedef sphere<3,float> sphere3f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user