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: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193:
| procedure TForm1.Button8Click(Sender: TObject);var zoom,b,c:integer; combobox5:boolean; y,x,sw,sh,th,a,v,vt,h,tw,r,s:real; begin
try try
v:=strtofloat(edit20.text); h:=strtofloat(edit41.text); a:=strtofloat(edit21.text); zoom:=strtoint(edit22.text); b:=strtoint(edit25.text); c:=strtoint(edit26.text); if RadioGroup2.Itemindex=0 then begin cw:=1.05; end; if RadioGroup2.Itemindex=1 then begin cw:=1.06 end; if RadioGroup2.Itemindex=2 then begin cw:=1.08 end; if RadioGroup2.Itemindex=3 then begin cw:=1.1 end; if RadioGroup2.Itemindex=4 then begin cw:=1.15 end; if RadioGroup2.Itemindex=5 then begin cw:=1.2 end;
if v=0 then begin showmessage('v0 muss größer als 0 sein!'); end; if a=0 then begin showmessage('Alpha muss größer als 0 sein!'); end; if a>90 then begin showmessage('Alpha muss kleiner als 90 sein!'); end;
th:=(v*sin(a))/9.81; sw:=((sqr(v)*sin(2*a))/9.81)+h;
if tan(a)<0 then begin if cos(a)<0 then begin showmessage('Da tan(alpha) und oder cos(alpha) negativ sind,'#10#13'ist die Bahnkurve im 2. Quadranten!'); end; end;
x :=-1000; Repeat y :=-c; image3.Canvas.Pixels [round(x),round(-y)]:= clblack; x := x + 0.01; Until x >1000;
y :=-1000; Repeat x :=b; image3.Canvas.Pixels [round(x),round(-y)]:= clblack; y:= y + 0.01; Until y>1000;
if checkbox2.checked=false then begin
x :=-1000; Repeat
y :=((tan(a)*x)-(9.81/(2*(sqr(v))*(sqr(cos(a))))*sqr(x))+h); image3.Canvas.Pixels [round(b+(x*zoom)),round(c+(-y*zoom))]:= clblue;
if tan(a)<0 then begin if cos(a)<0 then begin y :=((tan(a)*x-(9.81/(2*sqr(v)*sqr(cos(a)))*sqr(x))+h)); image3.Canvas.Pixels [round(b+(x*zoom)),round(c+(-y*zoom))]:= clblue; end; end;
x := x + 0.01; Until x > 1000;
x :=-1000; Repeat y :=-c+((h+((sqr(tan(a)))/(4*(9.81/(2*sqr(v)*sqr(cos(a)))))))*Zoom); image3.Canvas.Pixels [round(x),round(-y)]:= clsilver; x := x + 0.01; Until x >1000;
y :=-1000; Repeat x:=b+(((tan(a))/(2*((9.81)/(2*sqr(v)*sqr(cos(a))))))*Zoom); image3.Canvas.Pixels [round(x),round(-y)]:= clsilver; y:= y + 0.01; Until y>1000;
y :=-1000; Repeat x:=b+(sw*Zoom);image3.Canvas.Pixels [round(x),round(-y)]:= clsilver; y:= y + 0.01; Until y>1000; end;
if checkbox1.checked=true then begin flag:=SND_ASYNC; sndPlaySound(nil,flag) end
else begin flag:=SND_ASYNC; sndPlaySound(PChar('explode.wav'),flag); end;
sh:=((sqr(v)*sqr(sin(a)))/(2*9.81))+h; th:=(v*sin(a))/9.81; tw:=2*th; vt:=(v-9.81)*3.6;
label15.caption:=floattostrf(sw,fffixed,6,3); label16.caption:=floattostrf(sh,fffixed,6,3); label17.caption:=floattostrf(th,fffixed,6,3); label18.caption:=floattostrf(tw,fffixed,6,3); label43.caption:=floattostrf(vt,fffixed,6,3);
if checkbox2.checked=true then begin x:=-1000; Repeat y:=tan(a)*x-(9.81/(2*sqr(v)*sqr(cos(a)))*sqr(cw*x))+h; image3.Canvas.Pixels [round(b+(x*zoom)),round(c+(-y*zoom))]:= clred; x := x + 0.01; Until x > 1000; end;
if checkbox1.checked=true then begin flag:=SND_ASYNC; sndPlaySound(nil,flag) end
else begin flag:=SND_ASYNC; sndPlaySound(PChar('explode.wav'),flag); end;
except on E: econverterror do showmessage('Werte eingeben!'); end; except on E:ezerodivide do showmessage ('Division durch 0 ist nicht definiert!'); end; end; |