AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Formelfindung

Ein Thema von Maximus · begonnen am 18. Apr 2005 · letzter Beitrag vom 18. Apr 2005
 
Maximus

Registriert seit: 26. Okt 2003
169 Beiträge
 
#5

Re: Formelfindung

  Alt 18. Apr 2005, 18:57
Ich glaub eher nicht das ein Fehler in der Formel steckt, da es bei normalen Werten (Gofball + Luft/Erde) ohne Probleme funktioniert.

Aber trotzdem mal den kompletten Code

Delphi-Quellcode:
type
 TBallEngine = class
 private
   vorz_vw : Integer;
   Breite, Hoehe: Integer;
 public
   V : Extended;
   W : Extended;
   G : Extended;
   E : Extended;
   K : Extended;
   Vw : Extended;
   Vx : Extended;
   Vy : Extended;
   Tau : Extended;
   X : Extended;
   Y : Extended;

   function Set_K(ro, r, m, cw: Extended) : Extended;
   procedure Init(valueX, valueY: Extended; B, H: Integer);
   procedure Move;
 end;

implementation

function TBallEngine.Set_K(ro, r, m, cw: Extended) : Extended;
begin
 Result := cw * Pi * ro * r * r / (2*m);
end;

procedure TBallEngine.Init(valueX, valueY: Extended; B, H: Integer);
begin
 W := W * PI / 180;
 Vx := v * cos(w);
 Vy := v * sin(w);

 if vw < 0 then
  vorz_vw := -1
 else
  vorz_vw := 1;

 X := valueX;
 Y := valueY;
 Breite := B;
 Hoehe := H;
end;

procedure TBallEngine.Move;
var aw, ax, ay, lookX, lookY: Extended;
    vor_vx, vor_vy: Integer;
begin
 lookX := x + vx * tau;
 lookY := y + vy * tau;

 if (lookX > 700-Breite) or (lookX < 0) then vx := -e * vx;
 if (lookY > 300) or (lookY < Hoehe) then vy := -e * vy;

 if x < 0 then x := 0;
 if x > 700-Breite then x := 700-Breite;
 if y < Hoehe then y := Hoehe;
 if y > 300 then y := 300;

 aw := k * vw * vw;
 ax := k * vx * vx;
 ay := k * vy * vy;

 if vx < 0 then vor_vx := 1 else vor_vx := -1;
 if vy < 0 then vor_vy := 1 else vor_vy := -1;

 vx := vx + vorz_vw * aw * tau + vor_vx * ax * tau;
 vy := vy - g * tau + vor_vy * ay * tau;

 x := x + vx * tau;
 y := y + vy * tau;
end;
MFG
Maximus
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:17 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz