Autor Beitrag
T1g3r
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Di 26.04.05 14:28 
:?: :?: :?:

Hi

ich will ein rechtwinkliges Dreieck in ein canvas zeichnen wo gamma = 90° ist.
ich habe a,b,c,q,p,hr als seiten des dreiecks!!
plz helft mir ich schaff es net :(

mfg Michel

Moderiert von user profile iconChristian S.: Titel geändert
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 26.04.05 14:32 
:welcome: im DF!!! :D

user profile iconT1g3r hat folgendes geschrieben:
ich habe a,b,c,q,p,hr als seiten des dreiecks!!

Was ist hr? Meinst du hc? :gruebel:
Tobias1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 454

Win 98, XP Prof
D3 Prof, D2005 Prof
BeitragVerfasst: Di 26.04.05 14:55 
Moveto(x,y)
Lineto(x,y)

_________________
Auch das schlechteste Buch hat seine gute Seite: die letzte. (John Osborne)
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 26.04.05 14:57 
Nun ja. Wenn du sie in cm bekommst, dann musst du's natürlich noch in px umrechnen. ;) Da gab's letztens hier im DF nen Thread. Einfach mal die Forensuchen benutzen.

Ansonsten sind das einfach LE. :lol:
Tobias1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 454

Win 98, XP Prof
D3 Prof, D2005 Prof
BeitragVerfasst: Di 26.04.05 15:01 
Ist ja eigentlich recht einfach p+q ist ja c.
Du gehst einfacg von A qEinheiten nach links danach um h Einheiten nach oben dann gehst du wieder nach A
Die andere Seite geht genauso.

_________________
Auch das schlechteste Buch hat seine gute Seite: die letzte. (John Osborne)
T1g3r Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Di 26.04.05 15:07 
hi hab mich verschrieben ich meine mit hr natürlich hc
ich hab es schon versucht einfack die strecken zu zeichnen mit canvas.lineto aber da kommen immer lücken und so
gibt es noch ne andere lösung??

thx für die schnelle antworten

mfg Michel
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 26.04.05 15:19 
Ist das angehängte Programm ungefähr das, was du möchtest?
Einloggen, um Attachments anzusehen!
T1g3r Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Di 26.04.05 15:31 
:D :D :D :D :D
ja des ist es so ungefähr
mein prog rechnet ja die seiten von dem dreieck aus und da kommt ja ab und zu kommastellen raus geht des wenn ich dann bis auf 2 nachkommerstellen runde und mal 100 nehme und die länge nehme?
Kann des sein des die lücken in meinen dreieck durch das runden kommt???

mfg Michel
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 26.04.05 15:32 
Öhm... Wieso Kommastellen? Nimm doch gleich Integer. Wenn du mit Canvas arbeitest musst du sowieso Ganzzahlen nehmen. ;)
T1g3r Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Di 26.04.05 15:36 
stimmt schon aber ich will nach meiner rechnung die ergebnisse als eine kommazahl sehen deshalb hab ich real
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 26.04.05 15:48 
Du willst also einen Kommawert eingeben? Dann würde ich dir empfehlen, maximal 2 Dezimalstellen zuzulassen und dann am Ende einfach mit 100 zu multiplizieren. Dann hast du keine Ungereimtheiten bei Canvas. ;) Und reinpassen tut's bei ner Auflösung von 1024*768 eigentlich immer noch. Außer du hast Werte von 18,7 oder so... :lol:
T1g3r Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Di 26.04.05 16:02 
ich denk mal nicht :D
ich probiers mal aus.
auf jedenfall vielen dank fü die schnelle hilfe. Wenn es dann nicht klappt dannn frag ich wieder :lol:

