|
OpenCV 2.4.8 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opencv.core.Point
public class Point
template
// C++ code:
public:
typedef _Tp value_type;
// various constructors
Point_();
Point_(_Tp _x, _Tp _y);
Point_(const Point_& pt);
Point_(const CvPoint& pt);
Point_(const CvPoint2D32f& pt);
Point_(const Size_<_Tp>& sz);
Point_(const Vec<_Tp, 2>& v);
Point_& operator = (const Point_& pt);
//! conversion to another data type
template
//! conversion to the old-style C structures
operator CvPoint() const;
operator CvPoint2D32f() const;
operator Vec<_Tp, 2>() const;
//! dot product
_Tp dot(const Point_& pt) const;
//! dot product computed in double-precision arithmetics
double ddot(const Point_& pt) const;
//! cross-product
double cross(const Point_& pt) const;
//! checks whether the point is inside the specified rectangle
bool inside(const Rect_<_Tp>& r) const;
_Tp x, y; //< the point coordinates
};
Template class for 2D points specified by its coordinates
x and y.
An instance of the class is interchangeable with C structures,
CvPoint
and CvPoint2D32f
. There is also a cast
operator to convert point coordinates to the specified type. The conversion
from floating-point coordinates to integer coordinates is done by rounding.
Commonly, the conversion uses thisoperation for each of the coordinates.
Besides the class members listed in the declaration above, the following
operations on points are implemented:
// C++ code:
pt1 = pt2 + pt3;
pt1 = pt2 - pt3;
pt1 = pt2 * a;
pt1 = a * pt2;
pt1 += pt2;
pt1 -= pt2;
pt1 *= a;
double value = norm(pt); // L2 norm
pt1 == pt2;
pt1 != pt2;
For your convenience, the following type aliases are defined:
typedef Point_
typedef Point2i Point;
typedef Point_
typedef Point_
Example:
Point2f a(0.3f, 0.f), b(0.f, 0.4f);
Point pt = (a + b)*10.f;
cout << pt.x << ", " << pt.y << endl;
Field Summary | |
---|---|
double |
x
|
double |
y
|
Constructor Summary | |
---|---|
Point()
|
|
Point(double[] vals)
|
|
Point(double x,
double y)
|
Method Summary | |
---|---|
Point |
clone()
|
double |
dot(Point p)
|
boolean |
equals(java.lang.Object obj)
|
int |
hashCode()
|
boolean |
inside(Rect r)
|
void |
set(double[] vals)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public double x
public double y
Constructor Detail |
---|
public Point()
public Point(double[] vals)
public Point(double x, double y)
Method Detail |
---|
public Point clone()
clone
in class java.lang.Object
public double dot(Point p)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean inside(Rect r)
public void set(double[] vals)
public java.lang.String toString()
toString
in class java.lang.Object
|
OpenCV 2.4.8 Documentation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |