added some sanity checks
This commit is contained in:
@@ -339,6 +339,13 @@ namespace Ray3D {
|
||||
|
||||
const std::string& name = foo->file;
|
||||
Obstacle3D obs = OBJPool::get().getObject(name);
|
||||
|
||||
// perform sanity checks
|
||||
if (!obs.isValid()) {
|
||||
throw std::runtime_error("invalid obstacle-data detected");
|
||||
}
|
||||
|
||||
// apply scaling/rotation/translation
|
||||
obs = obs.scaled(foo->scale);
|
||||
obs = obs.rotated_deg( Point3(foo->rot.x, foo->rot.y, foo->rot.z) );
|
||||
obs = obs.translated(foo->pos + Point3(0,0,fpos.z1));
|
||||
|
||||
@@ -89,6 +89,14 @@ namespace Ray3D {
|
||||
return res;
|
||||
}
|
||||
|
||||
/** perform sanity checks */
|
||||
bool isValid() const {
|
||||
for (const Triangle3& t : triangles) {
|
||||
if (!t.isValid()) {return false;}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user