0
다음 그림을 그릴 수 있습니다. 아래에서 이전에 아래에? 이제 끝났습니다 ... 그것은 퍼널이 될 것이므로 모든 타원형이 다각형과 아크 밑에 있었으면합니다. I는 코드 가지고 PSJava Graphics2D : 이전 그림에서 아래 그림을 그립니다.
for (int i = 0; i < pdLen; i++) {
....
....
g2.fillPolygon(poly);
g2.fillOval(topLeft[0], topLeft[1] - 10, topRight[0] - topLeft[0], arcHeight);
g2.fillArc(botLeft[0], botLeft[1] - arcHeight/2, botRight[0] - botLeft[0], arcHeight, 0, -180);
}
감사 : 다음 좌표 이전 계산된다 이처럼 을 INT (I = pdLen-1; 나는> 0; I -) { 작동되지
UPD :
모든 루프 단계는 topLeft 및 topRight를 계산합니다.
int[] topLeft = {(int)Math.round(startX + (procSum/onePixX)), (int)Math.round(startY + (procSum/onePixY))};
int[] topRight = {(int)Math.round(topRightX - (procSum/onePixX)), (int)Math.round(startY + (procSum/onePixY))};
procSum += (pieceData[i] * pieceProc);
int[] botLeft = {(int)Math.round(startX + (procSum/onePixX)), (int)Math.round(startY + (procSum/onePixY))};
int[] botRight = {(int)Math.round(topRightX - (procSum/onePixX)), (int)Math.round(startY + (procSum/onePixY))};
procSum += padProc;
감사 :
그러나, 싼 (즉, 단순) 솔루션은 페인트하는 무슨 저장 한 다음 역순으로 이러한 모양을 칠하는 것입니다. 작동하며 나중에 알고리즘이 변경됩니다. – Gwalk