mirror of
https://github.com/opencv/opencv.git
synced 2025-06-11 03:33:28 +08:00
Adding element-wise division operators to Point3_ class.
This commit is contained in:
parent
fb9bbf99c4
commit
f32a6fb9a1
@ -1235,6 +1235,33 @@ Point3_<_Tp>& operator *= (Point3_<_Tp>& a, double b)
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
Point3_<_Tp>& operator /= (Point3_<_Tp>& a, int b)
|
||||||
|
{
|
||||||
|
a.x = saturate_cast<_Tp>(a.x / b);
|
||||||
|
a.y = saturate_cast<_Tp>(a.y / b);
|
||||||
|
a.z = saturate_cast<_Tp>(a.z / b);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
Point3_<_Tp>& operator /= (Point3_<_Tp>& a, float b)
|
||||||
|
{
|
||||||
|
a.x = saturate_cast<_Tp>(a.x / b);
|
||||||
|
a.y = saturate_cast<_Tp>(a.y / b);
|
||||||
|
a.z = saturate_cast<_Tp>(a.z / b);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
Point3_<_Tp>& operator /= (Point3_<_Tp>& a, double b)
|
||||||
|
{
|
||||||
|
a.x = saturate_cast<_Tp>(a.x / b);
|
||||||
|
a.y = saturate_cast<_Tp>(a.y / b);
|
||||||
|
a.z = saturate_cast<_Tp>(a.z / b);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename _Tp> static inline
|
template<typename _Tp> static inline
|
||||||
double norm(const Point3_<_Tp>& pt)
|
double norm(const Point3_<_Tp>& pt)
|
||||||
{
|
{
|
||||||
@ -1320,6 +1347,30 @@ Matx<_Tp, 4, 1> operator * (const Matx<_Tp, 4, 4>& a, const Point3_<_Tp>& b)
|
|||||||
return a * Matx<_Tp, 4, 1>(b.x, b.y, b.z, 1);
|
return a * Matx<_Tp, 4, 1>(b.x, b.y, b.z, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
Point3_<_Tp> operator / (const Point3_<_Tp>& a, int b)
|
||||||
|
{
|
||||||
|
Point3_<_Tp> tmp(a);
|
||||||
|
tmp /= b;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
Point3_<_Tp> operator / (const Point3_<_Tp>& a, float b)
|
||||||
|
{
|
||||||
|
Point3_<_Tp> tmp(a);
|
||||||
|
tmp /= b;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
Point3_<_Tp> operator / (const Point3_<_Tp>& a, double b)
|
||||||
|
{
|
||||||
|
Point3_<_Tp> tmp(a);
|
||||||
|
tmp /= b;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////// Size /////////////////////////////////
|
////////////////////////////////// Size /////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user