Autor Beitrag
schnulli!!!
Hält's aus hier
Beiträge: 7


Delphi3
BeitragVerfasst: Di 21.11.06 15:02 
also hier sagt der mir das da nen fehler bei ner fließkommaoperation is aber ich find keinen


ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
unit Bilard;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Label1: TLabel;
    Label2: TLabel;
    Timer1: TTimer;
    Image2: TImage;
    Image3: TImage;
    Image4: TImage;
    Image5: TImage;
    Image6: TImage;
    procedure FormClick(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormClick(Sender: TObject);
var
   p: Tpoint;
begin
  GetCursorPos(P);
  Label1.Caption := IntToStr(P.X);
  Label2.Caption := IntToStr(P.Y);
  timer1.enabled := true;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
   x,y,stepy,a:integer;
begin
     x:= StrToInt(label1.caption);
     y:= StrToInt(label2.caption);
     a:= round(sqrt(x*x+y*y)/x-200);
     stepy:= round(sqrt(a*a-x*x));
     image1.top:= image1.top+stepy;
     image1.left:= image1.left+1;
end;
end.



Moderiert von user profile iconUGrohne: Topic aus Algorithmen, Optimierung und Assembler verschoben am Di 21.11.2006 um 15:37
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 21.11.06 15:23 
Problematische Stellen sind markiert:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.Timer1Timer(Sender: TObject);
var
   x,y,stepy,a:integer;
begin
     x:= StrToInt(label1.caption);
     y:= StrToInt(label2.caption);
     a:= round(sqrt(x*x+y*y)/x-200); 
     // Ist x <> 0 sichergestellt?

     stepy:= round(sqrt(a*a-x*x));
     // Ist das unter der Wurzel positiv, oder kann es negativ werden?

     image1.top:= image1.top+stepy;
     image1.left:= image1.left+1;
end;
end.

_________________
We are, we were and will not be.
schnulli!!! Threadstarter
Hält's aus hier
Beiträge: 7


Delphi3
BeitragVerfasst: Di 21.11.06 15:45 
ähm ja dsa hab auhc auch erst später gesehn und geändert aber dann funktioneirts auch nich