绘制抛物线
Graphing a parabola
我现在必须绘制实心抛物线 我只是使用以下方法绘制抛物线:
double dt = 0.0001;
for(double x = -50; x < 50; x+= dt){ // drawing parabola from -50 to 50
double y = x*x;
pic.drawPoint(x, y, cr, cg, cb); // x point, y point , R G B
}
这里要改什么才能填满抛物线的内部?
解决了我刚刚添加了另一个循环
double dt = 0.0001;
for(double x = -50; x < 50; x+= dt){ // drawing parabola from -50 to 50
double y = x*x;
for(double yy = y; yy < maxY; yy+=dt){
pic.drawPoint(x, yy, cr, cg, cb); // x point, y point , R G B
}
}
我现在必须绘制实心抛物线 我只是使用以下方法绘制抛物线:
double dt = 0.0001;
for(double x = -50; x < 50; x+= dt){ // drawing parabola from -50 to 50
double y = x*x;
pic.drawPoint(x, y, cr, cg, cb); // x point, y point , R G B
}
这里要改什么才能填满抛物线的内部?
解决了我刚刚添加了另一个循环
double dt = 0.0001;
for(double x = -50; x < 50; x+= dt){ // drawing parabola from -50 to 50
double y = x*x;
for(double yy = y; yy < maxY; yy+=dt){
pic.drawPoint(x, yy, cr, cg, cb); // x point, y point , R G B
}
}