Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Centroid Question
#12
Then expanded to include calculation of the center of gravity - height of the triangle unknown. The calculation should be correct, but probably not for all shapes of triangles.
Polygon is too complicated for me now. Now I need a good glass of wine first.  Tongue

Code: (Select All)

'Berechnung des Inkreismittelpunktes und des Schwerpunkts eines Dreiecks - 14. Juli 2024
'https://www.biancahoegel.de/geometrie/ebene/inkreis.html
'Mathematik 2 Geometrie S.98ff, 106, 108

Option _Explicit

'ad, bd, cd Seiten eines Dreiecks, AF = Flaecheninhalt, s = Umfang
Dim As Double AF, ad, bd, cd, s, radius, dummy
Dim As Double xAchse, yAchse, hoeheDreieck

Locate 2, 3
Print "Berechnung des Inkreismittelpunktes und des Schwerpunkts eines Dreiecks"
Locate 3, 3
Print "======================================================================="

Locate 5, 3
Input "Laenge der Seite a in cm: ", ad
Locate 6, 3
Input "Laenge der Seite b in cm: ", bd
Locate 7, 3
Input "Laenge der Seite c in cm: ", cd

s = (ad + bd + cd) / 2
dummy = s * ((s - ad) * (s - bd) * (s - cd))
AF = Sqr(dummy)

'Der Radius ist von allen Seiten des Dreiecks gleich weit entfernt,
'und zeigt somit den Inkreismittelpunkt an.
radius = (2 * AF) / (ad + bd + cd)

Locate 9, 3
Print Using "Der Inkreismittelpunkt des gegebenen Dreiecks liegt bei ###.## cm."; radius

'Schwerpunkt des Dreiecks unbekanter Hoehe
'Erst die Hoehe berechnen  - s und dummy bleiben
hoeheDreieck = (2 / cd) * Sqr(dummy)

'X-Achse und Y-Achse berechnen
xAchse = (2 / 3) * ad
yAchse = (1 / 3) * hoeheDreieck

Locate 11, 3
Print "Der Schwerpunkt des Dreiecks liegt:"
Locate 12, 3
Print Using "Bei der X-Achse bei ###.## cm - bei Y-Achse bei ###.## cm"; xAchse, yAchse


'Bild anzeigen
_Clipboard$ = "Inkreis+SchwerpDreieck.jpg"
Shell "BildAnzeigen.exe"

End

[Image: Inkreis-Schwerpunkt-Dreieck.jpg]
Reply


Messages In This Thread
Centroid Question - by TerryRitchie - 07-13-2024, 06:00 PM
RE: Centroid Question - by Pete - 07-13-2024, 06:26 PM
RE: Centroid Question - by bplus - 07-13-2024, 07:58 PM
RE: Centroid Question - by TerryRitchie - 07-13-2024, 09:20 PM
RE: Centroid Question - by Pete - 07-13-2024, 09:44 PM
RE: Centroid Question - by justsomeguy - 07-13-2024, 11:56 PM
RE: Centroid Question - by bplus - 07-14-2024, 12:00 AM
RE: Centroid Question - by aadityap0901 - 07-14-2024, 06:14 AM
RE: Centroid Question - by TerryRitchie - 07-14-2024, 01:14 PM
RE: Centroid Question - by Kernelpanic - 07-14-2024, 01:11 PM
RE: Centroid Question - by bplus - 07-14-2024, 03:42 PM
RE: Centroid Question - by Kernelpanic - 07-14-2024, 06:24 PM
RE: Centroid Question - by bplus - 07-14-2024, 06:55 PM
RE: Centroid Question - by Kernelpanic - 07-15-2024, 03:07 PM
RE: Centroid Question - by Pete - 07-14-2024, 07:15 PM
RE: Centroid Question - by vince - 07-15-2024, 03:46 AM
RE: Centroid Question - by bplus - 07-15-2024, 01:02 PM
RE: Centroid Question - by Pete - 07-16-2024, 12:33 AM



Users browsing this thread: 3 Guest(s)