【发布时间】:2023-03-09 07:20:01
【问题描述】:
我有多边形类的多边形。我怎样才能使它更大或更小。我正在为矩形寻找像 grow(int,int) 这样的函数。我不知道该怎么做。
提前致谢!
@抱歉我的愚蠢问题没有任何细节。
我正在使用以下方法制作多边形:
private int[] xCoord = new int[50], yCoord= new int[50]; //Arrays containing the points of the polygon
private int pointCt=0; //The number of points that have been input
我在某个地方点击鼠标,然后画一条线
xCoord[pointCt] = arg0.getX();
yCoord[pointCt] = arg0.getY();
pointCt++;
private void putLine(int x1,int y1,int x2,int y2)
{
Graphics g= getGraphics();
g.drawLine(x1, y1, x2, y2);
g.dispose();
}
polygon=new MyPolygon(xCoord,yCoord,pointCt);
我不完全知道我应该发布哪一行代码,但我希望它足够。我只需要一个建议,如何在桌子上制作更大的多边形。 谢谢!
【问题讨论】:
-
你必须学习数学。然后你必须应用数学。
-
我投票结束这个问题太宽泛了。甚至不清楚如何表示多边形,使用哪个坐标系等。
-
欢迎来到 Stack Overflow!您似乎在要求某人为您编写一些代码。 Stack Overflow 是一个问答网站,而不是代码编写服务。请see here学习如何写出有效的问题。