提交 fb9bbf99 编写于 作者: M Marc Rollins

Adding division operators to `Point_` class.

Performs element-wise division.
上级 48892016
......@@ -994,6 +994,30 @@ Point_<_Tp>& operator *= (Point_<_Tp>& a, double b)
return a;
}
template<typename _Tp> static inline
Point_<_Tp>& operator /= (Point_<_Tp>& a, int b)
{
a.x = saturate_cast<_Tp>(a.x / b);
a.y = saturate_cast<_Tp>(a.y / b);
return a;
}
template<typename _Tp> static inline
Point_<_Tp>& operator /= (Point_<_Tp>& a, float b)
{
a.x = saturate_cast<_Tp>(a.x / b);
a.y = saturate_cast<_Tp>(a.y / b);
return a;
}
template<typename _Tp> static inline
Point_<_Tp>& operator /= (Point_<_Tp>& a, double b)
{
a.x = saturate_cast<_Tp>(a.x / b);
a.y = saturate_cast<_Tp>(a.y / b);
return a;
}
template<typename _Tp> static inline
double norm(const Point_<_Tp>& pt)
{
......@@ -1080,6 +1104,30 @@ Point3_<_Tp> operator * (const Matx<_Tp, 3, 3>& a, const Point_<_Tp>& b)
return Point3_<_Tp>(tmp.val[0], tmp.val[1], tmp.val[2]);
}
template<typename _Tp> static inline
Point_<_Tp> operator / (const Point_<_Tp>& a, int b)
{
Point_<_Tp> tmp(a);
tmp /= b;
return tmp;
}
template<typename _Tp> static inline
Point_<_Tp> operator / (const Point_<_Tp>& a, float b)
{
Point_<_Tp> tmp(a);
tmp /= b;
return tmp;
}
template<typename _Tp> static inline
Point_<_Tp> operator / (const Point_<_Tp>& a, double b)
{
Point_<_Tp> tmp(a);
tmp /= b;
return tmp;
}
//////////////////////////////// 3D Point ///////////////////////////////
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册