mfg Michel
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 26.04.05 16:09 
Was ich mir noch überlegt hab: Wenn Gamma immer 90° haben soll, dann machst du einfach ne Abfrage rein, ob p*q=h². Weil wenn das nicht stimmt, dann haste kein Rechtwinkliges Dreieck. ;)
T1g3r Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Di 26.04.05 16:11 
klappt immer noch nicht keine ahnung warum nicht plz guck du mal
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 26.04.05 16:14 
:lol: Das Programm blick ich ehrlichgesagt nicht so. Muss ich erst passende Werte für a,b,c,p,q und hc finden, damit das geht? :lol:
T1g3r Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Di 26.04.05 16:19 
man muss 2 seitenlängen angeben und dann berechnet das prog die restlichen seiten (knopf berechnen) und dann muss man auf zeichnen gehen und des dreieck sollt gezeichnet werden.
ich machs immer mit
a = 3
b = 4
c = 5
hc = 2,4
q = 3,2
p = 1,8

und wenn ich dann auf zeichnen geh ist da immer noch so en stück von c zu lang
T1g3r Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Di 26.04.05 16:20 
der kommentar ist nut der weg wie es gezeichntet werden sollte
ich denk mal der weg ist richtig oder? :?
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 26.04.05 16:22 
Hmm. Kannst du vielleicht einfach mal den Code psoten? Einfach in die Delphi-Tags rein. ;)
T1g3r Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Di 26.04.05 16:32 
da hab ich mein prog :D

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:
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:
procedure TForm1.BBerechneClick(Sender: TObject);
Var
  a,b,c,p,q,h : real;
  fehler : Integer;
  aa,ab,ac,aq,ap,ah : string;
begin
//////Eingabe\\\\\\
  Val(eea.text,a,Fehler);
  Val(eeb.text,b,Fehler);
  Val(eec.text,c,Fehler);
  Val(eeq.text,q,Fehler);
  Val(eep.text,p,Fehler);
  Val(eeh.text,h,Fehler);
//////Rechnung \\\\\\
// a und b
  if (a >0) and (b > 0) then
    begin
      c := sqrt(a*a+b*b);
      q := (b*b)/c;
      p := (a*a)/c;
      h := sqrt(a*a-p*p);
    end;
// a und c
  if (a > 0) and (c > 0) then
    begin
      b := sqrt(c*c-a*a);
      q := (b*b)/c;
      p := (a*a)/c;
      h := sqrt(a*a-p*p);
    end;
// c und b
  if (b > 0) and (c > 0) then
    begin
      a := sqrt(c*c-b*b);
      q := (b*b)/c;
      p := (a*a)/c;
      h := sqrt(a*a-p*p);
    end;
// c und q
  if (c > 0) and (q > 0) then
    begin
      p := c-q;
      a := sqrt(c*p);
      b := sqrt(c*q);
      h := sqrt(a*a-p*p);
    end;
// c und p
  if (c > 0) and (p > 0) then
    begin
      q := c-p;
      a := sqrt(c*p);
      b := sqrt(c*q);
      h := sqrt(a*a-p*p);
    end;
// p und q
  if (q > 0) and (p > 0) then
    begin
      c := q + p;
      a := sqrt(c*p);
      b := sqrt(c*q);
      h := sqrt(a*a-p*p);
    end;
// p und a
  if (a > 0) and (p > 0) then
    begin
      h := sqrt(a*a-p*p);
      c := (a*a)/p;
      q := c-p;
      b := sqrt(c*c-a*a);
    end;
// b und q
  if (b > 0) and (q > 0) then
    begin
     h := sqrt(b*b-q*q);
     c := (b*b)/q;
     p := c-q;
     a := sqrt(c*c-b*b);
    end;
// h und a
  if (a > 0) and (h > 0) then
    begin
      p := sqrt(a*a-h*h);
      c := (a*a)/p;
      q := c-p;
      b := sqrt(c*c-a*a);
    end;
// h und b
  if (b > 0) and (h > 0) then
    begin
      q := sqrt(b*b-h*h);
      c := (b*b)/q;
      p := c-q;
      a := sqrt(c*c-b*b);
    end;
