Add helper function to add Dimensions
This commit is contained in:
@@ -26,3 +26,17 @@ Dimension maxdim(const Dimension &d1, const Dimension &d2)
|
|||||||
d.height = max(d1.height, d2.height);
|
d.height = max(d1.height, d2.height);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute sum of both dimensions.
|
||||||
|
* @param d1 First dimension.
|
||||||
|
* @param d2 Second dimension.
|
||||||
|
* @return The sum of both dimensions.
|
||||||
|
*/
|
||||||
|
Dimension adddim(const Dimension &d1, const Dimension &d2)
|
||||||
|
{
|
||||||
|
Dimension d;
|
||||||
|
d.width = d1.width + d2.width;
|
||||||
|
d.height = d1.height + d2.height;
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
@@ -13,5 +13,6 @@
|
|||||||
#include "geometry_type.hpp"
|
#include "geometry_type.hpp"
|
||||||
|
|
||||||
Dimension maxdim(const Dimension &d1, const Dimension &d2);
|
Dimension maxdim(const Dimension &d1, const Dimension &d2);
|
||||||
|
Dimension adddim(const Dimension &d1, const Dimension &d2);
|
||||||
|
|
||||||
#endif /* GEOMETRY_FUNC_HPP */
|
#endif /* GEOMETRY_FUNC_HPP */
|
||||||
|
Reference in New Issue
Block a user