Skip to content

Commit

Permalink
[camera] add epsilon in comparison test
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiencastan committed Aug 17, 2021
1 parent f914279 commit c1e1a87
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/aliceVision/camera/IntrinsicBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,30 @@ class IntrinsicBase
*/
inline bool operator==(const IntrinsicBase& other) const
{
if(getParams().size() != other.getParams().size())
{
return false;
}
for(int i = 0; i < getParams().size(); i++)
{
const double diff = getParams()[i] - other.getParams()[i];
if(std::abs(diff) > 1e-8)
{
return false;
}
}
return _w == other._w &&
_h == other._h &&
_sensorWidth == other._sensorWidth &&
_sensorHeight == other._sensorHeight &&
_serialNumber == other._serialNumber &&
_initializationMode == other._initializationMode &&
getType() == other.getType() &&
getParams() == other.getParams();
getType() == other.getType();
}

inline bool operator!=(const IntrinsicBase& other) const
{
return !(*this == other);
}

/**
Expand Down

0 comments on commit c1e1a87

Please sign in to comment.