int y1 = from.getY();
int y2 = to.getY();
int dy = (y2 - y1);
Polygon temp_polygon = new Polygon();
if (dy > 0)
{
/* 45
* / 6
* 3 /
* 21
*/
temp_polygon.addPoint(c.scaleX(x1 + width), c.scaleY(y1 - width));
temp_polygon.addPoint(c.scaleX(x1 - width), c.scaleY(y1 - width));
temp_polygon.addPoint(c.scaleX(x1 - width), c.scaleY(y1 + width));
temp_polygon.addPoint(c.scaleX(x2 - width), c.scaleY(y2 + width));
temp_polygon.addPoint(c.scaleX(x2 + width), c.scaleY(y2 + width));
temp_polygon.addPoint(c.scaleX(x2 + width), c.scaleY(y2 - width));
}
else
{
/* 23
* 1 \
* \ 4
* 56
*/
temp_polygon.addPoint(c.scaleX(x1 - width), c.scaleY(y1 - width));
temp_polygon.addPoint(c.scaleX(x1 - width), c.scaleY(y1 + width));
temp_polygon.addPoint(c.scaleX(x1 + width), c.scaleY(y1 + width));
temp_polygon.addPoint(c.scaleX(x2 + width), c.scaleY(y2 + width));
temp_polygon.addPoint(c.scaleX(x2 + width), c.scaleY(y2 - width));
temp_polygon.addPoint(c.scaleX(x2 - width), c.scaleY(y2 - width));
}
g.fillPolygon(temp_polygon);
}