From: Mikko Rasa Date: Tue, 21 May 2013 13:35:40 +0000 (+0300) Subject: Verify that parameters make sense X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=cc51208545c3941fcfdb078ad0c70c7fd607614e;p=libs%2Fmath.git Verify that parameters make sense --- diff --git a/source/geometry/hyperbox.h b/source/geometry/hyperbox.h index 865b968..0e4efd8 100644 --- a/source/geometry/hyperbox.h +++ b/source/geometry/hyperbox.h @@ -3,6 +3,7 @@ #include #include +#include #include #include "ray.h" #include "shape.h" @@ -47,7 +48,11 @@ inline HyperBox::HyperBox() template inline HyperBox::HyperBox(const LinAl::Vector &d): dimensions(d) -{ } +{ + for(unsigned i=0; i inline HyperBox *HyperBox::clone() const diff --git a/source/geometry/hypersphere.h b/source/geometry/hypersphere.h index 01aee0e..de028fa 100644 --- a/source/geometry/hypersphere.h +++ b/source/geometry/hypersphere.h @@ -2,6 +2,7 @@ #define MSP_GEOMETRY_HYPERSPHERE_H_ #include +#include #include #include "hyperbox.h" #include "ray.h" @@ -44,7 +45,10 @@ inline HyperSphere::HyperSphere(): template inline HyperSphere::HyperSphere(T r): radius(r) -{ } +{ + if(r<=T(0)) + throw std::invalid_argument("HyperSphere::HyperShpere"); +} template inline HyperSphere *HyperSphere::clone() const