@Name(value="cv::Point_<int>") @NoOffset @Properties(inherit=opencv_core.class) public class Point extends IntPointer
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 this operation for each of the coordinates. Besides the class members listed in the declaration above, the following operations on points are implemented:
pt1 = pt2 + pt3;
pt1 = pt2 - pt3;
pt1 = pt2 * a;
pt1 = a * pt2;
pt1 = pt2 / a;
pt1 += pt2;
pt1 -= pt2;
pt1 *= a;
pt1 /= a;
double value = norm(pt); // L2 norm
pt1 == pt2;
pt1 != pt2;
For your convenience, the following type aliases are defined:
typedef Point_<int> Point2i;
typedef Point2i Point;
typedef Point_<float> Point2f;
typedef Point_<double> Point2d;
Example:
Point2f a(0.3f, 0.f), b(0.f, 0.4f);
Point pt = (a + b)*10.f;
cout << pt.x << ", " << pt.y << endl;
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
Point()
default constructor
|
Point(int _x,
int _y) |
Point(long size)
Native array allocator.
|
Point(Point pt) |
Point(Pointer p)
Pointer cast constructor.
|
Point(Size sz) |
Modifier and Type | Method and Description |
---|---|
double |
cross(Point pt)
cross-product
|
double |
ddot(Point pt)
dot product computed in double-precision arithmetics
|
int |
dot(Point pt)
dot product
|
boolean |
inside(Rect r)
checks whether the point is inside the specified rectangle
|
Point |
position(long position) |
Point |
put(Point pt) |
int |
x()
x coordinate of the point
|
Point |
x(int setter) |
int |
y()
y coordinate of the point
|
Point |
y(int setter) |
asBuffer, capacity, get, get, get, get, getString, getStringCodePoints, limit, put, put, put, put, putString, sizeof
address, asByteBuffer, availablePhysicalBytes, calloc, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, isNull, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, toString, totalBytes, totalPhysicalBytes, withDeallocator, zero
public Point(Pointer p)
Pointer.Pointer(Pointer)
.public Point(long size)
Pointer.position(long)
.public Point()
public Point(int _x, int _y)
public Point position(long position)
position
in class IntPointer
public double ddot(@Const @ByRef Point pt)
@Cast(value="bool") public boolean inside(@Const @ByRef Rect r)
public int x()
public Point x(int setter)
public int y()
public Point y(int setter)
Copyright © 2020. All rights reserved.