// h und p
  if (p > 0) and (h > 0) then
    begin
      a := sqrt(p*p+h*h);
      c := (a*a)/p;
      b := sqrt(c*c-a*a);
      q := c-p;
    end;
// h und q
  if (q > 0) and (h > 0) then
    begin
      b := sqrt(q*q+h*h);
      c := (b*b)/q;
      a := sqrt(c*c-b*b);
      p := c-q;
    end;
// c und h
  if (c > 0) and (h > 0) then
    begin
      a := (c*h)/4;
      b := sqrt(c*c-a*a);
      p := sqrt(a*a-h*h);
      q := sqrt(b*b-h*h);
    end;
//////Ausgabe\\\\\\
  str(a:3:2,aa);        //a\\
  eaa.Text := aa;
  str(b:3:2,ab);        //b\\
  eab.Text := ab;
  str(c:3:2,ac);        //c\\
  eac.Text := ac;
  str(p:3:2,ap);        //p\\
  eap.Text := ap;
  str(q:3:2,aq);        //q\\
  eaq.Text := aq;
  str(h:3:2,ah);        //h\\
  eah.Text := ah;
end;

procedure TForm1.BClearClick(Sender: TObject);
begin
image1.Canvas.Rectangle(0,0,650,650);
eea.text := '';
eeb.text := '';
eec.text := '';
eeh.text := '';
eeq.text := '';
eep.text := '';
eaa.text := '';
eab.text := '';
eac.text := '';
eah.text := '';
eaq.text := '';
eap.text := '';




end;

procedure TForm1.FormCreate(Sender: TObject);
begin
image1.canvas.Create;
image1.canvas.Rectangle(0,0,650,650);
end;
//// Zeichnen \\\\
procedure TForm1.BzeichnenClick(Sender: TObject);
Var
  ar,br,cr,hr,qr,pr,fehler,x,y : integer;
begin
  Val(eaa.text,ar,Fehler);
  Val(eab.text,br,Fehler);
  Val(eac.text,cr,Fehler);
  Val(eah.text,hr,Fehler);
  Val(eap.text,pr,Fehler);
  Val(eaq.text,qr,Fehler);
  ar := ar*100;
  br := br*100;
  cr := cr*100;
  hr := hr*100;
  pr := pr*100;
  qr := qr*100;
  x := 25;
  y := 625;
  image1.Canvas.MoveTo(x,y);
  image1.Canvas.LineTo(x+qr,y-hr);
  x := x+qr;
  y := y-hr;
  image1.Canvas.LineTo(x+pr,y+hr);
  x := 25;
  y := 625;
  image1.Canvas.moveto(x,y);
  image1.Canvas.lineto(x+cr,y);
end;


ich hoff des net zuviel obe sind die rchnungen und unten wie ichs zeichne

Moderiert von user profile iconChristian S.: Beiträge zusammengefasst
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 26.04.05 17:03 
Schau dir mal meinen Zeichnen-Code an:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
Form1.Image1.Canvas.MoveTo(XWert, YWert);
Form1.Image1.Canvas.LineTo(XWert+laenge_q+laenge_p, YWert);
Form1.Image1.Canvas.MoveTo(XWert+laenge_q, YWert-hoehe);
Form1.Image1.Canvas.LineTo(XWert, YWert);
Form1.Image1.Canvas.MoveTo(XWert+laenge_q, YWert-hoehe);
Form1.Image1.Canvas.LineTo(XWert+laenge_q+laenge_p, YWert);


XWert :arrow: X-Wert von dem Punkt, wo der Benutzer hingeklickt hat.
YWert :arrow: Y-Wert von dem Punkt, wo der Benutzer hingeklickt hat.
laenge_q :arrow: Länge von q
laenge_p :arrow: Länge von p
hoehe :arrow: Höhe von dem Dreieck, also hc

;)