Подскажите пожалуйста как правильно написать решение условий:
a>0, b>0. или b>=2a, a<b<2a, a>b. Сколько пытался, только не пойму куда можно вывести решение.
Улитка Паскаля :
x = a*cos(t)2 +b*cos(t), y = a*cos(t)*sin(t) + b*sin(t),
a>0, b>0, t [0,2pi). Рассмотреть случаи, когда b>=2a, a<b<2a, a>b.
Код:
procedure TForm1.Button4Click(Sender: TObject);
var
l,bb: integer;
w: integer;
x0,y0: integer;
g: Integer;
t: Real;
x, y: Real;
a,b:integer;
st:string;
begin
l := 150;
bb := Form1.ClientHeight-270;
w := Form1.Width-200;
x0 :=l;
y0:= bb - Abs(Round(bb / 2));
a:=StrToInt(Edit4.Text);
b:=StrToInt(Edit5.Text);
With Image1.Canvas do
begin
MoveTo(l, 20); LineTo(l, bb-20);
Font.Size := 14;
MoveTo(x0, y0); LineTo(x0 + w - l, y0);
MoveTo(x0, y0); LineTo(x0 - w + l, y0);
Font.Size := 14;
TextOut(l + w - l - 20, y0 + 20, 'x');
MoveTo(150,0);LineTo(150,400);
Textout(152,165,'0');//öåíòð
Textout(270,165,'0');
Textout(20,165,'PI');
Textout(110,20,'PI/2');
Textout(95,270,'3*PI/2');
Pen.Color := clRed;
For g := 0 to 360 do
begin
t := g * Pi / 180;
If (a>0) and (b>0) then
x := x0 + a * sqr(cos(t)) + b * cos(t);
y := y0 + a * cos(t) * sin(t) + b * sin(t);
If g = 0 then
MoveTo(Round(x), Round(y))
else
LineTo(Round(x), Round(y));
end;
begin
If (a>b) then
x := x0 + a * sqr(cos(t)) + b * cos(t);
y := y0 + a * cos(t) * sin(t) + b * sin(t);
Showmessage('x='+floattostrf(x,fffixed,9,2));
end;
end;
end;
end.