Bresenham 算法是为逐点绘图而发明的。
为旋转椭圆找到了一些代码(回路机)
补充:如何将零中心椭圆转换为所需的隐式形式(A、B、C、D、E、F)
A := (Cos(fi)/rx)^2 + (Sin(fi)/ry)^2;
C := (Sin(fi)/rx)^2 + (Cos(fi)/ry)^2;
B := Sin(2*fi)*(1/(ry*ry) - 1/(rx*rx));
D=E=0;
F:=-1
检查 rx=100,ry=60,fi=Pi/6:
更进一步:Delphi 函数获取任意椭圆的隐式形式。我希望代码是可以理解的 (Sqr(x) = x*x)
//calc implicit ellipse equation
//semiaxes rx, ry; rotated at fi radians; centered at (cx,cy)
//x = rx * Cos(t) * Cos(fi) - ry * Sin(t) * Sin(fi) + cx
//y = rx * Cos(t) * Sin(fi) + ry * Sin(t) * Cos(fi) + cy
//To obtain implicit equation, exclude t
//note: implicit form Ax^2+Bxy+Cy^2+Dx+Ey+F=0 (not 2B,2D,2E)
procedure CalcImplicitEllipseEquation(rx, ry, fi, cx, cy: Double;
var A, B, C, D, E, F: Double);
begin
B := Sin(2 * Fi) * (ry * ry - rx * rx);
A := Sqr(ry * Cos(fi)) + Sqr(rx * Sin(fi));
C := Sqr(rx * Cos(fi)) + Sqr(ry * Sin(fi));
D := -B * cy - 2 * A * cx;
E := -2 * C * cy - B * cx;
F := C * cy * cy + A * cx * cx + B * cx * cy - rx * rx * ry * ry;
end;