MCPcopy Create free account
hub / github.com/alanross/AlvaAR / Rect

Class Rect

src/libs/opencv/modules/core/misc/java/src/java/core+Rect.java:4–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2
3//javadoc:Rect_
4public class Rect {
5
6 public int x, y, width, height;
7
8 public Rect(int x, int y, int width, int height) {
9 this.x = x;
10 this.y = y;
11 this.width = width;
12 this.height = height;
13 }
14
15 public Rect() {
16 this(0, 0, 0, 0);
17 }
18
19 public Rect(Point p1, Point p2) {
20 x = (int) (p1.x < p2.x ? p1.x : p2.x);
21 y = (int) (p1.y < p2.y ? p1.y : p2.y);
22 width = (int) (p1.x > p2.x ? p1.x : p2.x) - x;
23 height = (int) (p1.y > p2.y ? p1.y : p2.y) - y;
24 }
25
26 public Rect(Point p, Size s) {
27 this((int) p.x, (int) p.y, (int) s.width, (int) s.height);
28 }
29
30 public Rect(double[] vals) {
31 set(vals);
32 }
33
34 public void set(double[] vals) {
35 if (vals != null) {
36 x = vals.length > 0 ? (int) vals[0] : 0;
37 y = vals.length > 1 ? (int) vals[1] : 0;
38 width = vals.length > 2 ? (int) vals[2] : 0;
39 height = vals.length > 3 ? (int) vals[3] : 0;
40 } else {
41 x = 0;
42 y = 0;
43 width = 0;
44 height = 0;
45 }
46 }
47
48 public Rect clone() {
49 return new Rect(x, y, width, height);
50 }
51
52 public Point tl() {
53 return new Point(x, y);
54 }
55
56 public Point br() {
57 return new Point(x + width, y + height);
58 }
59
60 public Size size() {
61 return new Size(width, height);

Callers 15

TESTFunction · 0.50
TESTFunction · 0.50
getBorderedMaskFunction · 0.50
homogeneousInverseFunction · 0.50
simulateDataEyeInHandFunction · 0.50
simulateDataEyeToHandFunction · 0.50
TEST_FFunction · 0.50
merge4Method · 0.50
MakeArtificialExampleFunction · 0.50
findKeyPointsMethod · 0.50
BoardMethod · 0.50

Calls

no outgoing calls

Tested by 15

TESTFunction · 0.40
TESTFunction · 0.40
getBorderedMaskFunction · 0.40
homogeneousInverseFunction · 0.40
simulateDataEyeInHandFunction · 0.40
simulateDataEyeToHandFunction · 0.40
TEST_FFunction · 0.40
merge4Method · 0.40
SetUpFunction · 0.40
TEST_PFunction · 0.40
TESTFunction · 0.40