提问关于setRegion()

sxdjnn 2006-01-30 09:36:29
static int[] createCircle(int xOffset, int yOffset, int radius) {
int[] circlePoints = new int[10 * radius];
for (int loopIndex = 0; loopIndex < 2 * radius + 1; loopIndex++) {
int xCurrent = loopIndex - radius;
int yCurrent = (int) Math.sqrt(radius * radius - xCurrent
* xCurrent);
int doubleLoopIndex = 2 * loopIndex;

circlePoints[doubleLoopIndex] = xCurrent + xOffset;
circlePoints[doubleLoopIndex + 1] = yCurrent + yOffset;
circlePoints[10 * radius - doubleLoopIndex - 2] = xCurrent
+ xOffset;
circlePoints[10 * radius - doubleLoopIndex - 1] = -yCurrent
+ yOffset;
}
return circlePoints;
}
————————————————————————————————————————————
shell.setRegion(createCircle(15,15,15))
shell.setRegion(createCircle(25,25,25))
上面两句都不会出现问题,都可以显示出一个完整的圆形

可是到了shell.setRegion(createCircle(40,40,40))就变成扇形了(只要比40大都不行)
高手赐教~~~~
...全文
171 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

62,629

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