![]() |
|
|
#1
|
|||
|
|||
![]() не получается нарисовать овал декарта помгите пожалуйста 2 день мучаюсь
(x2+y2–2x)2–22(x2+y2)+1=0 если поможет Код:
procedure TForm1.Button8Click(Sender: TObject); var r,theta,t,u,u1:integer; a,tx,ty,x,g:single; begin r:=5; canvas.Pen.Color:=clred; for theta:=1 to 360 do begin g:=(theta*pi)/180; tx:=r*sin(t)*cos(t)*cos(t); ty:=r*cos(t)*sin(t)*sin(t); //y=R*sin(t); //x= R*cos(t); u:=round(tx*10); u1:=round(ty*10); if theta=1 then canvas.MoveTo(u1+w2,u+h2) else canvas.LineTo(u+w2,u1+h2); end; end; |
#2
|
||||
|
||||
![]() Код:
Procedure DrawCircle(CenterX, CenterY, Radius: Integer; Canvas: TCanvas; Color :TColor); procedure PlotCircle(x, y, x1, y1: Integer); begin Canvas.Pixels[x + x1, y + y1] := Color; Canvas.Pixels[x - x1, y + y1] := Color; Canvas.Pixels[x + x1, y - y1] := Color; Canvas.Pixels[x - x1, y - y1] := Color; Canvas.Pixels[x + y1, y + x1] := Color; Canvas.Pixels[x - y1, y + x1] := Color; Canvas.Pixels[x + y1, y - x1] := Color; Canvas.Pixels[x - y1, y - x1] := Color; end; var x, y, r: Integer; x1, y1, p: Integer; begin x := CenterX; y := CenterY; r := Radius; x1 := 0; y1 := r; p := 3 - 2 * r; while ( x1 < y1 ) do begin plotcircle (x, y, x1, y1) ; if (p < 0) then p := p + 4 * x1 + 6 else begin p := p + 4 * ( x1 - y1 ) + 10 ; y1 := y1 - 1 ; end; x1 := x1 + 1 ; end; if (x1 = y1) then plotcircle( x, y, x1, y1) ; end; Код:
procedure TForm1.Button2Click(Sender: TObject); begin DrawCircle(500, 500, 50, Canvas, clred); // х, у, радиус, канва, цвет end; Нет ничего не возможного. Вопрос только во времени... |