SUMBU KOORDINAT
procedure TGrafik.Button1Click(Sender: TObject);
Function CanvasX(LojikX:Double):Integer;
begin
result:=Round(LojikX + 400);
end;
Function CanvasY(LojikY:Double):Integer;
begin
result:=Round(160-LojikY);
end;
begin
with Image1.canvas do
begin
pen.Width:=3;
font.Size:=12;
font.color:=clolive;
MoveTo(CanvasX(-300),CanvasY(0)); //sumbu x
LineTo(CanvasX(300),CanvasY(0));
textout(canvasX(305),canvasY(0),'sumbu x');
MoveTo(CanvasX(0),CanvasY(-150)); //sumbuy
LineTo(CanvasX(0),CanvasY(150));
textout(canvasX(0),canvasY(150),'sumbu y');
font.Size:=9;
font.Color:=clolive;
textout(canvasX(100),canvasy(-5),'phi');
textout(canvasX(200),canvasY(-5),'2phi');
textout(canvasX(-100),canvasy(-5),'-phi');
textout(canvasX(-200),canvasY(-5),'-2phi');
textout(canvasX(-10),canvasY(80),'1');
textout(canvasX(-15),canvasY(-75),'-1');
end;
end;
y = sin x
procedure TGrafik.Button3Click(Sender: TObject);
Function SumbuX(LojikX:Double):Integer;
begin
result:=Round(LojikX + 400);
end;
Function SumbuY(LojikY:Double):Integer;
begin
result:=Round(160 - LojikY);
end;
var i:real;
begin
with image1.Canvas do
begin
pen.Width:=10;
font.Size:=9;
font.Color:=clblue;
i:=-200;
while i<=200 do
begin
Pixels[sumbuX(i),sumbuY(80*Sin(i*2*3.14/200))]:=clblue;
i:=i+0.03;
TextOut(sumbuX(185),sumbuY(-40),'y = sin x');
end;
end;
end;
y = cos x
procedure TGrafik.Button4Click(Sender: TObject);
Function SumbuX(LojikX:Double):Integer;
begin
result:=Round(LojikX + 400);
end;
Function SumbuY(LojikY:Double):Integer;
begin
result:=Round(160 - LojikY);
end;
var i:real;
begin
with image1.canvas do
begin
pen.Width:=10;
font.size:=9;
font.Color:=cllime;
i:=-200;
while i<=200 do
begin
Pixels[sumbuX(i),sumbuY(80*Cos(i*2*3.14/200))]:=cllime;
i:=i+0.03;
TextOut(sumbuX(200),sumbuY(80),'y = cos x');
end;
end;
end;
y = tan x
procedure TGrafik.Button5Click(Sender: TObject);
Function SumbuX(LojikX:Double):Integer;
begin
result:=Round(LojikX + 400);
end;
Function SumbuY(LojikY:Double):Integer;
begin
result:=Round(160 - LojikY);
end;
var i:real;
begin
with image1.Canvas do
begin
pen.Width:=10;
font.Size:=9;
font.Color:=claqua;
i:=-200;
while i<=200 do
begin
Pixels[sumbuX(i),sumbuY(20*((sin(i*2*3.14/200))/cos(i*2*3.14/200)))]:=claqua;
i:=i+0.03;
TextOut(sumbuX(100),sumbuY(-60),'y = tan x');
end;
end;
end;
y = 2 - sin x
procedure TGrafik.Button7Click(Sender: TObject);
Function SumbuX(LojikX:Double):Integer;
begin
result:=Round(LojikX + 400);
end;
Function SumbuY(LojikY:Double):Integer;
begin
result:=Round(160 - LojikY);
end;
var i:real;
begin
with image1.Canvas do
begin
pen.Width:=10;
font.Size:=9;
font.Color:=clolive;
i:=-200;
while i<=200 do
begin
Pixels[sumbuX(i),sumbuY(150-(80*Sin(i*2*3.14/200)))]:=clolive;
i:=i+0.03;
TextOut(sumbuX(-120),sumbuY(120),'y = 2 - sin x');
end;
end;
end;
y = x^2
procedure TGrafik.Button2Click(Sender: TObject);
Function CanvasX(LojikX:Double):Integer;
begin
result:=Round(LojikX + 400);
end;
Function CanvasY(LojikY:Double):Integer;
begin
result:=Round(160-LojikY);
end;
var
i: real;
begin
with image1.canvas do
begin
i:=-200;
while i <= 200 do
begin
pen.Width:=10;
font.size:=9;
font.Color:=clred;font.size:=7;
pixels[canvasx(5*i),canvasy(i*i)]:=clred;
i:=i+0.03;
textout(canvasx(-115),canvasy(150),'y=x^2');
end;
end;
end;
y = 2 + tan x
procedure TGrafik.Button6Click(Sender: TObject);
Function SumbuX(LojikX:Double):Integer;
begin
result:=Round(LojikX + 400);
end;
Function SumbuY(LojikY:Double):Integer;
begin
result:=Round(160 - LojikY);
end;
var i:real;
begin
with image1.Canvas do
begin
pen.Width:=10;
font.Size:=9;
font.Color:=clyellow;
i:=-200;
while i<=200 do
begin
Pixels[sumbuX(i),sumbuY(150+(20*((sin(i*2*3.14/200))/cos(i*2*3.14/200))))]:=clyellow;
i:=i+0.03;
TextOut(sumbuX(50),sumbuY(20),'y = 2 + tan x');
end;
end;
end;
Sabtu, 19 November 2016
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar