}
xout = x + rx + dx;
yout = y + ry + dy;
} else if (shape instanceof Polygon2D) {
Polygon2D polygon = (Polygon2D) shape;
double pointx = xCenter;
double pointy = yCenter;
double max_r = 0;
int vertexes = polygon.getVertexCount();
if (vertexes > 1) {
// compute the intersection of the line segment passing through
// (x0,y0) and (x1,y1) with the ray passing through
// (xCenter, yCenter) and (px,py)
double x0;
// compute the intersection of the line segment passing through
// (x0,y0) and (x1,y1) with the ray passing through
// (xCenter, yCenter) and (px,py)
double x1;
// compute the intersection of the line segment passing through
// (x0,y0) and (x1,y1) with the ray passing through
// (xCenter, yCenter) and (px,py)
double y0;
// compute the intersection of the line segment passing through
// (x0,y0) and (x1,y1) with the ray passing through
// (xCenter, yCenter) and (px,py)
double y1;
double px = xCenter + Math.cos(alpha);
double py = yCenter + Math.sin(alpha);
// Assume the polygon is closed, so do the "closing stroke"
// first
x1 = polygon.getX(vertexes - 1);
y1 = polygon.getY(vertexes - 1);
for (int vertexPair = 0; vertexPair < vertexes; vertexPair++) {
x0 = x1;
y0 = y1;
x1 = polygon.getX(vertexPair);
y1 = polygon.getY(vertexPair);
double A = ((x0 - xCenter) * (py - yCenter))
- ((y0 - yCenter) * (px - xCenter));
double B = ((y1 - y0) * (px - xCenter))
- ((x1 - x0) * (py - yCenter));