From cc51208545c3941fcfdb078ad0c70c7fd607614e Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 21 May 2013 16:35:40 +0300 Subject: [PATCH] Verify that parameters make sense --- source/geometry/hyperbox.h | 7 ++++++- source/geometry/hypersphere.h | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) 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 -- 2.45.2