Autor Beitrag
Sylvus
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 195



BeitragVerfasst: Sa 19.12.09 16:22 
Hi Leute, ich würde gerne X und Y Punkte auf einem Kreis berechnen. Ich kenne den Mittelpunkt und auch den Radius.
Jetzt gibt es ja folgende Kreisgleichung:
ausblenden Quelltext
1:
r² = (x-Mx)² + (y-My)²					

Ich hab r,Mx und My gegeben. Ich könnte jetzt also eigentlich zu einem X ein passendes Y berechnen.
Mein Problem ist, wie ich das umsetzte.
Ich müsste das ganze nach Y-Auflösen, aber das schaffe ich nicht:

ausblenden Quelltext
1:
2:
3:
4:
r² = (x-Mb)² + (y-Ma)²
r² - (x-Mb)² = (y-Ma)² = y²-2*Ma*Y+Ma²
r² - (x-Mb)² - Ma² = y²-2*Ma*Y
0 = y²-2*Ma*Y - r² + (x-Mb)² + Ma²


und nun p-q Formel??

ausblenden Quelltext
1:
2:
Y1,Y2 = Ma +- SQRT(MA² + r² - (x-Mb)² - Ma²)
Y1,Y2 = Ma +- SQRT(r² - (x-Mb)²)


Wäre das alles richtig?
Vielen Dank
bis dann Sylvus


Zuletzt bearbeitet von Sylvus am Sa 19.12.09 16:32, insgesamt 2-mal bearbeitet
jfheins
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 918
Erhaltene Danke: 158

Win 10
VS 2013, VS2015
BeitragVerfasst: Sa 19.12.09 16:29 
y = My +- sqrt(r^2 - (x-Mx)^2)

Beachte das +- ;)
Sylvus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 195



BeitragVerfasst: Sa 19.12.09 16:31 
super :) deckt sich mit meiner Lösung grad eben^^

DANKE, dann bau ich das gleich mal so ein!
Vielen Dank!

Bis bald
Niko S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Sa 19.12.09 16:34 
Wäre das nicht einfacher mit Vektoren zu lösen?
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Sa 19.12.09 16:41 
user profile iconSylvus hat folgendes geschrieben Zum zitierten Posting springen:
Ich müsste das ganze nach Y-Auflösen, aber das schaffe ich nicht:

ausblenden Quelltext
1:
2:
3:
4:
r² = (x-Mb)² + (y-Ma)²
r² - (x-Mb)² = (y-Ma)² = y²-2*Ma*Y+Ma²
r² - (x-Mb)² - Ma² = y²-2*Ma*Y
0 = y²-2*Ma*Y - r² + (x-Mb)² + Ma²


Quadratische Ergänzung.

Zitat:
Wäre das nicht einfacher mit Vektoren zu lösen?


Dann würde man doch am Ende auch nichts anderes rechnen, oder?
Niko S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Sa 19.12.09 16:43 
Stimmt, ich hab gerade an was anderes gedacht..
Ne dann passt das doch.
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Sa 19.12.09 18:38 
Hi :)

Vektorrechnung und Lineare Algebra ist eigentlich immer exakt die selbe Rechnung. Es ist nur meißtens einfacher zu schreiben(was oft auch schon was wert ist), da Variablen(xM, yM, ..) neu gruppiert werden können. Daraus ergibt sich dann beim Menschen eine einfachere Rechnung, weil weniger Assoziationen auftauchen. Im Computer braucht man dann aber Objekte statt einfachen 32Bit-Integerspeicher, was das ganze imho nur verlangsamen kann.

Der Zweig der Objektorientierten Programmierung zeigt aber, dass oftmals nicht die Laufzeit des Programms, sondern die Entwicklungszeit minimiert werden soll.

mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Sa 19.12.09 20:05 
Man könnte auch einfach Sinus und Cosinus nutzen, oder für höchste Performance nach Bresenham zeichnen.
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Sa 19.12.09 20:10 
user profile iconBoldar hat folgendes geschrieben Zum zitierten Posting springen:
Man könnte auch einfach Sinus und Cosinus nutzen, oder für höchste Performance nach Bresenham zeichnen.
D.h.? StretchDraw eines Ausgangskreises für beliebige Ellipsen wäre auch möglich(wenn es nicht das ist^^).

mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)
Sylvus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 195



BeitragVerfasst: Sa 19.12.09 20:10 
hehe habs im Endeffekt sogar mit sin und cos gemacht :) Sonst traten bei mir immer Fehler auf, weil ich Punkte in gleichmäßigen Abstand berechnen wollte...
Also ja geht auch mit Sin und Cos!