Throws CheiralityException is flag GTSAM_THROW_CHEIRALITY_EXCEPTION is set to true (default behaviour)

release/4.3a0
Pablo Fernandez Alcantarilla 2013-10-24 00:06:39 +00:00
parent b67e17e43d
commit d5a5709262
1 changed files with 8 additions and 2 deletions

View File

@ -299,8 +299,11 @@ public:
// Transform to camera coordinates and check cheirality
const Point3 pc = pose_.transform_to(pw);
#ifdef GTSAM_THROW_CHEIRALITY_EXCEPTION
if (pc.z() <= 0)
throw CheiralityException();
#endif
// Project to normalized image coordinates
const Point2 pn = project_to_camera(pc);
@ -390,8 +393,11 @@ public:
if (!Dcamera && !Dpoint) {
const Point3 pc = pose_.transform_to(pw);
if (pc.z() <= 0)
throw CheiralityException();
#ifdef GTSAM_THROW_CHEIRALITY_EXCEPTION
if (pc.z() <= 0)
throw CheiralityException();
#endif
const Point2 pn = project_to_camera(pc);
return K_.uncalibrate(pn);
}