ArrayList<Vector2f> shape = new ArrayList<Vector2f>();
// top line
if(widthOne) {
shape.add(new Vector2f(0, -height));
} else {
shape.add(new Vector2f(-width/2 + cornerRadius, -height/2));
shape.add(new Vector2f(+width/2 - cornerRadius, -height/2));
}
// top right corner
for(int i = 1; i <= pointsPerCorner; i++) {
float angle = angleInc * i - ((float)Math.PI / 2);
shape.add(new Vector2f(
cornerRadius * (float)Math.cos(angle) + width/2 - cornerRadius,
cornerRadius * (float)Math.sin(angle) - height/2 + cornerRadius
));
}
// right line
if(heightOne) {
shape.add(new Vector2f(width, 0));
} else {
shape.add(new Vector2f(width/2, -height/2 + cornerRadius));
shape.add(new Vector2f(width/2, +height/2 - cornerRadius));
}
// bottom right corner
for(int i = 1; i <= pointsPerCorner; i++) {
float angle = angleInc * i;
shape.add(new Vector2f(
cornerRadius * (float)Math.cos(angle) + width/2 - cornerRadius,
cornerRadius * (float)Math.sin(angle) + height/2 - cornerRadius
));
}
// bottom line
if(widthOne) {
shape.add(new Vector2f(0, height));
} else {
shape.add(new Vector2f(+width/2 - cornerRadius, height/2));
shape.add(new Vector2f(-width/2 + cornerRadius, height/2));
}
// bottom left corner
for(int i = 1; i <= pointsPerCorner; i++) {
float angle = angleInc * i + ((float)Math.PI / 2);
shape.add(new Vector2f(
cornerRadius * (float)Math.cos(angle) - width/2 + cornerRadius,
cornerRadius * (float)Math.sin(angle) + height/2 - cornerRadius
));
}
// left line
if(heightOne) {
shape.add(new Vector2f(-width, 0));
} else {
shape.add(new Vector2f(-width/2, +height/2 - cornerRadius));
shape.add(new Vector2f(-width/2, -height/2 + cornerRadius));
}
// top left corner
for(int i = 1; i <= pointsPerCorner; i++) {
float angle = angleInc * i + ((float)Math.PI);
shape.add(new Vector2f(
cornerRadius * (float)Math.cos(angle) - width/2 + cornerRadius,
cornerRadius * (float)Math.sin(angle) - height/2 + cornerRadius
));
}