Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove problematic loops from TestNonLinearOptimizationObjectPoint
Summary: A few tests in this class follow a similar pattern: 1. Generate random ground truth object points. 2. Create two or more camera poses that can see all the ground truth points. 3. For each ground truth object point, create an imperfect one by randomly perturbing it. 4. If an imperfect point is not visible by one of the poses, discard it and create a new random perturbation of the ground truth. Since there is no theoretical bound to the number of tries it can take to successfully generate an imperfect point, this approach means that it's possible to run out of time or random tries before completing even one iteration. This would either result in hitting `ocean_assert(iterations != 0u)` or (if not a debug build), a skipped test reporting as succeeded. This change modifies these tests to guarantee that at least one iteration will complete. This is accomplished by changing the procedure as follows: 1. Generate random ground truth object points 2. For each ground truth object point, create an imperfect one by randomly perturbing it. 3. Create two or more camera poses that can see all object points, both ground truth and imperfect. By including the imperfect points in the bounding volume ahead of time, we remove the need to regenerate them. Since the random perturbations are small, the change to the bounding volume should be minimal in all cases except possibly the corner cases that were causing the timeouts. Reviewed By: enpe Differential Revision: D64914443 Privacy Context Container: L1191897 fbshipit-source-id: 754344b0dd16f36f1f0a9b987bf306bc273bfa92
- Loading branch information