Minimum/Maximum einer Reihe von Werten bestimmen
Verfasst: 29.06.2021 20:57
Ich hab ein paar Koordinaten (4 an der Zahl), von denen jeweils die Minimum-/Maximum-Werte bestimmt werden sollen:
Gibt es da vielleicht eine effizientere Möglichkeit?
Code: Alles auswählen
Structure Rechteck
left.l
right.l
top.l
bottom.l
EndStructure
Define a.POINT,b.POINT,c.POINT,d.POINT,max.Rechteck
;Schleife
;Koordinatenermittlung
If a\x<max\left:max\left=a\x:ElseIf a\x>max\right:max\right=a\x:EndIf
If b\x<max\left:max\left=b\x:ElseIf b\x>max\right:max\right=b\x:EndIf
If c\x<max\left:max\left=c\x:ElseIf c\x>max\right:max\right=c\x:EndIf
If d\x<max\left:max\left=d\x:ElseIf d\x>max\right:max\right=d\x:EndIf
If a\y<max\top:max\top=a\y:ElseIf a\y>max\bottom:max\bottom=a\y:EndIf
If b\y<max\top:max\top=b\y:ElseIf b\y>max\bottom:max\bottom=b\y:EndIf
If c\y<max\top:max\top=c\y:ElseIf c\y>max\bottom:max\bottom=c\y:EndIf
If d\y<max\top:max\top=d\y:ElseIf d\y>max\bottom:max\bottom=d\y:EndIf
;Schleife Ende
;Weiterverarbeitung