FIX: handle exception of dividing by zero in arranging
jira: none Change-Id: I0d20464dbe81a80293539100f06d72dee456a27b (cherry picked from commit 94746ae9bf7f467243849570450567b4fdc78e3a)
This commit is contained in:
parent
932218e389
commit
96e2147394
|
@ -927,8 +927,15 @@ template<class Bin> void remove_large_items(std::vector<Item> &items, Bin &&bin)
|
||||||
|
|
||||||
template<class S> Radians min_area_boundingbox_rotation(const S &sh)
|
template<class S> Radians min_area_boundingbox_rotation(const S &sh)
|
||||||
{
|
{
|
||||||
return minAreaBoundingBox<S, TCompute<S>, boost::rational<LargeInt>>(sh)
|
try {
|
||||||
.angleToX();
|
return minAreaBoundingBox<S, TCompute<S>, boost::rational<LargeInt>>(sh)
|
||||||
|
.angleToX();
|
||||||
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
|
// min_area_boundingbox_rotation may throw exception of dividing 0 if the object is already perfectly aligned to X
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "arranging min_area_boundingbox_rotation fails, msg=" << e.what();
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class S>
|
template<class S>
|
||||||
|
|
Loading…
Reference in New Issue