parent
b135fb5408
commit
4b14f30509
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,33 @@ |
||||
package sig; |
||||
|
||||
public class Edge { |
||||
Point a,b; |
||||
int min_y; |
||||
int max_y; |
||||
int min_x; |
||||
int max_x; |
||||
double x_of_min_y; |
||||
double inverse_slope; |
||||
public Edge(Point a, Point b) { |
||||
super(); |
||||
this.a = a; |
||||
this.b = b; |
||||
min_y=Math.min(a.y, b.y); |
||||
max_y=Math.max(a.y, b.y); |
||||
min_x=Math.min(a.x, b.x); |
||||
max_x=Math.max(a.x, b.x); |
||||
if (a.y==min_y) { |
||||
x_of_min_y=a.x; |
||||
} else { |
||||
x_of_min_y=b.x; |
||||
} |
||||
|
||||
inverse_slope=(double)(a.x-b.x)/(a.y-b.y); |
||||
} |
||||
@Override |
||||
public String toString() { |
||||
return "Edge [a=" + a + ", b=" + b + ", min_y=" + min_y + ", max_y=" + max_y + ", min_x=" + min_x + ", max_x=" |
||||
+ max_x + ", x_of_min_y=" + x_of_min_y + ", inverse_slope=" + inverse_slope + "]"; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,32 @@ |
||||
package sig; |
||||
|
||||
public class Point { |
||||
int x,y; |
||||
|
||||
public Point(int x, int y) { |
||||
super(); |
||||
this.x = x; |
||||
this.y = y; |
||||
} |
||||
|
||||
public int getX() { |
||||
return x; |
||||
} |
||||
|
||||
public void setX(int x) { |
||||
this.x = x; |
||||
} |
||||
|
||||
public int getY() { |
||||
return y; |
||||
} |
||||
|
||||
public void setY(int y) { |
||||
this.y = y; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "Point(" + x + "," + y + ")"; |
||||
} |
||||
} |
Loading…
Reference in new issue