我需要创建一个简单的 Java 程序,它通过任意数量的点逐个像素地绘制贝塞尔曲线。目前,除了曲线总是在 x=0 y=0 坐标处结束之外,一切似乎都没问题。
截图 1
截图 2
我需要它在最后一点结束。我的大脑今天不太工作,所以我正在寻找一些帮助。
这是我所拥有的:
private void drawScene(){
precision = Float.parseFloat(this.jTextField4.getText());
//Clears the screen and draws X and Y lines
g.setColor(Color.white);
g.fillRect(0, 0, pWidth, pHeight);
g.setColor(Color.gray);
g.drawLine(0, offsetY, pWidth, offsetY);
g.drawLine(offsetX, 0, offsetX, pHeight);
//Drawing the points
if(pointCount > 0){
for(int i = 0;i<pointCount;i++){
g.setColor(Color.red);
g.drawString(String.valueOf(i+1), points[i].x + offsetX, points[i].y - 6 + offsetY);
g.drawOval(points[i].x + offsetX, points[i].y - 6 + offsetY, 3, 3);
}
}
//Drawing the curve
if(pointCount > 1){
float …
Run Code Online (Sandbox Code Playgroud) 我使用 artisan workbench 命令创建了一个包。一切正常,但我想在我的包中使用另一个 composer 包。最好/最干净的方法是什么?