partial implementation of complex out args in Java wrappers
This commit is contained in:
@@ -2,54 +2,62 @@ package org.opencv;
|
||||
|
||||
//javadoc:Point_
|
||||
public class Point {
|
||||
|
||||
public double x, y;
|
||||
|
||||
public Point(double x, double y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public Point() {
|
||||
this(0, 0);
|
||||
}
|
||||
|
||||
public Point clone() {
|
||||
return new Point(x, y);
|
||||
}
|
||||
|
||||
public double dot(Point p) {
|
||||
return x * p.x + y * p.y;
|
||||
}
|
||||
public double x, y;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(x);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(y);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
public Point(double x, double y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if ( ! (obj instanceof Point) ) return false;
|
||||
Point it = (Point) obj;
|
||||
return x == it.x && y == it.y;
|
||||
}
|
||||
public Point() {
|
||||
this(0, 0);
|
||||
}
|
||||
|
||||
public boolean inside(Rect r) {
|
||||
return r.contains(this);
|
||||
}
|
||||
public Point(double[] vals) {
|
||||
this();
|
||||
if(vals!=null) {
|
||||
x = vals.length>0 ? vals[0] : 0;
|
||||
y = vals.length>1 ? vals[1] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Point clone() {
|
||||
return new Point(x, y);
|
||||
}
|
||||
|
||||
public double dot(Point p) {
|
||||
return x * p.x + y * p.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(x);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(y);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if ( ! (obj instanceof Point) ) return false;
|
||||
Point it = (Point) obj;
|
||||
return x == it.x && y == it.y;
|
||||
}
|
||||
|
||||
public boolean inside(Rect r) {
|
||||
return r.contains(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this == null) return "null";
|
||||
return "{" + x + ", " + y + "}";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this == null) return "null";
|
||||
return "{" + x + ", " + y + "}";
|
||||
}
|
||||
}
|
||||
|
@@ -3,55 +3,64 @@ package org.opencv;
|
||||
//javadoc:Point3_
|
||||
public class Point3 {
|
||||
|
||||
public double x, y, z;
|
||||
public double x, y, z;
|
||||
|
||||
public Point3(double x, double y, double z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
public Point3(double x, double y, double z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public Point3() {
|
||||
this(0, 0, 0);
|
||||
}
|
||||
public Point3() {
|
||||
this(0, 0, 0);
|
||||
}
|
||||
|
||||
public Point3(Point p) {
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
z = 0;
|
||||
}
|
||||
public Point3(Point p) {
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
z = 0;
|
||||
}
|
||||
|
||||
public Point3 clone() {
|
||||
return new Point3(x, y, z);
|
||||
}
|
||||
public Point3(double[] vals) {
|
||||
this();
|
||||
if(vals!=null) {
|
||||
x = vals.length>0 ? vals[0] : 0;
|
||||
y = vals.length>1 ? vals[1] : 0;
|
||||
z = vals.length>2 ? vals[2] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double dot(Point3 p) {
|
||||
return x * p.x + y * p.y + z * p.z;
|
||||
}
|
||||
public Point3 clone() {
|
||||
return new Point3(x, y, z);
|
||||
}
|
||||
|
||||
public Point3 cross(Point3 p) {
|
||||
return new Point3(y * p.z - z * p.y, z * p.x - x * p.z, x * p.y - y * p.x);
|
||||
}
|
||||
public double dot(Point3 p) {
|
||||
return x * p.x + y * p.y + z * p.z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(x);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(y);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(z);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
public Point3 cross(Point3 p) {
|
||||
return new Point3(y * p.z - z * p.y, z * p.x - x * p.z, x * p.y - y * p.x);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Point3)) return false;
|
||||
Point3 it = (Point3) obj;
|
||||
return x == it.x && y == it.y && z == it.z;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(x);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(y);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(z);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Point3)) return false;
|
||||
Point3 it = (Point3) obj;
|
||||
return x == it.x && y == it.y && z == it.z;
|
||||
}
|
||||
}
|
||||
|
@@ -2,82 +2,92 @@ package org.opencv;
|
||||
|
||||
//javadoc:Rect_
|
||||
public class Rect {
|
||||
|
||||
public int x, y, width, height;
|
||||
|
||||
public Rect(int x, int y, int width, int height) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
public int x, y, width, height;
|
||||
|
||||
public Rect() {
|
||||
this(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public Rect(Point p1, Point p2) {
|
||||
x = (int) (p1.x < p2.x ? p1.x : p2.x);
|
||||
y = (int) (p1.y < p2.y ? p1.y : p2.y);
|
||||
width = (int) (p1.x > p2.x ? p1.x : p2.x) - x;
|
||||
height = (int) (p1.y > p2.y ? p1.y : p2.y) - y;
|
||||
}
|
||||
public Rect(int x, int y, int width, int height) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public Rect(Point p, Size s) {
|
||||
this((int)p.x, (int)p.y, (int)s.width, (int)s.height);
|
||||
}
|
||||
|
||||
public Rect clone() {
|
||||
return new Rect(x, y, width, height);
|
||||
}
|
||||
|
||||
public Point tl() {
|
||||
return new Point(x, y);
|
||||
}
|
||||
public Rect() {
|
||||
this(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public Point br() {
|
||||
return new Point(x + width, y + height);
|
||||
}
|
||||
public Rect(Point p1, Point p2) {
|
||||
x = (int) (p1.x < p2.x ? p1.x : p2.x);
|
||||
y = (int) (p1.y < p2.y ? p1.y : p2.y);
|
||||
width = (int) (p1.x > p2.x ? p1.x : p2.x) - x;
|
||||
height = (int) (p1.y > p2.y ? p1.y : p2.y) - y;
|
||||
}
|
||||
|
||||
public Size size() {
|
||||
return new Size(width, height);
|
||||
}
|
||||
public Rect(Point p, Size s) {
|
||||
this((int)p.x, (int)p.y, (int)s.width, (int)s.height);
|
||||
}
|
||||
|
||||
public double area() {
|
||||
return width * height;
|
||||
}
|
||||
public Rect(double[] vals) {
|
||||
this();
|
||||
if(vals!=null) {
|
||||
x = vals.length>0 ? (int)vals[0] : 0;
|
||||
y = vals.length>1 ? (int)vals[1] : 0;
|
||||
width = vals.length>2 ? (int)vals[2] : 0;
|
||||
height = vals.length>3 ? (int)vals[3] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean contains(Point p) {
|
||||
return x <= p.x && p.x < x + width && y <= p.y && p.y < y + height;
|
||||
}
|
||||
public Rect clone() {
|
||||
return new Rect(x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(height);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(width);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(x);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(y);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
public Point tl() {
|
||||
return new Point(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Rect)) return false;
|
||||
Rect it = (Rect) obj;
|
||||
return x == it.x && y == it.y && width == it.width && height == it.height;
|
||||
}
|
||||
public Point br() {
|
||||
return new Point(x + width, y + height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this == null) return "null";
|
||||
return "{" + x + ", " + y + ", " + width + "x" + height+"}";
|
||||
}
|
||||
public Size size() {
|
||||
return new Size(width, height);
|
||||
}
|
||||
|
||||
public double area() {
|
||||
return width * height;
|
||||
}
|
||||
|
||||
public boolean contains(Point p) {
|
||||
return x <= p.x && p.x < x + width && y <= p.y && p.y < y + height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(height);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(width);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(x);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(y);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Rect)) return false;
|
||||
Rect it = (Rect) obj;
|
||||
return x == it.x && y == it.y && width == it.width && height == it.height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this == null) return "null";
|
||||
return "{" + x + ", " + y + ", " + width + "x" + height+"}";
|
||||
}
|
||||
}
|
||||
|
@@ -2,86 +2,97 @@ package org.opencv;
|
||||
|
||||
//javadoc:RotatedRect_
|
||||
public class RotatedRect {
|
||||
|
||||
public Point center;
|
||||
public Size size;
|
||||
public double angle;
|
||||
|
||||
public RotatedRect() {
|
||||
this.angle=0;
|
||||
}
|
||||
public Point center;
|
||||
public Size size;
|
||||
public double angle;
|
||||
|
||||
public RotatedRect(Point c, Size s, double a) {
|
||||
this.center = c.clone();
|
||||
this.size = s.clone();
|
||||
this.angle = a;
|
||||
}
|
||||
public RotatedRect() {
|
||||
this.angle=0;
|
||||
}
|
||||
|
||||
public void points(Point pt[])
|
||||
{
|
||||
double _angle = angle*Math.PI/180.0;
|
||||
double b = (double)Math.cos(_angle)*0.5f;
|
||||
double a = (double)Math.sin(_angle)*0.5f;
|
||||
public RotatedRect(Point c, Size s, double a) {
|
||||
this.center = c.clone();
|
||||
this.size = s.clone();
|
||||
this.angle = a;
|
||||
}
|
||||
|
||||
pt[0] = new Point(
|
||||
center.x - a*size.height - b*size.width,
|
||||
center.y + b*size.height - a*size.width);
|
||||
public RotatedRect(double[] vals) {
|
||||
this();
|
||||
if(vals!=null) {
|
||||
center.x = vals.length>0 ? (int)vals[0] : 0;
|
||||
center.x = vals.length>1 ? (int)vals[1] : 0;
|
||||
size.width = vals.length>2 ? (int)vals[2] : 0;
|
||||
size.height = vals.length>3 ? (int)vals[3] : 0;
|
||||
angle = vals.length>4 ? (int)vals[4] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
pt[1] = new Point(
|
||||
center.x + a*size.height - b*size.width,
|
||||
center.y - b*size.height - a*size.width);
|
||||
public void points(Point pt[])
|
||||
{
|
||||
double _angle = angle*Math.PI/180.0;
|
||||
double b = (double)Math.cos(_angle)*0.5f;
|
||||
double a = (double)Math.sin(_angle)*0.5f;
|
||||
|
||||
pt[2] = new Point(
|
||||
2*center.x - pt[0].x,
|
||||
2*center.y - pt[0].y);
|
||||
pt[0] = new Point(
|
||||
center.x - a*size.height - b*size.width,
|
||||
center.y + b*size.height - a*size.width);
|
||||
|
||||
pt[3] = new Point(
|
||||
2*center.x - pt[1].x,
|
||||
2*center.y - pt[1].y);
|
||||
}
|
||||
pt[1] = new Point(
|
||||
center.x + a*size.height - b*size.width,
|
||||
center.y - b*size.height - a*size.width);
|
||||
|
||||
public Rect boundingRect()
|
||||
{
|
||||
Point pt[] = new Point[4];
|
||||
points(pt);
|
||||
Rect r=new Rect((int)Math.floor(Math.min(Math.min(Math.min(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
|
||||
(int)Math.floor(Math.min(Math.min(Math.min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)),
|
||||
(int)Math.ceil(Math.max(Math.max(Math.max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
|
||||
(int)Math.ceil(Math.max(Math.max(Math.max(pt[0].y, pt[1].y), pt[2].y), pt[3].y)));
|
||||
r.width -= r.x - 1;
|
||||
r.height -= r.y - 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
public RotatedRect clone() {
|
||||
return new RotatedRect(center, size, angle);
|
||||
}
|
||||
|
||||
pt[2] = new Point(
|
||||
2*center.x - pt[0].x,
|
||||
2*center.y - pt[0].y);
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(center.x);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(center.y);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(size.width);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(size.height);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(angle);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
pt[3] = new Point(
|
||||
2*center.x - pt[1].x,
|
||||
2*center.y - pt[1].y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof RotatedRect)) return false;
|
||||
RotatedRect it = (RotatedRect) obj;
|
||||
return center.equals(it.center) && size.equals(it.size) && angle == it.angle;
|
||||
}
|
||||
public Rect boundingRect()
|
||||
{
|
||||
Point pt[] = new Point[4];
|
||||
points(pt);
|
||||
Rect r=new Rect((int)Math.floor(Math.min(Math.min(Math.min(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
|
||||
(int)Math.floor(Math.min(Math.min(Math.min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)),
|
||||
(int)Math.ceil(Math.max(Math.max(Math.max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
|
||||
(int)Math.ceil(Math.max(Math.max(Math.max(pt[0].y, pt[1].y), pt[2].y), pt[3].y)));
|
||||
r.width -= r.x - 1;
|
||||
r.height -= r.y - 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
public RotatedRect clone() {
|
||||
return new RotatedRect(center, size, angle);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(center.x);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(center.y);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(size.width);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(size.height);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(angle);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof RotatedRect)) return false;
|
||||
RotatedRect it = (RotatedRect) obj;
|
||||
return center.equals(it.center) && size.equals(it.size) && angle == it.angle;
|
||||
}
|
||||
}
|
||||
|
@@ -2,73 +2,82 @@ package org.opencv;
|
||||
|
||||
//javadoc:Scalar_
|
||||
public class Scalar {
|
||||
|
||||
public double v0, v1, v2, v3;
|
||||
|
||||
public Scalar(double v0, double v1, double v2, double v3) {
|
||||
this.v0 = v0;
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
}
|
||||
public double v0, v1, v2, v3;
|
||||
|
||||
public Scalar(double v0, double v1, double v2) {
|
||||
this(v0, v1, v2, 0);
|
||||
}
|
||||
|
||||
public Scalar(double v0, double v1) {
|
||||
this(v0, v1, 0, 0);
|
||||
}
|
||||
|
||||
public Scalar(double v0) {
|
||||
this(v0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public static Scalar all(double v) {
|
||||
return new Scalar(v, v, v, v);
|
||||
}
|
||||
|
||||
public Scalar clone() {
|
||||
return new Scalar(v0, v1, v2, v3);
|
||||
}
|
||||
public Scalar(double v0, double v1, double v2, double v3) {
|
||||
this.v0 = v0;
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
this.v3 = v3;
|
||||
}
|
||||
|
||||
public Scalar mul(Scalar it, double scale) {
|
||||
return new Scalar( v0 * it.v0 * scale, v1 * it.v1 * scale,
|
||||
v2 * it.v2 * scale, v3 * it.v3 * scale );
|
||||
}
|
||||
public Scalar(double v0, double v1, double v2) {
|
||||
this(v0, v1, v2, 0);
|
||||
}
|
||||
|
||||
public Scalar mul(Scalar it) {
|
||||
return mul(it, 1);
|
||||
}
|
||||
public Scalar conj() {
|
||||
return new Scalar(v0, -v1, -v2, -v3);
|
||||
}
|
||||
public Scalar(double v0, double v1) {
|
||||
this(v0, v1, 0, 0);
|
||||
}
|
||||
|
||||
public boolean isReal() {
|
||||
return v1 == 0 && v2 == 0 && v3 == 0;
|
||||
}
|
||||
public Scalar(double v0) {
|
||||
this(v0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(v0);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(v1);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(v2);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(v3);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
public Scalar(double[] vals) {
|
||||
if(vals!=null) {
|
||||
v0 = vals.length>0 ? (int)vals[0] : 0;
|
||||
v1 = vals.length>1 ? (int)vals[1] : 0;
|
||||
v2 = vals.length>2 ? (int)vals[2] : 0;
|
||||
v3 = vals.length>3 ? (int)vals[3] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Scalar)) return false;
|
||||
Scalar it = (Scalar) obj;
|
||||
return v0 == it.v0 && v1 == it.v1 && v2 == it.v2 && v3 == it.v3;
|
||||
}
|
||||
public static Scalar all(double v) {
|
||||
return new Scalar(v, v, v, v);
|
||||
}
|
||||
|
||||
public Scalar clone() {
|
||||
return new Scalar(v0, v1, v2, v3);
|
||||
}
|
||||
|
||||
public Scalar mul(Scalar it, double scale) {
|
||||
return new Scalar( v0 * it.v0 * scale, v1 * it.v1 * scale,
|
||||
v2 * it.v2 * scale, v3 * it.v3 * scale );
|
||||
}
|
||||
|
||||
public Scalar mul(Scalar it) {
|
||||
return mul(it, 1);
|
||||
}
|
||||
public Scalar conj() {
|
||||
return new Scalar(v0, -v1, -v2, -v3);
|
||||
}
|
||||
|
||||
public boolean isReal() {
|
||||
return v1 == 0 && v2 == 0 && v3 == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(v0);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(v1);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(v2);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(v3);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Scalar)) return false;
|
||||
Scalar it = (Scalar) obj;
|
||||
return v0 == it.v0 && v1 == it.v1 && v2 == it.v2 && v3 == it.v3;
|
||||
}
|
||||
}
|
||||
|
@@ -3,48 +3,56 @@ package org.opencv;
|
||||
//javadoc:Size_
|
||||
public class Size {
|
||||
|
||||
public double width, height;
|
||||
public double width, height;
|
||||
|
||||
public Size(double width, double height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public Size() {
|
||||
this(0, 0);
|
||||
}
|
||||
|
||||
public Size(Point p) {
|
||||
width = (double) p.x;
|
||||
height = (double) p.y;
|
||||
}
|
||||
|
||||
public double area() {
|
||||
return width * height;
|
||||
}
|
||||
public Size(double width, double height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public Size clone() {
|
||||
return new Size(width, height);
|
||||
}
|
||||
public Size() {
|
||||
this(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(height);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(width);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
public Size(Point p) {
|
||||
width = (double) p.x;
|
||||
height = (double) p.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Size)) return false;
|
||||
Size it = (Size) obj;
|
||||
return width == it.width && height == it.height;
|
||||
}
|
||||
public Size(double[] vals) {
|
||||
this();
|
||||
if(vals!=null) {
|
||||
width = vals.length>0 ? vals[0] : 0;
|
||||
height = vals.length>1 ? vals[1] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double area() {
|
||||
return width * height;
|
||||
}
|
||||
|
||||
public Size clone() {
|
||||
return new Size(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(height);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(width);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Size)) return false;
|
||||
Size it = (Size) obj;
|
||||
return width == it.width && height == it.height;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user