Autor Beitrag
hibbert
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Mo 13.02.06 19:06 
Hi,
ich habe eine kleine Mathematische Frage:
Ich habe ein Koordinatensystem, mit 3 Achsen (x,y,z). In dieses System ist ein Haus gezeichnet. Nun möchte ich dieses haus gerne in ein 2D Koordinatensystem einzeichnen. Mit Papier, Geodreieck und Bleistift kein Problem.
Aber es muss doch eine Möglichkeit geben, die Koordinaten der einzelen Punkte auszurechnen, ich meine das was man in der Mathematik Zeichnen kann, kann man auch rechnen :wink:

Kann mir einer weiterhelfen ?

thx hibbert

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mo 13.02.06 20:03 
Tja Vektorrechnung. Eine Ebene in den Raum weiß ich ja noch aber einen Raum in eine Ebene *uff*
Das ist ja dann ein Mini 3D Programm/Renderer.

Wäre DirectX/OpenGL nicht einfacher?
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mo 13.02.06 20:27 
Ich hab so was vor n Paar Wochen ma aus Spaß geproggt:

ausblenden Delphi-Quelltext
1:
2:
ScreenX:=x*power(0.9,z);
ScreenY:=Y*power(0.9,z);

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Mo 13.02.06 20:27 
user profile icondigi_c hat folgendes geschrieben:
Wäre DirectX/OpenGL nicht einfacher?


Mein Lehrer sagt, wir dürfen kein OpenGL bzw DirectX benutzen. Also nicht das es jetzt wer falsch versteht:
ich suche nicht, wie man das mit Delphi rechnet, wenn es einer hat auch gut :wink:, mir geht es eigentlich nur um den Mathematischen Rechenweg.

hibbert
[Edit]
user profile iconjakobwenzel hat folgendes geschrieben:
Ich hab so was vor n Paar Wochen ma aus Spaß geproggt:

ausblenden Delphi-Quelltext
1:
2:
ScreenX:=x*power(0.9,z);
ScreenY:=Y*power(0.9,z);


mhh wäre cool, wenn ich die Variablen noch genauer kennenlernen würde :wink:

[/edit]

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mo 13.02.06 20:31 
ScreenX und ScreenY sind die Koordinaten am Bildschirm, X, Y und Z sind die Koordinaten im 3D-Raum.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 13.02.06 21:09 
Hilbert's Berechnung ist eine perspektivische ...

Ohne Perspektive (so wie Du's z.B. auf'm Papier zeichnest) geht's mit:

ausblenden Delphi-Quelltext
1:
2:
ScreenX := x + cos(Pi / 4) * z;
ScreenY := x + sin(Pi / 4) * z;

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Mo 13.02.06 23:59 
Hi,
also machen wir mal ein kleines Beispiel:
P1(5/7/-5)
Diesen Punkt habe ich in das 3D-System eingezeichnet.
Dann habe ich die 3-Achse ignoriert, schon habe ich ein 2D-System.
Nun habe ich die Punkte hierfür abgelesen. Das Ergebnis:
P2(7.5/2.5)
Rechne ich nun nach der Formel
Formel hat folgendes geschrieben:
ScreenX := x + cos(Pi / 4) * z;
ScreenY := x + sin(Pi / 4) * z;

Sieht die Formel so aus:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
X3 = x + cos(Pi / 4) * z;
X3 = 5 + cos(Pi / 4) * (-5)
X3 = 4.69 * 10^(-4)
Y3 = x + sin(Pi / 4) * z
Y3 = 5 + sin(Pi / 4) * (-5)
Y3 = 4.93


Eigentlich sollten die Ergebnis Deckungsgleich sein, oder habe ich nur einen dummen Gedankenfehler gemacht ?

hibbert

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
Tilo
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1098
Erhaltene Danke: 13

Win7 geg. WInXP oder sogar Win98
Rad2007
BeitragVerfasst: Di 14.02.06 08:08 
Achtung!
bei cos(pi/4) muss Du in rad Rechnen!
dann sieh das ganze so aus:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
X3 = x + cos(Pi / 4) * z;
X3 = 5 + cos(Pi / 4) * (-5)
X3 = 1.46
Y3 = x + sin(Pi / 4) * z
Y3 = 5 + sin(Pi / 4) * (-5)
Y3 = 1.46


sin(pi/4)=cos(pi/4)

[edit]
Ich habe mich nochmal hingesetzt.
Mein 3D Koordinatensystem hat die z-Achse nach oben, y-Achse nach rechts und die x-Achse im 135° Winkel zur y-Achse nach unten links(jeweils positive Richtung). Einheit ist bei allen Achsen 1cm.
Meine Screenx ist die Horizontale und SreenY die Vertikale. Koordinatenursprung ist bei beiden systemen links unten.

Meine Umrechnug sieht dann so aus:
ausblenden Quelltext
1:
2:
ScreenX=y+cos(3/4*pi)*x
ScreenY=z-sin(3/4*pi)*x


für den Punkt P1(5/7/-5) ergibt sich:
gemessen (3.5/-8.5)
gerechnet:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
ScreenX=y+cos(3/4*pi)*x
ScreenX=7+cos(3/4*pi)*5
ScreenX=3.46
ScreenY=z-sin(3/4*pi)*x
ScreenY=(-5)-sin(3/4*pi)*5
ScreenY=-8.535


Anmerkung +cos(3/4*pi)= -cos(pi/4)

Sorry kleiner Denkfehler meinerseits bei ScreenY. Fiel leider bei 135° nicht auf.

[/edit]