diff --git a/Geometry/Geometry.vbproj b/Geometry/Geometry.vbproj
index 29a0973..4862eca 100644
--- a/Geometry/Geometry.vbproj
+++ b/Geometry/Geometry.vbproj
@@ -114,9 +114,9 @@
VbMyResourcesResXFileCodeGenerator
- Resources.Designer.vb
My.Resources
Designer
+ Resources.Designer.vb
diff --git a/Geometry/My Project/AssemblyInfo.vb b/Geometry/My Project/AssemblyInfo.vb
index f58d255..219b5c8 100644
--- a/Geometry/My Project/AssemblyInfo.vb
+++ b/Geometry/My Project/AssemblyInfo.vb
@@ -17,6 +17,6 @@ Imports System.Runtime.InteropServices
-
-
+
+
diff --git a/Geometry/My Project/Resources.Designer.vb b/Geometry/My Project/Resources.Designer.vb
index 6fc80ea..abec2e8 100644
--- a/Geometry/My Project/Resources.Designer.vb
+++ b/Geometry/My Project/Resources.Designer.vb
@@ -14,28 +14,28 @@ Option Explicit On
Imports System
Namespace My.Resources
-
+
'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
'-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
- '''
+ '''
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
- '''
-
+ '''
+ _
Friend Module Resources
-
+
Private resourceMan As Global.System.Resources.ResourceManager
-
+
Private resourceCulture As Global.System.Globalization.CultureInfo
-
- '''
+
+ '''
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
- '''
-
+ '''
+ _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
@@ -45,19 +45,433 @@ Namespace My.Resources
Return resourceMan
End Get
End Property
-
- '''
+
+ '''
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
- '''
-
+ '''
+ _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
- resourceCulture = Value
+ resourceCulture = value
End Set
End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Kappenhöhe darf maximal 2 * Radius sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckCapHeightLimit() As String
+ Get
+ Return ResourceManager.GetString("CheckCapHeightLimit", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Fläche darf nicht negativ sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckNonNegativeArea() As String
+ Get
+ Return ResourceManager.GetString("CheckNonNegativeArea", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Der Umfang darf nicht negativ sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckNonNegativeCircumference() As String
+ Get
+ Return ResourceManager.GetString("CheckNonNegativeCircumference", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Diagonale darf nicht negativ sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckNonNegativeDiagonal() As String
+ Get
+ Return ResourceManager.GetString("CheckNonNegativeDiagonal", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Der Durchmesser darf nicht negativ sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckNonNegativeDiameter() As String
+ Get
+ Return ResourceManager.GetString("CheckNonNegativeDiameter", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Höhe darf nicht negativ sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckNonNegativeHeight() As String
+ Get
+ Return ResourceManager.GetString("CheckNonNegativeHeight", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Länge darf nicht negativ sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckNonNegativeLength() As String
+ Get
+ Return ResourceManager.GetString("CheckNonNegativeLength", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Der Radius darf nicht negativ sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckNonNegativeRadius() As String
+ Get
+ Return ResourceManager.GetString("CheckNonNegativeRadius", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Seite darf nicht negativ sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckNonNegativeSide() As String
+ Get
+ Return ResourceManager.GetString("CheckNonNegativeSide", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Das Volumen darf nicht negativ sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckNonNegativeVolume() As String
+ Get
+ Return ResourceManager.GetString("CheckNonNegativeVolume", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Breite darf nicht negativ sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckNonNegativeWidth() As String
+ Get
+ Return ResourceManager.GetString("CheckNonNegativeWidth", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Halbachsen müssen größer als Null sein (a>0, b>0). ähnelt.
+ '''
+ Friend ReadOnly Property CheckPositiveAxes() As String
+ Get
+ Return ResourceManager.GetString("CheckPositiveAxes", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Der Umfang muss grösser als Null sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckPositiveCircumference() As String
+ Get
+ Return ResourceManager.GetString("CheckPositiveCircumference", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Diagonale muss grösser als Null sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckPositiveDiagonal() As String
+ Get
+ Return ResourceManager.GetString("CheckPositiveDiagonal", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Kante muss grösser als Null sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckPositiveEdge() As String
+ Get
+ Return ResourceManager.GetString("CheckPositiveEdge", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Höhe muss grösser als Null sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckPositiveHeight() As String
+ Get
+ Return ResourceManager.GetString("CheckPositiveHeight", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Länge muss grösser als Null sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckPositiveLength() As String
+ Get
+ Return ResourceManager.GetString("CheckPositiveLength", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Der Radius muss grösser als Null sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckPositiveRadius() As String
+ Get
+ Return ResourceManager.GetString("CheckPositiveRadius", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Seite muss größer als Null sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckPositiveSide() As String
+ Get
+ Return ResourceManager.GetString("CheckPositiveSide", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Toleranz muss größer als Null sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckPositiveTolerance() As String
+ Get
+ Return ResourceManager.GetString("CheckPositiveTolerance", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Breite muss grösser als Null sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckPositiveWidth() As String
+ Get
+ Return ResourceManager.GetString("CheckPositiveWidth", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Eckpunkte dürfen nicht Nothing sein. ähnelt.
+ '''
+ Friend ReadOnly Property CheckVerticesNotNull() As String
+ Get
+ Return ResourceManager.GetString("CheckVerticesNotNull", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Sehnenlänge ist ungültig. ähnelt.
+ '''
+ Friend ReadOnly Property ChordLengthInvalid() As String
+ Get
+ Return ResourceManager.GetString("ChordLengthInvalid", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Der eingeschlossene Winkel muss zwischen Null und Pi liegen. ähnelt.
+ '''
+ Friend ReadOnly Property IncludedAngleMustBeBetweenZeroAndPi() As String
+ Get
+ Return ResourceManager.GetString("IncludedAngleMustBeBetweenZeroAndPi", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die angegebenen Seiten und Diagonalen bilden kein gültiges Parallelogramm. ähnelt.
+ '''
+ Friend ReadOnly Property InvalidParallelogramBySidesAndDiagonals() As String
+ Get
+ Return ResourceManager.GetString("InvalidParallelogramBySidesAndDiagonals", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die angegebenen Seiten bilden kein gültiges Dreieck. ähnelt.
+ '''
+ Friend ReadOnly Property InvalidTriangleSides() As String
+ Get
+ Return ResourceManager.GetString("InvalidTriangleSides", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Der Polarwinkel muss im Bereich von Null bis PI liegen. ähnelt.
+ '''
+ Friend ReadOnly Property IsPolarAngleInBounds() As String
+ Get
+ Return ResourceManager.GetString("IsPolarAngleInBounds", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Seitenanzahl muss größer oder gleich 3 sein. ähnelt.
+ '''
+ Friend ReadOnly Property RequireAtLeastThreeSides() As String
+ Get
+ Return ResourceManager.GetString("RequireAtLeastThreeSides", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Es müssen mindestens 3 Eckpunkte angegeben werden. ähnelt.
+ '''
+ Friend ReadOnly Property RequireAtLeastThreeVertices() As String
+ Get
+ Return ResourceManager.GetString("RequireAtLeastThreeVertices", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Es müssen mindestens 2 Eckpunkte angegeben werden. ähnelt.
+ '''
+ Friend ReadOnly Property RequireAtLeastTwoVertices() As String
+ Get
+ Return ResourceManager.GetString("RequireAtLeastTwoVertices", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Es müssen genau 4 Eckpunkte angegeben werden. ähnelt.
+ '''
+ Friend ReadOnly Property RequireExactlyFourVertices() As String
+ Get
+ Return ResourceManager.GetString("RequireExactlyFourVertices", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Es müssen genau 3 Eckpunkte angegeben werden. ähnelt.
+ '''
+ Friend ReadOnly Property RequireExactlyThreeVertices() As String
+ Get
+ Return ResourceManager.GetString("RequireExactlyThreeVertices", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Sehnenhöhe ist ungültig. ähnelt.
+ '''
+ Friend ReadOnly Property SagittaHeightInvalid() As String
+ Get
+ Return ResourceManager.GetString("SagittaHeightInvalid", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Seiten erfüllen die Dreiecksungleichung nicht. ähnelt.
+ '''
+ Friend ReadOnly Property String1() As String
+ Get
+ Return ResourceManager.GetString("String1", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die obere Grundlänge muss kleiner als die untere sein. ähnelt.
+ '''
+ Friend ReadOnly Property String2() As String
+ Get
+ Return ResourceManager.GetString("String2", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die obere Grundbreite muss kleiner als die untere sein. ähnelt.
+ '''
+ Friend ReadOnly Property String3() As String
+ Get
+ Return ResourceManager.GetString("String3", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die t muss im Bereich 0 bis 1 liegen. ähnelt.
+ '''
+ Friend ReadOnly Property String4() As String
+ Get
+ Return ResourceManager.GetString("String4", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Summe der Grundseiten muss größer als Null sein. ähnelt.
+ '''
+ Friend ReadOnly Property String5() As String
+ Get
+ Return ResourceManager.GetString("String5", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die Eckpunkte dürfen kein degeneriertes Polygon bilden. ähnelt.
+ '''
+ Friend ReadOnly Property String6() As String
+ Get
+ Return ResourceManager.GetString("String6", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Es müssen mindestens {0} Eckpunkte angegeben werden. ähnelt.
+ '''
+ Friend ReadOnly Property String7() As String
+ Get
+ Return ResourceManager.GetString("String7", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Der Innenradius muss kleiner als der Außenradius sein. ähnelt.
+ '''
+ Friend ReadOnly Property VerifyInnerLessThanOuter() As String
+ Get
+ Return ResourceManager.GetString("VerifyInnerLessThanOuter", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Höhenoffset muss im Bereich 0 bis Höhe liegen. ähnelt.
+ '''
+ Friend ReadOnly Property VerifyOffsetWithinHeight() As String
+ Get
+ Return ResourceManager.GetString("VerifyOffsetWithinHeight", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Umfang ist für die angegebene Seite zu klein. ähnelt.
+ '''
+ Friend ReadOnly Property VerifyPerimeterGreaterThanTwiceKnownSide() As String
+ Get
+ Return ResourceManager.GetString("VerifyPerimeterGreaterThanTwiceKnownSide", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die obere Länge muss kleiner als die untere Länge sein. ähnelt.
+ '''
+ Friend ReadOnly Property VerifyTopLengthLessThanBottom() As String
+ Get
+ Return ResourceManager.GetString("VerifyTopLengthLessThanBottom", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Der obere Radius muss kleiner als der untere Radius sein. ähnelt.
+ '''
+ Friend ReadOnly Property VerifyTopRadiusLessThanBottom() As String
+ Get
+ Return ResourceManager.GetString("VerifyTopRadiusLessThanBottom", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Zeichenfolge, die Die obere Breite muss kleiner als die untere Breite sein. ähnelt.
+ '''
+ Friend ReadOnly Property VerifyTopWidthLessThanBottom() As String
+ Get
+ Return ResourceManager.GetString("VerifyTopWidthLessThanBottom", resourceCulture)
+ End Get
+ End Property
End Module
End Namespace
diff --git a/Geometry/My Project/Resources.resx b/Geometry/My Project/Resources.resx
index af7dbeb..9c34ffe 100644
--- a/Geometry/My Project/Resources.resx
+++ b/Geometry/My Project/Resources.resx
@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
- : System.Serialization.Formatters.Binary.BinaryFormatter
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
+
@@ -68,9 +69,10 @@
-
+
+
@@ -85,9 +87,10 @@
-
+
+
@@ -109,9 +112,147 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ Die Länge muss grösser als Null sein.
+
+
+ Die Breite muss grösser als Null sein.
+
+
+ Der Durchmesser darf nicht negativ sein.
+
+
+ Die Höhe darf nicht negativ sein.
+
+
+ Die angegebenen Seiten bilden kein gültiges Dreieck.
+
+
+ Die Länge darf nicht negativ sein.
+
+
+ Der Radius muss grösser als Null sein.
+
+
+ Der Radius darf nicht negativ sein.
+
+
+ Die obere Länge muss kleiner als die untere Länge sein.
+
+
+ Die obere Breite muss kleiner als die untere Breite sein.
+
+
+ Der obere Radius muss kleiner als der untere Radius sein.
+
+
+ Die Breite darf nicht negativ sein.
+
+
+ Die Sehnenhöhe ist ungültig.
+
+
+ Die Sehnenlänge ist ungültig.
+
+
+ Die Halbachsen müssen größer als Null sein (a>0, b>0).
+
+
+ Die Diagonale darf nicht negativ sein.
+
+
+ Der Polarwinkel muss im Bereich von Null bis PI liegen.
+
+
+ Die Kappenhöhe darf maximal 2 * Radius sein.
+
+
+ Der Innenradius muss kleiner als der Außenradius sein.
+
+
+ Höhenoffset muss im Bereich 0 bis Höhe liegen.
+
+
+ Die Seite muss größer als Null sein.
+
+
+ Der Umfang darf nicht negativ sein.
+
+
+ Die Fläche darf nicht negativ sein.
+
+
+ Die Seiten erfüllen die Dreiecksungleichung nicht.
+
+
+ Die Seitenanzahl muss größer oder gleich 3 sein.
+
+
+ Die obere Grundlänge muss kleiner als die untere sein.
+
+
+ Die obere Grundbreite muss kleiner als die untere sein.
+
+
+ Das Volumen darf nicht negativ sein.
+
+
+ Die Kante muss grösser als Null sein.
+
+
+ Die Toleranz muss größer als Null sein.
+
+
+ Der Umfang muss grösser als Null sein.
+
+
+ Die Höhe muss grösser als Null sein.
+
+
+ Die Diagonale muss grösser als Null sein.
+
+
+ Die Seite darf nicht negativ sein.
+
+
+ Die Eckpunkte dürfen nicht Nothing sein.
+
+
+ Es müssen genau 4 Eckpunkte angegeben werden.
+
+
+ Der eingeschlossene Winkel muss zwischen Null und Pi liegen.
+
+
+ Es müssen mindestens 3 Eckpunkte angegeben werden.
+
+
+ Umfang ist für die angegebene Seite zu klein.
+
+
+ Die angegebenen Seiten und Diagonalen bilden kein gültiges Parallelogramm.
+
+
+ Es müssen mindestens 2 Eckpunkte angegeben werden.
+
+
+ Es müssen genau 3 Eckpunkte angegeben werden.
+
+
+ t muss im Bereich 0 bis 1 liegen.
+
+
+ Die Summe der Grundseiten muss größer als Null sein.
+
+
+ Die Eckpunkte dürfen kein degeneriertes Polygon bilden.
+
+
+ Es müssen mindestens {0} Eckpunkte angegeben werden.
+
\ No newline at end of file
diff --git a/Geometry/ThreeDimensional/Cone.vb b/Geometry/ThreeDimensional/Cone.vb
index d01d1f2..0cb65d7 100644
--- a/Geometry/ThreeDimensional/Cone.vb
+++ b/Geometry/ThreeDimensional/Cone.vb
@@ -26,8 +26,12 @@ Namespace ThreeDimensional
''' Volumen (PI * r^2 * h) / 3
Public Shared Function Volume(radius As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
Return (Math.PI * radius * radius * height) / 3.0
#Enable Warning IDE0047 ' Unnötige Klammern entfernen
@@ -41,8 +45,12 @@ Namespace ThreeDimensional
''' Schräghöhe sqrt(r^2 + h^2)
Public Shared Function SlantHeight(radius As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return Math.Sqrt((radius * radius) + (height * height))
End Function
@@ -54,8 +62,12 @@ Namespace ThreeDimensional
''' Mantelfläche PI * r * s
Public Shared Function LateralArea(radius As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return Math.PI * radius * SlantHeight(radius, height)
End Function
@@ -67,8 +79,12 @@ Namespace ThreeDimensional
''' Oberfläche PI * r * (r + s)
Public Shared Function SurfaceArea(radius As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Dim s = SlantHeight(radius, height)
Return Math.PI * radius * (radius + s)
End Function
@@ -80,7 +96,9 @@ Namespace ThreeDimensional
''' Durchmesser 2 * r
Public Shared Function DiameterFromRadius(radius As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
Return 2.0 * radius
End Function
@@ -91,7 +109,9 @@ Namespace ThreeDimensional
''' Radius d / 2
Public Shared Function RadiusFromDiameter(diameter As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If diameter < 0 Then Throw New ArgumentException("Der Durchmesser darf nicht negativ sein.", NameOf(diameter))
+ If diameter < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeDiameter, NameOf(diameter))
+ End If
Return diameter / 2.0
End Function
@@ -103,13 +123,15 @@ Namespace ThreeDimensional
''' Berechnet das Volumen eines Kegelstumpfs.
'''
''' Unterer Radius (> 0)
- ''' Oberer Radius (>= 0 und < radiusBottom)
+ ''' Oberer Radius (>= 0 und < bottomRadius)
''' Höhe (>= 0)
''' Volumen (PI * h / 3) * (R^2 + Rr + r^2)
Public Shared Function FrustumVolume(radiusBottom As Double, radiusTop As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
ValidateFrustumRadii(radiusBottom, radiusTop)
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
Return (Math.PI * height / 3.0) * ((radiusBottom * radiusBottom) + (radiusBottom * radiusTop) + (radiusTop * radiusTop))
#Enable Warning IDE0047 ' Unnötige Klammern entfernen
@@ -119,13 +141,15 @@ Namespace ThreeDimensional
''' Berechnet die Mantelfläche eines Kegelstumpfs.
'''
''' Unterer Radius (> 0)
- ''' Oberer Radius (>= 0 und < radiusBottom)
+ ''' Oberer Radius (>= 0 und < bottomRadius)
''' Höhe (>= 0)
''' Mantelfläche PI * (R + r) * s
Public Shared Function FrustumLateralArea(radiusBottom As Double, radiusTop As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
ValidateFrustumRadii(radiusBottom, radiusTop)
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Dim s = Math.Sqrt(((radiusBottom - radiusTop) * (radiusBottom - radiusTop)) + (height * height))
Return Math.PI * (radiusBottom + radiusTop) * s
End Function
@@ -134,13 +158,15 @@ Namespace ThreeDimensional
''' Berechnet die Gesamtoberfläche eines Kegelstumpfs.
'''
''' Unterer Radius (> 0)
- ''' Oberer Radius (>= 0 und < radiusBottom)
+ ''' Oberer Radius (>= 0 und < bottomRadius)
''' Höhe (>= 0)
''' Gesamtoberfläche (Mantel + beide Grundflächen)
Public Shared Function FrustumSurfaceArea(radiusBottom As Double, radiusTop As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
ValidateFrustumRadii(radiusBottom, radiusTop)
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Dim lateral = FrustumLateralArea(radiusBottom, radiusTop, height)
Dim bases = Math.PI * ((radiusBottom * radiusBottom) + (radiusTop * radiusTop))
Return lateral + bases
@@ -163,9 +189,16 @@ Namespace ThreeDimensional
''' 3D-Punkt als Tuple(X,Y,Z)
Public Shared Function PointOnLateralSurface(centerX As Double, centerY As Double, baseZ As Double, radius As Double, height As Double, angleRadians As Double, t As Double) As Tuple(Of Double, Double, Double)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
- If t < 0 OrElse t > 1 Then Throw New ArgumentException("t muss im Bereich 0 bis 1 liegen.", NameOf(t))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
+ If t < 0 OrElse t > 1 Then
+ Throw New ArgumentException(My.Resources.String4, NameOf(t))
+ End If
Dim currentRadius = radius * (1.0 - t)
Dim x = centerX + (currentRadius * Math.Cos(angleRadians))
@@ -178,11 +211,17 @@ Namespace ThreeDimensional
#Region "Validierung und interne Hilfsmethoden"
- Private Shared Sub ValidateFrustumRadii(radiusBottom As Double, radiusTop As Double)
+ Private Shared Sub ValidateFrustumRadii(bottomRadius As Double, topRadius As Double)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radiusBottom <= 0 Then Throw New ArgumentException("Der untere Radius muss größer als 0 sein.", NameOf(radiusBottom))
- If radiusTop < 0 Then Throw New ArgumentException("Der obere Radius darf nicht negativ sein.", NameOf(radiusTop))
- If radiusTop >= radiusBottom Then Throw New ArgumentException("Der obere Radius muss kleiner als der untere Radius sein.", NameOf(radiusTop))
+ If bottomRadius <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveRadius, NameOf(bottomRadius))
+ End If
+ If topRadius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(topRadius))
+ End If
+ If topRadius >= bottomRadius Then
+ Throw New ArgumentException(My.Resources.VerifyTopRadiusLessThanBottom, NameOf(topRadius))
+ End If
End Sub
#End Region
diff --git a/Geometry/ThreeDimensional/Cube.vb b/Geometry/ThreeDimensional/Cube.vb
index 935b465..ccb7db8 100644
--- a/Geometry/ThreeDimensional/Cube.vb
+++ b/Geometry/ThreeDimensional/Cube.vb
@@ -25,7 +25,9 @@ Namespace ThreeDimensional
''' Volumen side^3
Public Shared Function Volume(side As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side < 0 Then Throw New ArgumentException("Die Kantenlänge darf nicht negativ sein.", NameOf(side))
+ If side < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(side))
+ End If
Return side * side * side
End Function
@@ -36,7 +38,9 @@ Namespace ThreeDimensional
''' Oberfläche 6 * side^2
Public Shared Function SurfaceArea(side As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side < 0 Then Throw New ArgumentException("Die Kantenlänge darf nicht negativ sein.", NameOf(side))
+ If side < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(side))
+ End If
Return 6.0 * side * side
End Function
@@ -47,7 +51,9 @@ Namespace ThreeDimensional
''' Raumdiagonale side * sqrt(3)
Public Shared Function SpaceDiagonal(side As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side < 0 Then Throw New ArgumentException("Die Kantenlänge darf nicht negativ sein.", NameOf(side))
+ If side < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(side))
+ End If
Return side * Math.Sqrt(3.0)
End Function
@@ -58,7 +64,9 @@ Namespace ThreeDimensional
''' Flächendiagonale side * sqrt(2)
Public Shared Function FaceDiagonal(side As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side < 0 Then Throw New ArgumentException("Die Kantenlänge darf nicht negativ sein.", NameOf(side))
+ If side < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(side))
+ End If
Return side * Math.Sqrt(2.0)
End Function
@@ -69,7 +77,9 @@ Namespace ThreeDimensional
''' Kantenlänge cubic-root(volume)
Public Shared Function SideFromVolume(volume As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If volume < 0 Then Throw New ArgumentException("Das Volumen darf nicht negativ sein.", NameOf(volume))
+ If volume < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeVolume, NameOf(volume))
+ End If
Return Math.Pow(volume, 1.0 / 3.0)
End Function
@@ -80,7 +90,9 @@ Namespace ThreeDimensional
''' Kantenlänge sqrt(surfaceArea / 6)
Public Shared Function SideFromSurfaceArea(surfaceArea As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If surfaceArea < 0 Then Throw New ArgumentException("Die Oberfläche darf nicht negativ sein.", NameOf(surfaceArea))
+ If surfaceArea < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeArea, NameOf(surfaceArea))
+ End If
Return Math.Sqrt(surfaceArea / 6.0)
End Function
@@ -91,7 +103,9 @@ Namespace ThreeDimensional
''' Kantenlänge spaceDiagonal / sqrt(3)
Public Shared Function SideFromSpaceDiagonal(spaceDiagonal As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If spaceDiagonal < 0 Then Throw New ArgumentException("Die Raumdiagonale darf nicht negativ sein.", NameOf(spaceDiagonal))
+ If spaceDiagonal < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeDiagonal, NameOf(spaceDiagonal))
+ End If
Return spaceDiagonal / Math.Sqrt(3.0)
End Function
@@ -124,7 +138,9 @@ Namespace ThreeDimensional
''' Array mit 8 Eckpunkten als Tuple(X,Y,Z)
Public Shared Function VerticesFromCenter(cx As Double, cy As Double, cz As Double, side As Double) As Tuple(Of Double, Double, Double)()
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side < 0 Then Throw New ArgumentException("Die Kantenlänge darf nicht negativ sein.", NameOf(side))
+ If side < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(side))
+ End If
Dim h = side / 2.0
Return New Tuple(Of Double, Double, Double)() {
diff --git a/Geometry/ThreeDimensional/Cuboid.vb b/Geometry/ThreeDimensional/Cuboid.vb
index 25be741..6f87baf 100644
--- a/Geometry/ThreeDimensional/Cuboid.vb
+++ b/Geometry/ThreeDimensional/Cuboid.vb
@@ -27,9 +27,15 @@ Namespace ThreeDimensional
''' Volumen length * width * height
Public Shared Function Volume(length As Double, width As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If length < 0 Then Throw New ArgumentException("Die Länge darf nicht negativ sein.", NameOf(length))
- If width < 0 Then Throw New ArgumentException("Die Breite darf nicht negativ sein.", NameOf(width))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If length < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(length))
+ End If
+ If width < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(width))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return length * width * height
End Function
@@ -43,9 +49,15 @@ Namespace ThreeDimensional
''' Oberfläche 2 * (lw + lh + wh)
Public Shared Function SurfaceArea(length As Double, width As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If length < 0 Then Throw New ArgumentException("Die Länge darf nicht negativ sein.", NameOf(length))
- If width < 0 Then Throw New ArgumentException("Die Breite darf nicht negativ sein.", NameOf(width))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If length < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(length))
+ End If
+ If width < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(width))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return 2.0 * ((length * width) + (length * height) + (width * height))
End Function
@@ -59,9 +71,15 @@ Namespace ThreeDimensional
''' Raumdiagonale sqrt(l^2 + w^2 + h^2)
Public Shared Function SpaceDiagonal(length As Double, width As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If length < 0 Then Throw New ArgumentException("Die Länge darf nicht negativ sein.", NameOf(length))
- If width < 0 Then Throw New ArgumentException("Die Breite darf nicht negativ sein.", NameOf(width))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If length < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(length))
+ End If
+ If width < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(width))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return Math.Sqrt((length * length) + (width * width) + (height * height))
End Function
@@ -74,8 +92,12 @@ Namespace ThreeDimensional
''' Flächendiagonale sqrt(l^2 + w^2)
Public Shared Function FaceDiagonalLengthWidth(length As Double, width As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If length < 0 Then Throw New ArgumentException("Die Länge darf nicht negativ sein.", NameOf(length))
- If width < 0 Then Throw New ArgumentException("Die Breite darf nicht negativ sein.", NameOf(width))
+ If length < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(length))
+ End If
+ If width < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(width))
+ End If
Return Math.Sqrt((length * length) + (width * width))
End Function
@@ -87,8 +109,12 @@ Namespace ThreeDimensional
''' Flächendiagonale sqrt(l^2 + h^2)
Public Shared Function FaceDiagonalLengthHeight(length As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If length < 0 Then Throw New ArgumentException("Die Länge darf nicht negativ sein.", NameOf(length))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If length < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(length))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return Math.Sqrt((length * length) + (height * height))
End Function
@@ -100,8 +126,12 @@ Namespace ThreeDimensional
''' Flächendiagonale sqrt(w^2 + h^2)
Public Shared Function FaceDiagonalWidthHeight(width As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If width < 0 Then Throw New ArgumentException("Die Breite darf nicht negativ sein.", NameOf(width))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If width < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(width))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return Math.Sqrt((width * width) + (height * height))
End Function
@@ -114,9 +144,15 @@ Namespace ThreeDimensional
''' Fehlende Kante volume / (edge1 * edge2)
Public Shared Function EdgeFromVolume(volume As Double, edge1 As Double, edge2 As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If volume < 0 Then Throw New ArgumentException("Das Volumen darf nicht negativ sein.", NameOf(volume))
- If edge1 <= 0 Then Throw New ArgumentException("Kante 1 muss größer als 0 sein.", NameOf(edge1))
- If edge2 <= 0 Then Throw New ArgumentException("Kante 2 muss größer als 0 sein.", NameOf(edge2))
+ If volume < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeVolume, NameOf(volume))
+ End If
+ If edge1 <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveEdge, NameOf(edge1))
+ End If
+ If edge2 <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveEdge, NameOf(edge2))
+ End If
Return volume / (edge1 * edge2)
End Function
@@ -130,10 +166,18 @@ Namespace ThreeDimensional
''' True, wenn alle drei Kanten innerhalb der Toleranz gleich sind
Public Shared Function IsCube(length As Double, width As Double, height As Double, Optional tolerance As Double = 0.000001) As Boolean
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If length < 0 Then Throw New ArgumentException("Die Länge darf nicht negativ sein.", NameOf(length))
- If width < 0 Then Throw New ArgumentException("Die Breite darf nicht negativ sein.", NameOf(width))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
- If tolerance <= 0 Then Throw New ArgumentException("Die Toleranz muss größer als 0 sein.", NameOf(tolerance))
+ If length < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(length))
+ End If
+ If width < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(width))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
+ If tolerance <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveTolerance, NameOf(tolerance))
+ End If
Return Math.Abs(length - width) <= tolerance AndAlso Math.Abs(length - height) <= tolerance
End Function
@@ -169,9 +213,15 @@ Namespace ThreeDimensional
''' Array mit 8 Eckpunkten als Tuple(X,Y,Z)
Public Shared Function VerticesFromCenter(cx As Double, cy As Double, cz As Double, length As Double, width As Double, height As Double) As Tuple(Of Double, Double, Double)()
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If length < 0 Then Throw New ArgumentException("Die Länge darf nicht negativ sein.", NameOf(length))
- If width < 0 Then Throw New ArgumentException("Die Breite darf nicht negativ sein.", NameOf(width))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If length < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(length))
+ End If
+ If width < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(width))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Dim lx = length / 2.0
Dim wy = width / 2.0
diff --git a/Geometry/ThreeDimensional/Cylinder.vb b/Geometry/ThreeDimensional/Cylinder.vb
index cb4186c..4758656 100644
--- a/Geometry/ThreeDimensional/Cylinder.vb
+++ b/Geometry/ThreeDimensional/Cylinder.vb
@@ -26,8 +26,12 @@ Namespace ThreeDimensional
''' Volumen PI * r^2 * h
Public Shared Function Volume(radius As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return Math.PI * radius * radius * height
End Function
@@ -39,8 +43,12 @@ Namespace ThreeDimensional
''' Mantelfläche 2 * PI * r * h
Public Shared Function LateralArea(radius As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return 2.0 * Math.PI * radius * height
End Function
@@ -52,8 +60,12 @@ Namespace ThreeDimensional
''' Oberfläche 2*PI*r*(r+h)
Public Shared Function SurfaceArea(radius As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return 2.0 * Math.PI * radius * (radius + height)
End Function
@@ -64,7 +76,9 @@ Namespace ThreeDimensional
''' 2 * PI * r
Public Shared Function BaseCircumference(radius As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
Return 2.0 * Math.PI * radius
End Function
@@ -75,7 +89,9 @@ Namespace ThreeDimensional
''' PI * r^2
Public Shared Function BaseArea(radius As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
Return Math.PI * radius * radius
End Function
@@ -86,7 +102,9 @@ Namespace ThreeDimensional
''' Durchmesser 2 * r
Public Shared Function DiameterFromRadius(radius As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
Return 2.0 * radius
End Function
@@ -97,7 +115,9 @@ Namespace ThreeDimensional
''' Radius d / 2
Public Shared Function RadiusFromDiameter(diameter As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If diameter < 0 Then Throw New ArgumentException("Der Durchmesser darf nicht negativ sein.", NameOf(diameter))
+ If diameter < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeDiameter, NameOf(diameter))
+ End If
Return diameter / 2.0
End Function
@@ -115,7 +135,9 @@ Namespace ThreeDimensional
Public Shared Function HollowVolume(outerRadius As Double, innerRadius As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
ValidateHollowRadii(outerRadius, innerRadius)
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return Math.PI * ((outerRadius * outerRadius) - (innerRadius * innerRadius)) * height
End Function
@@ -129,7 +151,9 @@ Namespace ThreeDimensional
Public Shared Function HollowSurfaceArea(outerRadius As Double, innerRadius As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
ValidateHollowRadii(outerRadius, innerRadius)
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Dim outerLateral = 2.0 * Math.PI * outerRadius * height
Dim innerLateral = 2.0 * Math.PI * innerRadius * height
@@ -154,9 +178,15 @@ Namespace ThreeDimensional
''' 3D-Koordinate als Tuple(X, Y, Z)
Public Shared Function PointOnLateralSurface(centerX As Double, centerY As Double, baseZ As Double, radius As Double, height As Double, angleRadians As Double, heightOffset As Double) As Tuple(Of Double, Double, Double)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
- If heightOffset < 0 OrElse heightOffset > height Then Throw New ArgumentException("Höhenoffset muss im Bereich 0 bis Höhe liegen.", NameOf(heightOffset))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
+ If heightOffset < 0 OrElse heightOffset > height Then
+ Throw New ArgumentException(My.Resources.VerifyOffsetWithinHeight, NameOf(heightOffset))
+ End If
Dim x = centerX + (radius * Math.Cos(angleRadians))
Dim y = centerY + (radius * Math.Sin(angleRadians))
@@ -171,9 +201,15 @@ Namespace ThreeDimensional
Private Shared Sub ValidateHollowRadii(outerRadius As Double, innerRadius As Double)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If outerRadius <= 0 Then Throw New ArgumentException("Der Außenradius muss größer als 0 sein.", NameOf(outerRadius))
- If innerRadius < 0 Then Throw New ArgumentException("Der Innenradius darf nicht negativ sein.", NameOf(innerRadius))
- If innerRadius >= outerRadius Then Throw New ArgumentException("Der Innenradius muss kleiner als der Außenradius sein.", NameOf(innerRadius))
+ If outerRadius <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveRadius, NameOf(outerRadius))
+ End If
+ If innerRadius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(innerRadius))
+ End If
+ If innerRadius >= outerRadius Then
+ Throw New ArgumentException(My.Resources.VerifyInnerLessThanOuter, NameOf(innerRadius))
+ End If
End Sub
#End Region
diff --git a/Geometry/ThreeDimensional/Frustum.vb b/Geometry/ThreeDimensional/Frustum.vb
index 02bffdf..668707a 100644
--- a/Geometry/ThreeDimensional/Frustum.vb
+++ b/Geometry/ThreeDimensional/Frustum.vb
@@ -131,9 +131,15 @@ Namespace ThreeDimensional
''' Volumen ((bottomArea + topArea)/2) * height
Public Shared Function PrismFrustumVolume(bottomArea As Double, topArea As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If bottomArea < 0 Then Throw New ArgumentException("Die untere Endfläche darf nicht negativ sein.", NameOf(bottomArea))
- If topArea < 0 Then Throw New ArgumentException("Die obere Endfläche darf nicht negativ sein.", NameOf(topArea))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If bottomArea < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeArea, NameOf(bottomArea))
+ End If
+ If topArea < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeArea, NameOf(topArea))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
Return ((bottomArea + topArea) / 2.0) * height
@@ -149,9 +155,15 @@ Namespace ThreeDimensional
''' Mantelfläche ((bottomPerimeter + topPerimeter)/2) * height
Public Shared Function PrismFrustumLateralArea(bottomPerimeter As Double, topPerimeter As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If bottomPerimeter < 0 Then Throw New ArgumentException("Der untere Umfang darf nicht negativ sein.", NameOf(bottomPerimeter))
- If topPerimeter < 0 Then Throw New ArgumentException("Der obere Umfang darf nicht negativ sein.", NameOf(topPerimeter))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If bottomPerimeter < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeCircumference, NameOf(bottomPerimeter))
+ End If
+ If topPerimeter < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeCircumference, NameOf(topPerimeter))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
Return ((bottomPerimeter + topPerimeter) / 2.0) * height
@@ -169,11 +181,21 @@ Namespace ThreeDimensional
''' Oberfläche Endflächen + Mantelfläche
Public Shared Function PrismFrustumSurfaceArea(bottomArea As Double, topArea As Double, bottomPerimeter As Double, topPerimeter As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If bottomArea < 0 Then Throw New ArgumentException("Die untere Endfläche darf nicht negativ sein.", NameOf(bottomArea))
- If topArea < 0 Then Throw New ArgumentException("Die obere Endfläche darf nicht negativ sein.", NameOf(topArea))
- If bottomPerimeter < 0 Then Throw New ArgumentException("Der untere Umfang darf nicht negativ sein.", NameOf(bottomPerimeter))
- If topPerimeter < 0 Then Throw New ArgumentException("Der obere Umfang darf nicht negativ sein.", NameOf(topPerimeter))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If bottomArea < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeArea, NameOf(bottomArea))
+ End If
+ If topArea < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeArea, NameOf(topArea))
+ End If
+ If bottomPerimeter < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeCircumference, NameOf(bottomPerimeter))
+ End If
+ If topPerimeter < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeCircumference, NameOf(topPerimeter))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return bottomArea + topArea + PrismFrustumLateralArea(bottomPerimeter, topPerimeter, height)
End Function
@@ -184,21 +206,43 @@ Namespace ThreeDimensional
Private Shared Sub ValidateConeFrustumInputs(bottomRadius As Double, topRadius As Double, height As Double)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If bottomRadius <= 0 Then Throw New ArgumentException("Der untere Radius muss größer als 0 sein.", NameOf(bottomRadius))
- If topRadius < 0 Then Throw New ArgumentException("Der obere Radius darf nicht negativ sein.", NameOf(topRadius))
- If topRadius >= bottomRadius Then Throw New ArgumentException("Der obere Radius muss kleiner als der untere Radius sein.", NameOf(topRadius))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If bottomRadius <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveRadius, NameOf(bottomRadius))
+ End If
+ If topRadius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(topRadius))
+ End If
+ If topRadius >= bottomRadius Then
+ Throw New ArgumentException(My.Resources.VerifyTopRadiusLessThanBottom, NameOf(topRadius))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
End Sub
Private Shared Sub ValidatePyramidFrustumInputs(bottomLength As Double, bottomWidth As Double, topLength As Double, topWidth As Double, height As Double)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If bottomLength <= 0 Then Throw New ArgumentException("Die untere Grundlänge muss größer als 0 sein.", NameOf(bottomLength))
- If bottomWidth <= 0 Then Throw New ArgumentException("Die untere Grundbreite muss größer als 0 sein.", NameOf(bottomWidth))
- If topLength < 0 Then Throw New ArgumentException("Die obere Grundlänge darf nicht negativ sein.", NameOf(topLength))
- If topWidth < 0 Then Throw New ArgumentException("Die obere Grundbreite darf nicht negativ sein.", NameOf(topWidth))
- If topLength >= bottomLength Then Throw New ArgumentException("Die obere Grundlänge muss kleiner als die untere sein.", NameOf(topLength))
- If topWidth >= bottomWidth Then Throw New ArgumentException("Die obere Grundbreite muss kleiner als die untere sein.", NameOf(topWidth))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If bottomLength <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveLength, NameOf(bottomLength))
+ End If
+ If bottomWidth <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveWidth, NameOf(bottomWidth))
+ End If
+ If topLength < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(topLength))
+ End If
+ If topWidth < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(topWidth))
+ End If
+ If topLength >= bottomLength Then
+ Throw New ArgumentException(My.Resources.String2, NameOf(topLength))
+ End If
+ If topWidth >= bottomWidth Then
+ Throw New ArgumentException(My.Resources.String3, NameOf(topWidth))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
End Sub
#End Region
diff --git a/Geometry/ThreeDimensional/Prism.vb b/Geometry/ThreeDimensional/Prism.vb
index 1168361..3359cd5 100644
--- a/Geometry/ThreeDimensional/Prism.vb
+++ b/Geometry/ThreeDimensional/Prism.vb
@@ -26,8 +26,12 @@ Namespace ThreeDimensional
''' Volumen baseArea * height
Public Shared Function Volume(baseArea As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If baseArea < 0 Then Throw New ArgumentException("Die Grundfläche darf nicht negativ sein.", NameOf(baseArea))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If baseArea < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeArea, NameOf(baseArea))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return baseArea * height
End Function
@@ -39,8 +43,12 @@ Namespace ThreeDimensional
''' Mantelfläche basePerimeter * height
Public Shared Function LateralArea(basePerimeter As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If basePerimeter < 0 Then Throw New ArgumentException("Der Grundumfang darf nicht negativ sein.", NameOf(basePerimeter))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If basePerimeter < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeCircumference, NameOf(basePerimeter))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return basePerimeter * height
End Function
@@ -53,9 +61,15 @@ Namespace ThreeDimensional
''' Oberfläche 2 * baseArea + basePerimeter * height
Public Shared Function SurfaceArea(baseArea As Double, basePerimeter As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If baseArea < 0 Then Throw New ArgumentException("Die Grundfläche darf nicht negativ sein.", NameOf(baseArea))
- If basePerimeter < 0 Then Throw New ArgumentException("Der Grundumfang darf nicht negativ sein.", NameOf(basePerimeter))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If baseArea < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeArea, NameOf(baseArea))
+ End If
+ If basePerimeter < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeCircumference, NameOf(basePerimeter))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return (2.0 * baseArea) + LateralArea(basePerimeter, height)
End Function
@@ -88,7 +102,9 @@ Namespace ThreeDimensional
''' Volumen Dreiecksgrundfläche * height
Public Shared Function TriangularPrismVolume(sideA As Double, sideB As Double, sideC As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return Volume(TriangularBaseArea(sideA, sideB, sideC), height)
End Function
@@ -102,7 +118,9 @@ Namespace ThreeDimensional
''' Oberfläche 2 * Dreiecksgrundfläche + (a+b+c) * height
Public Shared Function TriangularPrismSurfaceArea(sideA As Double, sideB As Double, sideC As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Dim baseArea = TriangularBaseArea(sideA, sideB, sideC)
Dim basePerimeter = sideA + sideB + sideC
Return SurfaceArea(baseArea, basePerimeter, height)
@@ -116,7 +134,9 @@ Namespace ThreeDimensional
''' Fläche n*s^2/(4*tan(PI/n))
Public Shared Function RegularPolygonBaseArea(sideLength As Double, sideCount As Integer) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If sideLength < 0 Then Throw New ArgumentException("Die Seitenlänge darf nicht negativ sein.", NameOf(sideLength))
+ If sideLength < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(sideLength))
+ End If
ValidateSideCount(sideCount)
If sideLength = 0 Then Return 0
@@ -134,7 +154,9 @@ Namespace ThreeDimensional
''' Volumen Grundfläche * Höhe
Public Shared Function RegularPolygonPrismVolume(sideLength As Double, sideCount As Integer, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Dim baseArea = RegularPolygonBaseArea(sideLength, sideCount)
Return Volume(baseArea, height)
End Function
@@ -148,7 +170,9 @@ Namespace ThreeDimensional
''' Oberfläche 2 * Grundfläche + Umfang * Höhe
Public Shared Function RegularPolygonPrismSurfaceArea(sideLength As Double, sideCount As Integer, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Dim baseArea = RegularPolygonBaseArea(sideLength, sideCount)
Dim basePerimeter = sideCount * sideLength
Return SurfaceArea(baseArea, basePerimeter, height)
@@ -160,18 +184,26 @@ Namespace ThreeDimensional
Private Shared Sub ValidateTriangleSides(sideA As Double, sideB As Double, sideC As Double)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If sideA <= 0 Then Throw New ArgumentException("Seite A muss größer als 0 sein.", NameOf(sideA))
- If sideB <= 0 Then Throw New ArgumentException("Seite B muss größer als 0 sein.", NameOf(sideB))
- If sideC <= 0 Then Throw New ArgumentException("Seite C muss größer als 0 sein.", NameOf(sideC))
+ If sideA <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(sideA))
+ End If
+ If sideB <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(sideB))
+ End If
+ If sideC <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(sideC))
+ End If
If sideA + sideB <= sideC OrElse sideA + sideC <= sideB OrElse sideB + sideC <= sideA Then
- Throw New ArgumentException("Die Seiten erfüllen die Dreiecksungleichung nicht.", NameOf(sideC))
+ Throw New ArgumentException(My.Resources.String1, NameOf(sideC))
End If
End Sub
Private Shared Sub ValidateSideCount(sideCount As Integer)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If sideCount < 3 Then Throw New ArgumentException("Die Seitenanzahl muss größer oder gleich 3 sein.", NameOf(sideCount))
+ If sideCount < 3 Then
+ Throw New ArgumentException(My.Resources.RequireAtLeastThreeSides, NameOf(sideCount))
+ End If
End Sub
#End Region
diff --git a/Geometry/ThreeDimensional/Pyramid.vb b/Geometry/ThreeDimensional/Pyramid.vb
index 997960e..154f2dd 100644
--- a/Geometry/ThreeDimensional/Pyramid.vb
+++ b/Geometry/ThreeDimensional/Pyramid.vb
@@ -26,8 +26,12 @@ Namespace ThreeDimensional
''' Grundfläche length * width
Public Shared Function BaseArea(length As Double, width As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If length < 0 Then Throw New ArgumentException("Die Grundlänge darf nicht negativ sein.", NameOf(length))
- If width < 0 Then Throw New ArgumentException("Die Grundbreite darf nicht negativ sein.", NameOf(width))
+ If length < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(length))
+ End If
+ If width < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(width))
+ End If
Return length * width
End Function
@@ -40,9 +44,15 @@ Namespace ThreeDimensional
''' Volumen (Grundfläche * Höhe) / 3
Public Shared Function Volume(length As Double, width As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If length < 0 Then Throw New ArgumentException("Die Grundlänge darf nicht negativ sein.", NameOf(length))
- If width < 0 Then Throw New ArgumentException("Die Grundbreite darf nicht negativ sein.", NameOf(width))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If length < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(length))
+ End If
+ If width < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(width))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
Return (BaseArea(length, width) * height) / 3.0
@@ -57,8 +67,12 @@ Namespace ThreeDimensional
''' Schräghöhe sqrt((width/2)^2 + h^2)
Public Shared Function SlantHeightLengthFace(width As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If width < 0 Then Throw New ArgumentException("Die Grundbreite darf nicht negativ sein.", NameOf(width))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If width < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(width))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Dim halfWidth = width / 2.0
Return Math.Sqrt((halfWidth * halfWidth) + (height * height))
@@ -72,8 +86,12 @@ Namespace ThreeDimensional
''' Schräghöhe sqrt((length/2)^2 + h^2)
Public Shared Function SlantHeightWidthFace(length As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If length < 0 Then Throw New ArgumentException("Die Grundlänge darf nicht negativ sein.", NameOf(length))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If length < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(length))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Dim halfLength = length / 2.0
Return Math.Sqrt((halfLength * halfLength) + (height * height))
@@ -88,9 +106,15 @@ Namespace ThreeDimensional
''' Mantelfläche aus 4 Dreiecksflächen
Public Shared Function LateralArea(length As Double, width As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If length < 0 Then Throw New ArgumentException("Die Grundlänge darf nicht negativ sein.", NameOf(length))
- If width < 0 Then Throw New ArgumentException("Die Grundbreite darf nicht negativ sein.", NameOf(width))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If length < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(length))
+ End If
+ If width < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(width))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Dim slantLen = SlantHeightLengthFace(width, height)
Dim slantWid = SlantHeightWidthFace(length, height)
@@ -106,9 +130,15 @@ Namespace ThreeDimensional
''' Gesamtoberfläche Grundfläche + Mantelfläche
Public Shared Function SurfaceArea(length As Double, width As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If length < 0 Then Throw New ArgumentException("Die Grundlänge darf nicht negativ sein.", NameOf(length))
- If width < 0 Then Throw New ArgumentException("Die Grundbreite darf nicht negativ sein.", NameOf(width))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If length < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(length))
+ End If
+ If width < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(width))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return BaseArea(length, width) + LateralArea(length, width, height)
End Function
@@ -204,9 +234,15 @@ Namespace ThreeDimensional
''' Array mit 5 Punkten: 4 Grundpunkte + Spitze
Public Shared Function VerticesFromCenter(cx As Double, cy As Double, cz As Double, length As Double, width As Double, height As Double) As Tuple(Of Double, Double, Double)()
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If length < 0 Then Throw New ArgumentException("Die Grundlänge darf nicht negativ sein.", NameOf(length))
- If width < 0 Then Throw New ArgumentException("Die Grundbreite darf nicht negativ sein.", NameOf(width))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If length < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(length))
+ End If
+ If width < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(width))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Dim halfLength = length / 2.0
Dim halfWidth = width / 2.0
@@ -227,13 +263,27 @@ Namespace ThreeDimensional
Private Shared Sub ValidateFrustumInputs(bottomLength As Double, bottomWidth As Double, topLength As Double, topWidth As Double, height As Double)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If bottomLength <= 0 Then Throw New ArgumentException("Die untere Grundlänge muss größer als 0 sein.", NameOf(bottomLength))
- If bottomWidth <= 0 Then Throw New ArgumentException("Die untere Grundbreite muss größer als 0 sein.", NameOf(bottomWidth))
- If topLength < 0 Then Throw New ArgumentException("Die obere Grundlänge darf nicht negativ sein.", NameOf(topLength))
- If topWidth < 0 Then Throw New ArgumentException("Die obere Grundbreite darf nicht negativ sein.", NameOf(topWidth))
- If topLength >= bottomLength Then Throw New ArgumentException("Die obere Grundlänge muss kleiner als die untere Grundlänge sein.", NameOf(topLength))
- If topWidth >= bottomWidth Then Throw New ArgumentException("Die obere Grundbreite muss kleiner als die untere Grundbreite sein.", NameOf(topWidth))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If bottomLength <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveLength, NameOf(bottomLength))
+ End If
+ If bottomWidth <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveWidth, NameOf(bottomWidth))
+ End If
+ If topLength < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(topLength))
+ End If
+ If topWidth < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(topWidth))
+ End If
+ If topLength >= bottomLength Then
+ Throw New ArgumentException(My.Resources.VerifyTopLengthLessThanBottom, NameOf(topLength))
+ End If
+ If topWidth >= bottomWidth Then
+ Throw New ArgumentException(My.Resources.VerifyTopWidthLessThanBottom, NameOf(topWidth))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
End Sub
#End Region
diff --git a/Geometry/ThreeDimensional/Sphere.vb b/Geometry/ThreeDimensional/Sphere.vb
index 6cfe1bb..3aacd80 100644
--- a/Geometry/ThreeDimensional/Sphere.vb
+++ b/Geometry/ThreeDimensional/Sphere.vb
@@ -25,7 +25,10 @@ Namespace ThreeDimensional
''' Volumen 4/3 * PI * r^3
Public Shared Function Volume(radius As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
Return (4.0 / 3.0) * Math.PI * Math.Pow(radius, 3)
#Enable Warning IDE0047 ' Unnötige Klammern entfernen
@@ -38,7 +41,9 @@ Namespace ThreeDimensional
''' Oberfläche 4 * PI * r^2
Public Shared Function SurfaceArea(radius As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
Return 4.0 * Math.PI * radius * radius
End Function
@@ -49,7 +54,9 @@ Namespace ThreeDimensional
''' Durchmesser 2 * r
Public Shared Function DiameterFromRadius(radius As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
Return 2.0 * radius
End Function
@@ -60,7 +67,9 @@ Namespace ThreeDimensional
''' Radius d / 2
Public Shared Function RadiusFromDiameter(diameter As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If diameter < 0 Then Throw New ArgumentException("Der Durchmesser darf nicht negativ sein.", NameOf(diameter))
+ If diameter < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeDiameter, NameOf(diameter))
+ End If
Return diameter / 2.0
End Function
@@ -71,7 +80,9 @@ Namespace ThreeDimensional
''' Umfang 2 * PI * r
Public Shared Function GreatCircleCircumference(radius As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
Return 2.0 * Math.PI * radius
End Function
@@ -82,7 +93,9 @@ Namespace ThreeDimensional
''' Fläche PI * r^2
Public Shared Function GreatCircleArea(radius As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
Return Math.PI * radius * radius
End Function
@@ -130,9 +143,11 @@ Namespace ThreeDimensional
''' 3D-Koordinate als Tuple(X, Y, Z)
Public Shared Function PointOnSphere(centerX As Double, centerY As Double, centerZ As Double, radius As Double, polarAngleRadians As Double, azimuthRadians As Double) As Tuple(Of Double, Double, Double)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius < 0 Then Throw New ArgumentException("Der Radius darf nicht negativ sein.", NameOf(radius))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
If polarAngleRadians < 0 OrElse polarAngleRadians > Math.PI Then
- Throw New ArgumentException("Der Polarwinkel muss im Bereich 0 bis PI liegen.", NameOf(polarAngleRadians))
+ Throw New ArgumentException(My.Resources.IsPolarAngleInBounds, NameOf(polarAngleRadians))
End If
Dim sinTheta = Math.Sin(polarAngleRadians)
@@ -149,9 +164,15 @@ Namespace ThreeDimensional
Private Shared Sub ValidateCapInputs(radius As Double, capHeight As Double)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If radius <= 0 Then Throw New ArgumentException("Der Radius muss größer als 0 sein.", NameOf(radius))
- If capHeight < 0 Then Throw New ArgumentException("Die Kappenhöhe darf nicht negativ sein.", NameOf(capHeight))
- If capHeight > 2.0 * radius Then Throw New ArgumentException("Die Kappenhöhe darf maximal 2 * Radius sein.", NameOf(capHeight))
+ If radius <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveRadius, NameOf(radius))
+ End If
+ If capHeight < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(capHeight))
+ End If
+ If capHeight > 2.0 * radius Then
+ Throw New ArgumentException(My.Resources.CheckCapHeightLimit, NameOf(capHeight))
+ End If
End Sub
#End Region
diff --git a/Geometry/TwoDimensional/Circle.vb b/Geometry/TwoDimensional/Circle.vb
index f76f037..80755e0 100644
--- a/Geometry/TwoDimensional/Circle.vb
+++ b/Geometry/TwoDimensional/Circle.vb
@@ -23,65 +23,74 @@ Namespace TwoDimensional
'''
''' Berechnet die Fläche eines Kreises aus dem Radius.
'''
- ''' Radius (>= 0)
- ''' Fläche = π * r^2
- Public Shared Function Area(r As Double) As Double
+ ''' Radius (>= 0)
+ ''' Fläche = π * radius^2
+ Public Shared Function Area(radius As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If r < 0 Then Throw New ArgumentException("Radius darf nicht negativ sein.", NameOf(r))
- Return Math.PI * r * r
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+
+ Return Math.PI * radius * radius
End Function
'''
''' Berechnet die Fläche eines Kreises aus dem Durchmesser.
'''
- ''' Durchmesser (>= 0)
+ ''' Durchmesser (>= 0)
''' Fläche
- Public Shared Function AreaFromDiameter(d As Double) As Double
+ Public Shared Function AreaFromDiameter(diameter As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- Return Area(RadiusFromDiameter(d))
+ Return Area(RadiusFromDiameter(diameter))
End Function
'''
''' Berechnet den Umfang (Kreisumfang) aus dem Radius.
'''
- ''' Radius (>= 0)
- ''' Umfang = 2 * π * r
- Public Shared Function Circumference(r As Double) As Double
+ ''' Radius (>= 0)
+ ''' Umfang = 2 * π * radius
+ Public Shared Function Circumference(radius As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If r < 0 Then Throw New ArgumentException("Radius darf nicht negativ sein.", NameOf(r))
- Return 2.0 * Math.PI * r
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ Return 2.0 * Math.PI * radius
End Function
'''
''' Berechnet den Umfang aus dem Durchmesser.
'''
- ''' Durchmesser (>= 0)
+ ''' Durchmesser (>= 0)
''' Umfang
- Public Shared Function CircumferenceFromDiameter(d As Double) As Double
+ Public Shared Function CircumferenceFromDiameter(diameter As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- Return Circumference(RadiusFromDiameter(d))
+ Return Circumference(RadiusFromDiameter(diameter))
End Function
'''
''' Konvertiert Radius in Durchmesser.
'''
- ''' Radius (>= 0)
- ''' Durchmesser 2 * r
- Public Shared Function DiameterFromRadius(r As Double) As Double
+ ''' Radius (>= 0)
+ ''' Durchmesser 2 * radius
+ Public Shared Function DiameterFromRadius(radius As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If r < 0 Then Throw New ArgumentException("Radius darf nicht negativ sein.", NameOf(r))
- Return 2.0 * r
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ Return 2.0 * radius
End Function
'''
''' Konvertiert Durchmesser in Radius.
'''
- ''' Durchmesser (>= 0)
- ''' Radius d / 2
- Public Shared Function RadiusFromDiameter(d As Double) As Double
+ ''' Durchmesser (>= 0)
+ ''' Radius diameter / 2
+ Public Shared Function RadiusFromDiameter(diameter As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If d < 0 Then Throw New ArgumentException("Durchmesser darf nicht negativ sein.", NameOf(d))
- Return d / 2.0
+ If diameter < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeDiameter, NameOf(diameter))
+ End If
+ Return diameter / 2.0
End Function
#End Region
@@ -91,105 +100,121 @@ Namespace TwoDimensional
'''
''' Berechnet die Bogenlänge für einen gegebenen Zentralwinkel (im Bogenmaß).
'''
- ''' Radius
+ ''' Radius
''' Winkel in Bogenmaß
- ''' Bogenlänge = r * angle
- Public Shared Function ArcLength(r As Double, angleRadians As Double) As Double
+ ''' Bogenlänge = radius * angle
+ Public Shared Function ArcLength(radius As Double, angleRadians As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If r < 0 Then Throw New ArgumentException("Radius darf nicht negativ sein.", NameOf(r))
- Return r * angleRadians
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ Return radius * angleRadians
End Function
'''
''' Berechnet die Bogenlänge für einen Winkel in Grad.
'''
- ''' Radius (>= 0)
+ ''' Radius (>= 0)
''' Winkel in Grad
''' Bogenlänge
- Public Shared Function ArcLengthDegrees(r As Double, angleDegrees As Double) As Double
+ Public Shared Function ArcLengthDegrees(radius As Double, angleDegrees As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
Dim rad As Double = angleDegrees * Math.PI / 180.0
- Return ArcLength(r, rad)
+ Return ArcLength(radius, rad)
End Function
'''
''' Berechnet die Fläche eines Kreissektors für einen gegebenen Zentralwinkel (Bogenmaß).
'''
- ''' Radius (>= 0)
+ ''' Radius (>= 0)
''' Winkel in Bogenmaß
- ''' Sektorfläche = 0.5 * r^2 * angle
- Public Shared Function SectorArea(r As Double, angleRadians As Double) As Double
+ ''' Sektorfläche = 0.5 * radius^2 * angle
+ Public Shared Function SectorArea(radius As Double, angleRadians As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If r < 0 Then Throw New ArgumentException("Radius darf nicht negativ sein.", NameOf(r))
- Return 0.5 * r * r * angleRadians
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ Return 0.5 * radius * radius * angleRadians
End Function
'''
''' Sektorfläche für Winkel in Grad.
'''
- ''' Radius (>= 0)
+ ''' Radius (>= 0)
''' Winkel in Grad
''' Sektorfläche
- Public Shared Function SectorAreaDegrees(r As Double, angleDegrees As Double) As Double
+ Public Shared Function SectorAreaDegrees(radius As Double, angleDegrees As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
Dim rad As Double = angleDegrees * Math.PI / 180.0
- Return SectorArea(r, rad)
+ Return SectorArea(radius, rad)
End Function
'''
''' Berechnet die Länge einer Sehne für einen gegebenen Zentralwinkel (Bogenmaß).
'''
- ''' Radius (>= 0)
+ ''' Radius (>= 0)
''' Winkel in Bogenmaß
- ''' Sehnenlänge = 2 * r * sin(angle/2)
- Public Shared Function ChordLength(r As Double, angleRadians As Double) As Double
+ ''' Sehnenlänge = 2 * radius * sin(angle/2)
+ Public Shared Function ChordLength(radius As Double, angleRadians As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If r < 0 Then Throw New ArgumentException("Radius darf nicht negativ sein.", NameOf(r))
- Return 2.0 * r * Math.Sin(angleRadians / 2.0)
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ Return 2.0 * radius * Math.Sin(angleRadians / 2.0)
End Function
'''
''' Berechnet die Sehnenlänge aus der Sehnenhöhe (Sagitta).
'''
- ''' Radius (>= 0)
+ ''' Radius (>= 0)
''' Sehnenhöhe (Abstand von Kreisrand zur Sehnenmitte)
''' Sehnenlänge
- Public Shared Function ChordLengthFromSagitta(r As Double, sagitta As Double) As Double
+ Public Shared Function ChordLengthFromSagitta(radius As Double, sagitta As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If r < 0 Then Throw New ArgumentException("Radius darf nicht negativ sein.", NameOf(r))
- If sagitta < 0 Or sagitta > r Then Throw New ArgumentException("Sehnenhöhe ungültig.", NameOf(sagitta))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ If sagitta < 0 Or sagitta > radius Then
+ Throw New ArgumentException(My.Resources.SagittaHeightInvalid, NameOf(sagitta))
+ End If
- ' Abstand vom Mittelpunkt zur Sehne (h) = r - sagitta
- Dim h As Double = r - sagitta
- ' Halbe Sehnenlänge = sqrt(r^2 - h^2)
- Dim half As Double = Math.Sqrt((r * r) - (h * h))
+ ' Abstand vom Mittelpunkt zur Sehne (h) = radius - sagitta
+ Dim h As Double = radius - sagitta
+ ' Halbe Sehnenlänge = sqrt(radius^2 - h^2)
+ Dim half As Double = Math.Sqrt((radius * radius) - (h * h))
Return 2.0 * half
End Function
'''
''' Berechnet den Zentralwinkel (Bogenmaß) aus Bogenlänge.
'''
- ''' Radius (> 0)
+ ''' Radius (> 0)
''' Bogenlänge
''' Zentralwinkel im Bogenmaß
- Public Shared Function AngleFromArcLength(r As Double, arcLength As Double) As Double
+ Public Shared Function AngleFromArcLength(radius As Double, arcLength As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If r <= 0 Then Throw New ArgumentException("Radius muss > 0 sein.", NameOf(r))
- Return arcLength / r
+ If radius <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveRadius, NameOf(radius))
+ End If
+ Return arcLength / radius
End Function
'''
''' Berechnet den Zentralwinkel (Bogenmaß) aus Sehnenlänge.
'''
- ''' Radius (> 0)
+ ''' Radius (> 0)
''' Sehnenlänge
''' Zentralwinkel im Bogenmaß
- Public Shared Function AngleFromChordLength(r As Double, chordLength As Double) As Double
+ Public Shared Function AngleFromChordLength(radius As Double, chordLength As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If r <= 0 Then Throw New ArgumentException("Radius muss > 0 sein.", NameOf(r))
- If chordLength < 0 OrElse chordLength > 2.0 * r Then Throw New ArgumentException("Sehnenlänge ungültig.", NameOf(chordLength))
- ' chord = 2 r sin(theta/2) => theta = 2 * asin(chord/(2r))
- Return 2.0 * Math.Asin(chordLength / (2.0 * r))
+ If radius <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveRadius, NameOf(radius))
+ End If
+ If chordLength < 0 OrElse chordLength > 2.0 * radius Then
+ Throw New ArgumentException(My.Resources.ChordLengthInvalid, NameOf(chordLength))
+ End If
+ ' chord = 2 radius sin(theta/2) => theta = 2 * asin(chord/(2*radius))
+ Return 2.0 * Math.Asin(chordLength / (2.0 * radius))
End Function
#End Region
@@ -201,14 +226,17 @@ Namespace TwoDimensional
'''
''' Mittelpunkt X
''' Mittelpunkt Y
- ''' Radius
+ ''' Radius
''' Winkel im Bogenmaß (0 = rechts)
''' PointF mit Koordinaten des Punktes
- Public Shared Function PointOnCircle(cx As Double, cy As Double, r As Double, angleRadians As Double) As PointF
+ Public Shared Function PointOnCircle(cx As Double, cy As Double, radius As Double, angleRadians As Double) As PointF
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If r < 0 Then Throw New ArgumentException("Radius darf nicht negativ sein.", NameOf(r))
- Dim x As Single = CSng(cx + (r * Math.Cos(angleRadians)))
- Dim y As Single = CSng(cy + (r * Math.Sin(angleRadians)))
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+
+ Dim x As Single = CSng(cx + (radius * Math.Cos(angleRadians)))
+ Dim y As Single = CSng(cy + (radius * Math.Sin(angleRadians)))
Return New PointF(x, y)
End Function
@@ -217,14 +245,16 @@ Namespace TwoDimensional
'''
''' Mittelpunkt X
''' Mittelpunkt Y
- ''' Radius (>= 0)
+ ''' Radius (>= 0)
''' Achsenparalleles BoundingBox-Rechteck
- Public Shared Function BoundingBox(cx As Double, cy As Double, r As Double) As RectangleF
+ Public Shared Function BoundingBox(cx As Double, cy As Double, radius As Double) As RectangleF
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If r < 0 Then Throw New ArgumentException("Radius darf nicht negativ sein.", NameOf(r))
- Dim x As Single = CSng(cx - r)
- Dim y As Single = CSng(cy - r)
- Dim size As Single = CSng(2.0 * r)
+ If radius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(radius))
+ End If
+ Dim x As Single = CSng(cx - radius)
+ Dim y As Single = CSng(cy - radius)
+ Dim size As Single = CSng(2.0 * radius)
Return New RectangleF(x, y, size, size)
End Function
diff --git a/Geometry/TwoDimensional/Ellipse.vb b/Geometry/TwoDimensional/Ellipse.vb
index f0af1ab..17bc285 100644
--- a/Geometry/TwoDimensional/Ellipse.vb
+++ b/Geometry/TwoDimensional/Ellipse.vb
@@ -338,7 +338,7 @@ Namespace TwoDimensional
Private Shared Sub ValidateAxes(a As Double, b As Double)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
If a <= 0 OrElse b <= 0 Then
- Throw New ArgumentException("Die Halbachsen müssen größer als 0 sein (a>0, b>0).")
+ Throw New ArgumentException(My.Resources.CheckPositiveAxes)
End If
End Sub
diff --git a/Geometry/TwoDimensional/Kite.vb b/Geometry/TwoDimensional/Kite.vb
index 27c7e2f..9926ff0 100644
--- a/Geometry/TwoDimensional/Kite.vb
+++ b/Geometry/TwoDimensional/Kite.vb
@@ -28,8 +28,12 @@ Namespace TwoDimensional
''' Fläche (d1 * d2) / 2
Public Shared Function AreaFromDiagonals(diagonal1 As Double, diagonal2 As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If diagonal1 < 0 Then Throw New ArgumentException("Diagonale 1 darf nicht negativ sein.", NameOf(diagonal1))
- If diagonal2 < 0 Then Throw New ArgumentException("Diagonale 2 darf nicht negativ sein.", NameOf(diagonal2))
+ If diagonal1 < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeDiagonal, NameOf(diagonal1))
+ End If
+ If diagonal2 < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeDiagonal, NameOf(diagonal2))
+ End If
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
Return (diagonal1 * diagonal2) / 2.0
#Enable Warning IDE0047 ' Unnötige Klammern entfernen
@@ -43,8 +47,12 @@ Namespace TwoDimensional
''' Umfang 2 * (sideA + sideB)
Public Shared Function Perimeter(sideA As Double, sideB As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If sideA < 0 Then Throw New ArgumentException("Seitenlänge A darf nicht negativ sein.", NameOf(sideA))
- If sideB < 0 Then Throw New ArgumentException("Seitenlänge B darf nicht negativ sein.", NameOf(sideB))
+ If sideA < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(sideA))
+ End If
+ If sideB < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(sideB))
+ End If
Return 2.0 * (sideA + sideB)
End Function
@@ -56,8 +64,12 @@ Namespace TwoDimensional
''' Fläche baseLength * height
Public Shared Function AreaFromBaseHeight(baseLength As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If baseLength < 0 Then Throw New ArgumentException("Die Grundseite darf nicht negativ sein.", NameOf(baseLength))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If baseLength < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(baseLength))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return baseLength * height
End Function
@@ -69,8 +81,12 @@ Namespace TwoDimensional
''' Höhe area / baseLength
Public Shared Function HeightFromArea(area As Double, baseLength As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If area < 0 Then Throw New ArgumentException("Die Fläche darf nicht negativ sein.", NameOf(area))
- If baseLength <= 0 Then Throw New ArgumentException("Die Grundseite muss größer als 0 sein.", NameOf(baseLength))
+ If area < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeArea, NameOf(area))
+ End If
+ If baseLength <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(baseLength))
+ End If
Return area / baseLength
End Function
@@ -85,11 +101,21 @@ Namespace TwoDimensional
''' True, wenn |A-B| und |C-D| innerhalb der Toleranz sind
Public Shared Function IsSymmetricBySides(sideA As Double, sideB As Double, sideC As Double, sideD As Double, Optional tolerance As Double = 0.000001) As Boolean
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If sideA < 0 Then Throw New ArgumentException("Seite A darf nicht negativ sein.", NameOf(sideA))
- If sideB < 0 Then Throw New ArgumentException("Seite B darf nicht negativ sein.", NameOf(sideB))
- If sideC < 0 Then Throw New ArgumentException("Seite C darf nicht negativ sein.", NameOf(sideC))
- If sideD < 0 Then Throw New ArgumentException("Seite D darf nicht negativ sein.", NameOf(sideD))
- If tolerance <= 0 Then Throw New ArgumentException("Die Toleranz muss größer als 0 sein.", NameOf(tolerance))
+ If sideA < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(sideA))
+ End If
+ If sideB < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(sideB))
+ End If
+ If sideC < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(sideC))
+ End If
+ If sideD < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(sideD))
+ End If
+ If tolerance <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveTolerance, NameOf(tolerance))
+ End If
Dim firstPair = Math.Abs(sideA - sideB) <= tolerance AndAlso Math.Abs(sideC - sideD) <= tolerance
Dim secondPair = Math.Abs(sideB - sideC) <= tolerance AndAlso Math.Abs(sideD - sideA) <= tolerance
@@ -111,8 +137,12 @@ Namespace TwoDimensional
''' Array mit 4 Eckpunkten in umlaufender Reihenfolge
Public Shared Function VerticesFromCenter(cx As Double, cy As Double, diagonal1 As Double, diagonal2 As Double, rotationRadians As Double) As PointF()
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If diagonal1 < 0 Then Throw New ArgumentException("Diagonale 1 darf nicht negativ sein.", NameOf(diagonal1))
- If diagonal2 < 0 Then Throw New ArgumentException("Diagonale 2 darf nicht negativ sein.", NameOf(diagonal2))
+ If diagonal1 < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeDiagonal, NameOf(diagonal1))
+ End If
+ If diagonal2 < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeDiagonal, NameOf(diagonal2))
+ End If
Dim halfD1 = diagonal1 / 2.0
Dim halfD2 = diagonal2 / 2.0
@@ -178,7 +208,9 @@ Namespace TwoDimensional
Public Shared Function IsKiteFromVertices(vertices As PointF(), Optional tolerance As Double = 0.000001) As Boolean
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
ValidateVertices(vertices)
- If tolerance <= 0 Then Throw New ArgumentException("Die Toleranz muss größer als 0 sein.", NameOf(tolerance))
+ If tolerance <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveTolerance, NameOf(tolerance))
+ End If
Dim l0 = Distance(vertices(0), vertices(1))
Dim l1 = Distance(vertices(1), vertices(2))
@@ -196,8 +228,12 @@ Namespace TwoDimensional
Private Shared Sub ValidateVertices(vertices As PointF())
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If vertices Is Nothing Then Throw New ArgumentException("Die Eckpunkte dürfen nicht Nothing sein.", NameOf(vertices))
- If vertices.Length <> 4 Then Throw New ArgumentException("Es müssen genau 4 Eckpunkte angegeben werden.", NameOf(vertices))
+ If vertices Is Nothing Then
+ Throw New ArgumentException(My.Resources.CheckVerticesNotNull, NameOf(vertices))
+ End If
+ If vertices.Length <> 4 Then
+ Throw New ArgumentException(My.Resources.RequireExactlyFourVertices, NameOf(vertices))
+ End If
End Sub
Private Shared Function Distance(p1 As PointF, p2 As PointF) As Double
diff --git a/Geometry/TwoDimensional/Parallelogram.vb b/Geometry/TwoDimensional/Parallelogram.vb
index a2a7ffa..30b8254 100644
--- a/Geometry/TwoDimensional/Parallelogram.vb
+++ b/Geometry/TwoDimensional/Parallelogram.vb
@@ -28,8 +28,12 @@ Namespace TwoDimensional
''' Fläche b * h
Public Shared Function Area(b As Double, h As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If b < 0 Then Throw New ArgumentException("Grundseite darf nicht negativ sein.", NameOf(b))
- If h < 0 Then Throw New ArgumentException("Höhe darf nicht negativ sein.", NameOf(h))
+ If b < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeSide, NameOf(b))
+ End If
+ If h < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(h))
+ End If
Return b * h
End Function
@@ -42,8 +46,12 @@ Namespace TwoDimensional
''' Umfang 2 * (a + b)
Public Shared Function Perimeter(a As Double, b As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If a < 0 Then Throw New ArgumentException("Seite a darf nicht negativ sein.", NameOf(a))
- If b < 0 Then Throw New ArgumentException("Seite b darf nicht negativ sein.", NameOf(b))
+ If a < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeSide, NameOf(a))
+ End If
+ If b < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeSide, NameOf(b))
+ End If
Return 2.0 * (a + b)
End Function
@@ -56,8 +64,12 @@ Namespace TwoDimensional
''' Höhe area / b
Public Shared Function HeightFromArea(area As Double, b As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If area < 0 Then Throw New ArgumentException("Fläche darf nicht negativ sein.", NameOf(area))
- If b <= 0 Then Throw New ArgumentException("Grundseite muss größer als 0 sein.", NameOf(b))
+ If area < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeArea, NameOf(area))
+ End If
+ If b <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(b))
+ End If
Return area / b
End Function
@@ -74,9 +86,15 @@ Namespace TwoDimensional
''' Fehlende Seitenlänge
Public Shared Function SideFromPerimeter(perimeter As Double, knownSide As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If perimeter < 0 Then Throw New ArgumentException("Umfang darf nicht negativ sein.", NameOf(perimeter))
- If knownSide < 0 Then Throw New ArgumentException("Bekannte Seite darf nicht negativ sein.", NameOf(knownSide))
- If perimeter <= 2.0 * knownSide Then Throw New ArgumentException("Umfang ist für die angegebene Seite zu klein.", NameOf(perimeter))
+ If perimeter < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeCircumference, NameOf(perimeter))
+ End If
+ If knownSide < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeSide, NameOf(knownSide))
+ End If
+ If perimeter <= 2.0 * knownSide Then
+ Throw New ArgumentException(My.Resources.VerifyPerimeterGreaterThanTwiceKnownSide, NameOf(perimeter))
+ End If
Return (perimeter / 2.0) - knownSide
End Function
@@ -90,10 +108,14 @@ Namespace TwoDimensional
''' Array mit zwei Diagonalen: [|u+v|, |u-v|]
Public Shared Function DiagonalBySidesAndAngle(a As Double, b As Double, includedAngleRadians As Double) As Double()
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If a <= 0 Then Throw New ArgumentException("Seite a muss größer als 0 sein.", NameOf(a))
- If b <= 0 Then Throw New ArgumentException("Seite b muss größer als 0 sein.", NameOf(b))
+ If a <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(a))
+ End If
+ If b <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(b))
+ End If
If includedAngleRadians <= 0 OrElse includedAngleRadians >= Math.PI Then
- Throw New ArgumentException("Der eingeschlossene Winkel muss zwischen 0 und PI liegen.", NameOf(includedAngleRadians))
+ Throw New ArgumentException(My.Resources.IncludedAngleMustBeBetweenZeroAndPi, NameOf(includedAngleRadians))
End If
Dim cosValue = Math.Cos(includedAngleRadians)
@@ -113,16 +135,24 @@ Namespace TwoDimensional
''' Innenwinkel im Bogenmaß
Public Shared Function InteriorAngleFromSidesAndDiagonals(a As Double, b As Double, d1 As Double, d2 As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If a <= 0 Then Throw New ArgumentException("Seite a muss größer als 0 sein.", NameOf(a))
- If b <= 0 Then Throw New ArgumentException("Seite b muss größer als 0 sein.", NameOf(b))
- If d1 <= 0 Then Throw New ArgumentException("Diagonale d1 muss größer als 0 sein.", NameOf(d1))
- If d2 <= 0 Then Throw New ArgumentException("Diagonale d2 muss größer als 0 sein.", NameOf(d2))
+ If a <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(a))
+ End If
+ If b <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(b))
+ End If
+ If d1 <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveDiagonal, NameOf(d1))
+ End If
+ If d2 <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveDiagonal, NameOf(d2))
+ End If
Dim denominator = 4.0 * a * b
Dim cosValue = ((d1 * d1) - (d2 * d2)) / denominator
If cosValue < -1.0 OrElse cosValue > 1.0 Then
- Throw New ArgumentException("Die angegebenen Seiten und Diagonalen bilden kein gültiges Parallelogramm.")
+ Throw New ArgumentException(My.Resources.InvalidParallelogramBySidesAndDiagonals)
End If
Return Math.Acos(cosValue)
@@ -157,10 +187,14 @@ Namespace TwoDimensional
''' Array mit 4 Eckpunkten in umlaufender Reihenfolge
Public Shared Function VerticesFromCenter(cx As Double, cy As Double, a As Double, b As Double, includedAngleRadians As Double, rotationRadians As Double) As PointF()
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If a <= 0 Then Throw New ArgumentException("Seite a muss größer als 0 sein.", NameOf(a))
- If b <= 0 Then Throw New ArgumentException("Seite b muss größer als 0 sein.", NameOf(b))
+ If a <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(a))
+ End If
+ If b <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(b))
+ End If
If includedAngleRadians <= 0 OrElse includedAngleRadians >= Math.PI Then
- Throw New ArgumentException("Der eingeschlossene Winkel muss zwischen 0 und PI liegen.", NameOf(includedAngleRadians))
+ Throw New ArgumentException(My.Resources.IncludedAngleMustBeBetweenZeroAndPi, NameOf(includedAngleRadians))
End If
Dim halfA = a / 2.0
@@ -187,8 +221,12 @@ Namespace TwoDimensional
''' Polygonfläche
Public Shared Function AreaFromVertices(vertices As PointF()) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If vertices Is Nothing Then Throw New ArgumentException("Die Eckpunkte dürfen nicht Nothing sein.", NameOf(vertices))
- If vertices.Length < 3 Then Throw New ArgumentException("Es müssen mindestens 3 Eckpunkte angegeben werden.", NameOf(vertices))
+ If vertices Is Nothing Then
+ Throw New ArgumentException(My.Resources.CheckVerticesNotNull, NameOf(vertices))
+ End If
+ If vertices.Length < 3 Then
+ Throw New ArgumentException(My.Resources.RequireAtLeastThreeVertices, NameOf(vertices))
+ End If
Dim sum As Double = 0.0
For i = 0 To vertices.Length - 1
@@ -206,8 +244,12 @@ Namespace TwoDimensional
''' Umfang als Summe der Kantenlängen
Public Shared Function PerimeterFromVertices(vertices As PointF()) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If vertices Is Nothing Then Throw New ArgumentException("Die Eckpunkte dürfen nicht Nothing sein.", NameOf(vertices))
- If vertices.Length < 2 Then Throw New ArgumentException("Es müssen mindestens 2 Eckpunkte angegeben werden.", NameOf(vertices))
+ If vertices Is Nothing Then
+ Throw New ArgumentException(My.Resources.CheckVerticesNotNull, NameOf(vertices))
+ End If
+ If vertices.Length < 2 Then
+ Throw New ArgumentException(My.Resources.RequireAtLeastTwoVertices, NameOf(vertices))
+ End If
Dim perimeter As Double = 0.0
For i = 0 To vertices.Length - 1
@@ -228,9 +270,15 @@ Namespace TwoDimensional
''' True, wenn die Diagonalen denselben Mittelpunkt besitzen
Public Shared Function IsParallelogramFromVertices(vertices As PointF(), Optional tolerance As Double = 0.000001) As Boolean
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If vertices Is Nothing Then Throw New ArgumentException("Die Eckpunkte dürfen nicht Nothing sein.", NameOf(vertices))
- If vertices.Length <> 4 Then Throw New ArgumentException("Es müssen genau 4 Eckpunkte angegeben werden.", NameOf(vertices))
- If tolerance <= 0 Then Throw New ArgumentException("Die Toleranz muss größer als 0 sein.", NameOf(tolerance))
+ If vertices Is Nothing Then
+ Throw New ArgumentException(My.Resources.CheckVerticesNotNull, NameOf(vertices))
+ End If
+ If vertices.Length <> 4 Then
+ Throw New ArgumentException(My.Resources.RequireExactlyFourVertices, NameOf(vertices))
+ End If
+ If tolerance <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveTolerance, NameOf(tolerance))
+ End If
Dim midpointDiagonal1 = Center(vertices(0).X, vertices(0).Y, vertices(2).X, vertices(2).Y)
Dim midpointDiagonal2 = Center(vertices(1).X, vertices(1).Y, vertices(3).X, vertices(3).Y)
diff --git a/Geometry/TwoDimensional/Polygon.vb b/Geometry/TwoDimensional/Polygon.vb
index b571c4b..cc66575 100644
--- a/Geometry/TwoDimensional/Polygon.vb
+++ b/Geometry/TwoDimensional/Polygon.vb
@@ -65,7 +65,9 @@ Namespace TwoDimensional
Public Shared Function IsConvex(vertices As PointF(), Optional tolerance As Double = 0.000001) As Boolean
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
ValidateVertices(vertices, 3)
- If tolerance <= 0 Then Throw New ArgumentException("Die Toleranz muss größer als 0 sein.", NameOf(tolerance))
+ If tolerance <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveTolerance, NameOf(tolerance))
+ End If
Dim hasPositive As Boolean = False
Dim hasNegative As Boolean = False
@@ -96,7 +98,9 @@ Namespace TwoDimensional
Public Shared Function IsRegular(vertices As PointF(), Optional tolerance As Double = 0.000001) As Boolean
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
ValidateVertices(vertices, 3)
- If tolerance <= 0 Then Throw New ArgumentException("Die Toleranz muss größer als 0 sein.", NameOf(tolerance))
+ If tolerance <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveTolerance, NameOf(tolerance))
+ End If
If Not IsConvex(vertices, tolerance) Then Return False
Dim firstSide = Distance(vertices(0), vertices(1))
@@ -137,7 +141,7 @@ Namespace TwoDimensional
Next
If Math.Abs(signedArea2) <= Double.Epsilon Then
- Throw New ArgumentException("Die Eckpunkte dürfen kein degeneriertes Polygon bilden.", NameOf(vertices))
+ Throw New ArgumentException(My.Resources.String6, NameOf(vertices))
End If
Dim factor = 1.0 / (3.0 * signedArea2)
@@ -221,8 +225,12 @@ Namespace TwoDimensional
Private Shared Sub ValidateVertices(vertices As PointF(), minCount As Integer)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If vertices Is Nothing Then Throw New ArgumentException("Die Eckpunkte dürfen nicht Nothing sein.", NameOf(vertices))
- If vertices.Length < minCount Then Throw New ArgumentException($"Es müssen mindestens {minCount} Eckpunkte angegeben werden.", NameOf(vertices))
+ If vertices Is Nothing Then
+ Throw New ArgumentException(My.Resources.CheckVerticesNotNull, NameOf(vertices))
+ End If
+ If vertices.Length < minCount Then
+ Throw New ArgumentException(My.Resources.String7.Replace("{0}", minCount.ToString()), NameOf(vertices))
+ End If
End Sub
Private Shared Function CrossZ(p0 As PointF, p1 As PointF, p2 As PointF) As Double
diff --git a/Geometry/TwoDimensional/Rectangle.vb b/Geometry/TwoDimensional/Rectangle.vb
index 5d28d77..abb90fd 100644
--- a/Geometry/TwoDimensional/Rectangle.vb
+++ b/Geometry/TwoDimensional/Rectangle.vb
@@ -28,8 +28,12 @@ Namespace TwoDimensional
''' Fläche (w * h)
Public Shared Function Area(w As Double, h As Double) As Double
' Guard-Clauses: negative Werte sind nicht erlaubt
- If w < 0 Then Throw New ArgumentException("Breite darf nicht negativ sein.", NameOf(w))
- If h < 0 Then Throw New ArgumentException("Höhe darf nicht negativ sein.", NameOf(h))
+ If w < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(w))
+ End If
+ If h < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(h))
+ End If
Return w * h
End Function
@@ -41,8 +45,12 @@ Namespace TwoDimensional
''' Umfang (2 * (w + h))
Public Shared Function Perimeter(w As Double, h As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If w < 0 Then Throw New ArgumentException("Breite darf nicht negativ sein.", NameOf(w))
- If h < 0 Then Throw New ArgumentException("Höhe darf nicht negativ sein.", NameOf(h))
+ If w < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeWidth, NameOf(w))
+ End If
+ If h < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(h))
+ End If
Return 2.0 * (w + h)
End Function
@@ -66,7 +74,9 @@ Namespace TwoDimensional
''' Wenn h = 0
Public Shared Function AspectRatio(w As Double, h As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If h = 0 Then Throw New ArgumentException("Höhe darf nicht 0 sein.", NameOf(h))
+ If h = 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveHeight, NameOf(h))
+ End If
Return w / h
End Function
@@ -245,7 +255,9 @@ Namespace TwoDimensional
'''
Public Shared Function AreaSquare(s As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If s < 0 Then Throw New ArgumentException("Seitenlänge darf nicht negativ sein.", NameOf(s))
+ If s < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(s))
+ End If
Return s * s
End Function
@@ -254,7 +266,9 @@ Namespace TwoDimensional
'''
Public Shared Function PerimeterSquare(s As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If s < 0 Then Throw New ArgumentException("Seitenlänge darf nicht negativ sein.", NameOf(s))
+ If s < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(s))
+ End If
Return 4.0 * s
End Function
@@ -271,7 +285,9 @@ Namespace TwoDimensional
'''
Public Shared Function FromDiagonalToSide(d As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If d < 0 Then Throw New ArgumentException("Diagonale darf nicht negativ sein.", NameOf(d))
+ If d < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeDiagonal, NameOf(d))
+ End If
Return d / Math.Sqrt(2.0)
End Function
diff --git a/Geometry/TwoDimensional/RegularPolygon.vb b/Geometry/TwoDimensional/RegularPolygon.vb
index 7d1be71..d0a893a 100644
--- a/Geometry/TwoDimensional/RegularPolygon.vb
+++ b/Geometry/TwoDimensional/RegularPolygon.vb
@@ -28,7 +28,9 @@ Namespace TwoDimensional
''' Umfang sideCount * sideLength
Public Shared Function Perimeter(sideLength As Double, sideCount As Integer) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If sideLength < 0 Then Throw New ArgumentException("Die Seitenlänge darf nicht negativ sein.", NameOf(sideLength))
+ If sideLength < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(sideLength))
+ End If
ValidateSideCount(sideCount)
Return sideCount * sideLength
End Function
@@ -67,7 +69,9 @@ Namespace TwoDimensional
''' Apothem sideLength / (2*tan(PI/n))
Public Shared Function Apothem(sideLength As Double, sideCount As Integer) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If sideLength < 0 Then Throw New ArgumentException("Die Seitenlänge darf nicht negativ sein.", NameOf(sideLength))
+ If sideLength < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(sideLength))
+ End If
ValidateSideCount(sideCount)
If sideLength = 0 Then Return 0
@@ -82,7 +86,9 @@ Namespace TwoDimensional
''' Umkreisradius sideLength / (2*sin(PI/n))
Public Shared Function Circumradius(sideLength As Double, sideCount As Integer) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If sideLength < 0 Then Throw New ArgumentException("Die Seitenlänge darf nicht negativ sein.", NameOf(sideLength))
+ If sideLength < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(sideLength))
+ End If
ValidateSideCount(sideCount)
If sideLength = 0 Then Return 0
@@ -110,7 +116,9 @@ Namespace TwoDimensional
''' Seitenlänge perimeter / sideCount
Public Shared Function SideLengthFromPerimeter(perimeter As Double, sideCount As Integer) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If perimeter < 0 Then Throw New ArgumentException("Der Umfang darf nicht negativ sein.", NameOf(perimeter))
+ If perimeter < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeCircumference, NameOf(perimeter))
+ End If
ValidateSideCount(sideCount)
Return perimeter / sideCount
End Function
@@ -131,7 +139,9 @@ Namespace TwoDimensional
Public Shared Function VerticesFromCenter(cx As Double, cy As Double, sideCount As Integer, circumradius As Double, rotationRadians As Double) As PointF()
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
ValidateSideCount(sideCount)
- If circumradius < 0 Then Throw New ArgumentException("Der Umkreisradius darf nicht negativ sein.", NameOf(circumradius))
+ If circumradius < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeRadius, NameOf(circumradius))
+ End If
Dim result(sideCount - 1) As PointF
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
@@ -193,7 +203,9 @@ Namespace TwoDimensional
Public Shared Function IsRegularFromVertices(vertices As PointF(), Optional tolerance As Double = 0.000001) As Boolean
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
ValidateVertices(vertices, 3)
- If tolerance <= 0 Then Throw New ArgumentException("Die Toleranz muss größer als 0 sein.", NameOf(tolerance))
+ If tolerance <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveTolerance, NameOf(tolerance))
+ End If
If AreaFromVertices(vertices) <= tolerance Then Return False
@@ -222,13 +234,19 @@ Namespace TwoDimensional
Private Shared Sub ValidateSideCount(sideCount As Integer)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If sideCount < 3 Then Throw New ArgumentException("Die Seitenanzahl muss größer oder gleich 3 sein.", NameOf(sideCount))
+ If sideCount < 3 Then
+ Throw New ArgumentException(My.Resources.RequireAtLeastThreeSides, NameOf(sideCount))
+ End If
End Sub
Private Shared Sub ValidateVertices(vertices As PointF(), minCount As Integer)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If vertices Is Nothing Then Throw New ArgumentException("Eckpunkte dürfen nicht Nothing sein.", NameOf(vertices))
- If vertices.Length < minCount Then Throw New ArgumentException($"Es müssen mindestens {minCount} Eckpunkte vorhanden sein.", NameOf(vertices))
+ If vertices Is Nothing Then
+ Throw New ArgumentException(My.Resources.CheckVerticesNotNull, NameOf(vertices))
+ End If
+ If vertices.Length < minCount Then
+ Throw New ArgumentException(My.Resources.String7.Replace("{0}", minCount.ToString()), NameOf(vertices))
+ End If
End Sub
Private Shared Function AverageCenter(vertices As PointF()) As PointF
diff --git a/Geometry/TwoDimensional/Rhombus.vb b/Geometry/TwoDimensional/Rhombus.vb
index 73c7e9a..32fcae9 100644
--- a/Geometry/TwoDimensional/Rhombus.vb
+++ b/Geometry/TwoDimensional/Rhombus.vb
@@ -28,8 +28,12 @@ Namespace TwoDimensional
''' Fläche baseLength * height
Public Shared Function AreaFromBaseHeight(baseLength As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If baseLength < 0 Then Throw New ArgumentException("Die Seitenlänge darf nicht negativ sein.", NameOf(baseLength))
- If height < 0 Then Throw New ArgumentException("Die Höhe darf nicht negativ sein.", NameOf(height))
+ If baseLength < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(baseLength))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Return baseLength * height
End Function
@@ -41,8 +45,12 @@ Namespace TwoDimensional
''' Fläche (d1 * d2) / 2
Public Shared Function AreaFromDiagonals(diagonal1 As Double, diagonal2 As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If diagonal1 < 0 Then Throw New ArgumentException("Diagonale 1 darf nicht negativ sein.", NameOf(diagonal1))
- If diagonal2 < 0 Then Throw New ArgumentException("Diagonale 2 darf nicht negativ sein.", NameOf(diagonal2))
+ If diagonal1 < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeDiagonal, NameOf(diagonal1))
+ End If
+ If diagonal2 < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeDiagonal, NameOf(diagonal2))
+ End If
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
Return (diagonal1 * diagonal2) / 2.0
#Enable Warning IDE0047 ' Unnötige Klammern entfernen
@@ -55,7 +63,9 @@ Namespace TwoDimensional
''' Umfang 4 * side
Public Shared Function Perimeter(side As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side < 0 Then Throw New ArgumentException("Die Seitenlänge darf nicht negativ sein.", NameOf(side))
+ If side < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(side))
+ End If
Return 4.0 * side
End Function
@@ -67,8 +77,12 @@ Namespace TwoDimensional
''' Höhe area / side
Public Shared Function HeightFromArea(area As Double, side As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If area < 0 Then Throw New ArgumentException("Die Fläche darf nicht negativ sein.", NameOf(area))
- If side <= 0 Then Throw New ArgumentException("Die Seitenlänge muss größer als 0 sein.", NameOf(side))
+ If area < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeArea, NameOf(area))
+ End If
+ If side <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveLength, NameOf(side))
+ End If
Return area / side
End Function
@@ -80,9 +94,11 @@ Namespace TwoDimensional
''' Array [d1, d2]
Public Shared Function DiagonalFromSideAndAngle(side As Double, interiorAngleRadians As Double) As Double()
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side <= 0 Then Throw New ArgumentException("Die Seitenlänge muss größer als 0 sein.", NameOf(side))
+ If side <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveLength, NameOf(side))
+ End If
If interiorAngleRadians <= 0 OrElse interiorAngleRadians >= Math.PI Then
- Throw New ArgumentException("Der Innenwinkel muss zwischen 0 und PI liegen.", NameOf(interiorAngleRadians))
+ Throw New ArgumentException(My.Resources.IncludedAngleMustBeBetweenZeroAndPi, NameOf(interiorAngleRadians))
End If
Dim halfAngle = interiorAngleRadians / 2.0
@@ -99,8 +115,12 @@ Namespace TwoDimensional
''' Inkreisradius 2 * area / perimeter
Public Shared Function InradiusFromAreaPerimeter(area As Double, perimeter As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If area < 0 Then Throw New ArgumentException("Die Fläche darf nicht negativ sein.", NameOf(area))
- If perimeter <= 0 Then Throw New ArgumentException("Der Umfang muss größer als 0 sein.", NameOf(perimeter))
+ If area < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeArea, NameOf(area))
+ End If
+ If perimeter <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveCircumference, NameOf(perimeter))
+ End If
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
Return (2.0 * area) / perimeter
#Enable Warning IDE0047 ' Unnötige Klammern entfernen
@@ -121,9 +141,11 @@ Namespace TwoDimensional
''' Array mit 4 Eckpunkten in umlaufender Reihenfolge
Public Shared Function VerticesFromCenter(cx As Double, cy As Double, side As Double, interiorAngleRadians As Double, rotationRadians As Double) As PointF()
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side <= 0 Then Throw New ArgumentException("Die Seitenlänge muss größer als 0 sein.", NameOf(side))
+ If side <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveLength, NameOf(side))
+ End If
If interiorAngleRadians <= 0 OrElse interiorAngleRadians >= Math.PI Then
- Throw New ArgumentException("Der Innenwinkel muss zwischen 0 und PI liegen.", NameOf(interiorAngleRadians))
+ Throw New ArgumentException(My.Resources.IncludedAngleMustBeBetweenZeroAndPi, NameOf(interiorAngleRadians))
End If
Dim halfA = side / 2.0
@@ -183,7 +205,9 @@ Namespace TwoDimensional
Public Shared Function IsRhombusFromVertices(vertices As PointF(), Optional tolerance As Double = 0.000001) As Boolean
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
ValidateVertices(vertices)
- If tolerance <= 0 Then Throw New ArgumentException("Die Toleranz muss größer als 0 sein.", NameOf(tolerance))
+ If tolerance <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveTolerance, NameOf(tolerance))
+ End If
Dim lengths(3) As Double
For i = 0 To 3
@@ -205,8 +229,12 @@ Namespace TwoDimensional
Private Shared Sub ValidateVertices(vertices As PointF())
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If vertices Is Nothing Then Throw New ArgumentException("Die Eckpunkte dürfen nicht Nothing sein.", NameOf(vertices))
- If vertices.Length <> 4 Then Throw New ArgumentException("Es müssen genau 4 Eckpunkte angegeben werden.", NameOf(vertices))
+ If vertices Is Nothing Then
+ Throw New ArgumentException(My.Resources.CheckVerticesNotNull, NameOf(vertices))
+ End If
+ If vertices.Length <> 4 Then
+ Throw New ArgumentException(My.Resources.RequireExactlyFourVertices, NameOf(vertices))
+ End If
End Sub
Private Shared Function Distance(p1 As PointF, p2 As PointF) As Double
diff --git a/Geometry/TwoDimensional/Square.vb b/Geometry/TwoDimensional/Square.vb
index c1692b5..90597ce 100644
--- a/Geometry/TwoDimensional/Square.vb
+++ b/Geometry/TwoDimensional/Square.vb
@@ -27,7 +27,9 @@ Namespace TwoDimensional
''' Fläche side * side
Public Shared Function Area(side As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side < 0 Then Throw New ArgumentException("Seitenlänge darf nicht negativ sein.", NameOf(side))
+ If side < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(side))
+ End If
Return side * side
End Function
@@ -38,7 +40,9 @@ Namespace TwoDimensional
''' Umfang 4 * side
Public Shared Function Perimeter(side As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side < 0 Then Throw New ArgumentException("Seitenlänge darf nicht negativ sein.", NameOf(side))
+ If side < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(side))
+ End If
Return 4.0 * side
End Function
@@ -49,7 +53,9 @@ Namespace TwoDimensional
''' Diagonale side * sqrt(2)
Public Shared Function Diagonal(side As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side < 0 Then Throw New ArgumentException("Seitenlänge darf nicht negativ sein.", NameOf(side))
+ If side < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(side))
+ End If
Return side * Math.Sqrt(2.0)
End Function
@@ -60,7 +66,9 @@ Namespace TwoDimensional
''' Seitenlänge diagonal / sqrt(2)
Public Shared Function SideFromDiagonal(diagonal As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If diagonal < 0 Then Throw New ArgumentException("Diagonale darf nicht negativ sein.", NameOf(diagonal))
+ If diagonal < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeDiagonal, NameOf(diagonal))
+ End If
Return diagonal / Math.Sqrt(2.0)
End Function
@@ -71,7 +79,9 @@ Namespace TwoDimensional
''' Inkreisradius side / 2
Public Shared Function Inradius(side As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side < 0 Then Throw New ArgumentException("Seitenlänge darf nicht negativ sein.", NameOf(side))
+ If side < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(side))
+ End If
Return side / 2.0
End Function
@@ -82,7 +92,9 @@ Namespace TwoDimensional
''' Umkreisradius side / sqrt(2)
Public Shared Function Circumradius(side As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side < 0 Then Throw New ArgumentException("Seitenlänge darf nicht negativ sein.", NameOf(side))
+ If side < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(side))
+ End If
Return side / Math.Sqrt(2.0)
End Function
@@ -100,7 +112,9 @@ Namespace TwoDimensional
''' Array mit 4 Eckpunkten im Uhrzeigersinn
Public Shared Function VerticesFromCenter(cx As Double, cy As Double, side As Double, rotationRadians As Double) As PointF()
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If side < 0 Then Throw New ArgumentException("Seitenlänge darf nicht negativ sein.", NameOf(side))
+ If side < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeLength, NameOf(side))
+ End If
Dim halfSide = side / 2.0
Dim local As PointF() = {
@@ -168,7 +182,9 @@ Namespace TwoDimensional
Public Shared Function IsSquareFromVertices(vertices As PointF(), Optional tolerance As Double = 0.000001) As Boolean
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
ValidateVertices(vertices)
- If tolerance <= 0 Then Throw New ArgumentException("Die Toleranz muss größer als 0 sein.", NameOf(tolerance))
+ If tolerance <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveTolerance, NameOf(tolerance))
+ End If
Dim lengths(3) As Double
For i = 0 To 3
@@ -205,8 +221,12 @@ Namespace TwoDimensional
Private Shared Sub ValidateVertices(vertices As PointF())
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If vertices Is Nothing Then Throw New ArgumentException("Die Eckpunkte dürfen nicht Nothing sein.", NameOf(vertices))
- If vertices.Length <> 4 Then Throw New ArgumentException("Es müssen genau 4 Eckpunkte angegeben werden.", NameOf(vertices))
+ If vertices Is Nothing Then
+ Throw New ArgumentException(My.Resources.CheckVerticesNotNull, NameOf(vertices))
+ End If
+ If vertices.Length <> 4 Then
+ Throw New ArgumentException(My.Resources.RequireExactlyFourVertices, NameOf(vertices))
+ End If
End Sub
Private Shared Function Distance(p1 As PointF, p2 As PointF) As Double
diff --git a/Geometry/TwoDimensional/Trapezoid.vb b/Geometry/TwoDimensional/Trapezoid.vb
index 059cb10..c03527b 100644
--- a/Geometry/TwoDimensional/Trapezoid.vb
+++ b/Geometry/TwoDimensional/Trapezoid.vb
@@ -29,9 +29,15 @@ Namespace TwoDimensional
''' Fläche ((a + c) / 2) * h
Public Shared Function Area(baseA As Double, baseB As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If baseA < 0 Then Throw New ArgumentException("Grundseite a darf nicht negativ sein.", NameOf(baseA))
- If baseB < 0 Then Throw New ArgumentException("Grundseite c darf nicht negativ sein.", NameOf(baseB))
- If height < 0 Then Throw New ArgumentException("Höhe darf nicht negativ sein.", NameOf(height))
+ If baseA < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeSide, NameOf(baseA))
+ End If
+ If baseB < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeSide, NameOf(baseB))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
Return ((baseA + baseB) / 2.0) * height
@@ -48,10 +54,18 @@ Namespace TwoDimensional
''' Umfang a + b + c + d
Public Shared Function Perimeter(baseA As Double, legB As Double, baseC As Double, legD As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If baseA <= 0 Then Throw New ArgumentException("Grundseite a muss größer als 0 sein.", NameOf(baseA))
- If legB <= 0 Then Throw New ArgumentException("Seite b muss größer als 0 sein.", NameOf(legB))
- If baseC <= 0 Then Throw New ArgumentException("Grundseite c muss größer als 0 sein.", NameOf(baseC))
- If legD <= 0 Then Throw New ArgumentException("Seite d muss größer als 0 sein.", NameOf(legD))
+ If baseA <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(baseA))
+ End If
+ If legB <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(legB))
+ End If
+ If baseC <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(baseC))
+ End If
+ If legD <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(legD))
+ End If
Return baseA + legB + baseC + legD
End Function
@@ -64,8 +78,12 @@ Namespace TwoDimensional
''' Mittellinie (a + c) / 2
Public Shared Function Midline(baseA As Double, baseB As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If baseA < 0 Then Throw New ArgumentException("Grundseite a darf nicht negativ sein.", NameOf(baseA))
- If baseB < 0 Then Throw New ArgumentException("Grundseite c darf nicht negativ sein.", NameOf(baseB))
+ If baseA < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeSide, NameOf(baseA))
+ End If
+ If baseB < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeSide, NameOf(baseB))
+ End If
Return (baseA + baseB) / 2.0
End Function
@@ -79,12 +97,20 @@ Namespace TwoDimensional
''' Höhe
Public Shared Function HeightFromArea(area As Double, baseA As Double, baseB As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If area < 0 Then Throw New ArgumentException("Fläche darf nicht negativ sein.", NameOf(area))
- If baseA < 0 Then Throw New ArgumentException("Grundseite a darf nicht negativ sein.", NameOf(baseA))
- If baseB < 0 Then Throw New ArgumentException("Grundseite c darf nicht negativ sein.", NameOf(baseB))
+ If area < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeArea, NameOf(area))
+ End If
+ If baseA < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeSide, NameOf(baseA))
+ End If
+ If baseB < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeSide, NameOf(baseB))
+ End If
Dim denominator = baseA + baseB
- If denominator <= 0 Then Throw New ArgumentException("Die Summe der Grundseiten muss größer als 0 sein.")
+ If denominator <= 0 Then
+ Throw New ArgumentException(My.Resources.String5)
+ End If
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
Return (2.0 * area) / denominator
@@ -100,9 +126,15 @@ Namespace TwoDimensional
''' Schenkellänge
Public Shared Function LegLengthIsosceles(baseA As Double, baseB As Double, height As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If baseA < 0 Then Throw New ArgumentException("Grundseite a darf nicht negativ sein.", NameOf(baseA))
- If baseB < 0 Then Throw New ArgumentException("Grundseite c darf nicht negativ sein.", NameOf(baseB))
- If height < 0 Then Throw New ArgumentException("Höhe darf nicht negativ sein.", NameOf(height))
+ If baseA < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeSide, NameOf(baseA))
+ End If
+ If baseB < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeSide, NameOf(baseB))
+ End If
+ If height < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(height))
+ End If
Dim halfDiff = Math.Abs(baseA - baseB) / 2.0
Return Math.Sqrt((halfDiff * halfDiff) + (height * height))
@@ -117,9 +149,15 @@ Namespace TwoDimensional
''' True, wenn |b-d| innerhalb der Toleranz liegt
Public Shared Function IsIsosceles(legB As Double, legD As Double, Optional tolerance As Double = 0.000001) As Boolean
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If legB <= 0 Then Throw New ArgumentException("Seite b muss größer als 0 sein.", NameOf(legB))
- If legD <= 0 Then Throw New ArgumentException("Seite d muss größer als 0 sein.", NameOf(legD))
- If tolerance <= 0 Then Throw New ArgumentException("Die Toleranz muss größer als 0 sein.", NameOf(tolerance))
+ If legB <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(legB))
+ End If
+ If legD <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(legD))
+ End If
+ If tolerance <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveTolerance, NameOf(tolerance))
+ End If
Return Math.Abs(legB - legD) <= tolerance
End Function
@@ -140,9 +178,15 @@ Namespace TwoDimensional
''' Array mit 4 Eckpunkten im Uhrzeigersinn
Public Shared Function VerticesFromCenter(cx As Double, cy As Double, baseA As Double, baseB As Double, height As Double, rotationRadians As Double) As PointF()
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If baseA <= 0 Then Throw New ArgumentException("Grundseite a muss größer als 0 sein.", NameOf(baseA))
- If baseB <= 0 Then Throw New ArgumentException("Grundseite c muss größer als 0 sein.", NameOf(baseB))
- If height <= 0 Then Throw New ArgumentException("Höhe muss größer als 0 sein.", NameOf(height))
+ If baseA <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(baseA))
+ End If
+ If baseB <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(baseB))
+ End If
+ If height <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveHeight, NameOf(height))
+ End If
Dim halfA = baseA / 2.0
Dim halfB = baseB / 2.0
@@ -213,7 +257,9 @@ Namespace TwoDimensional
Public Shared Function IsTrapezoidFromVertices(vertices As PointF(), Optional tolerance As Double = 0.000001) As Boolean
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
ValidateVertices(vertices)
- If tolerance <= 0 Then Throw New ArgumentException("Die Toleranz muss größer als 0 sein.", NameOf(tolerance))
+ If tolerance <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveTolerance, NameOf(tolerance))
+ End If
Dim ab = New PointF(vertices(1).X - vertices(0).X, vertices(1).Y - vertices(0).Y)
Dim bc = New PointF(vertices(2).X - vertices(1).X, vertices(2).Y - vertices(1).Y)
@@ -232,8 +278,12 @@ Namespace TwoDimensional
Private Shared Sub ValidateVertices(vertices As PointF())
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If vertices Is Nothing Then Throw New ArgumentException("Die Eckpunkte dürfen nicht Nothing sein.", NameOf(vertices))
- If vertices.Length <> 4 Then Throw New ArgumentException("Es müssen genau 4 Eckpunkte angegeben werden.", NameOf(vertices))
+ If vertices Is Nothing Then
+ Throw New ArgumentException(My.Resources.CheckVerticesNotNull, NameOf(vertices))
+ End If
+ If vertices.Length <> 4 Then
+ Throw New ArgumentException(My.Resources.RequireExactlyFourVertices, NameOf(vertices))
+ End If
End Sub
Private Shared Function Distance(p1 As PointF, p2 As PointF) As Double
diff --git a/Geometry/TwoDimensional/Triangle.vb b/Geometry/TwoDimensional/Triangle.vb
index b106c76..6d6a4e1 100644
--- a/Geometry/TwoDimensional/Triangle.vb
+++ b/Geometry/TwoDimensional/Triangle.vb
@@ -28,8 +28,12 @@ Namespace TwoDimensional
''' Fläche b * h / 2
Public Shared Function Area(b As Double, h As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If b < 0 Then Throw New ArgumentException("Grundseite darf nicht negativ sein.", NameOf(b))
- If h < 0 Then Throw New ArgumentException("Höhe darf nicht negativ sein.", NameOf(h))
+ If b < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeSide, NameOf(b))
+ End If
+ If h < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeHeight, NameOf(h))
+ End If
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
Return (b * h) / 2.0
@@ -57,8 +61,12 @@ Namespace TwoDimensional
''' Höhe 2 * area / b
Public Shared Function HeightFromArea(area As Double, b As Double) As Double
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If area < 0 Then Throw New ArgumentException("Fläche darf nicht negativ sein.", NameOf(area))
- If b <= 0 Then Throw New ArgumentException("Grundseite muss größer als 0 sein.", NameOf(b))
+ If area < 0 Then
+ Throw New ArgumentException(My.Resources.CheckNonNegativeArea, NameOf(area))
+ End If
+ If b <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(b))
+ End If
#Disable Warning IDE0047 ' Unnötige Klammern entfernen
Return (2.0 * area) / b
@@ -95,7 +103,7 @@ Namespace TwoDimensional
Dim cosValue = ((adjacent1 * adjacent1) + (adjacent2 * adjacent2) - (opposite * opposite)) / denominator
If cosValue < -1.0 OrElse cosValue > 1.0 Then
- Throw New ArgumentException("Die angegebenen Seiten bilden kein gültiges Dreieck.")
+ Throw New ArgumentException(My.Resources.InvalidTriangleSides)
End If
Return Math.Acos(cosValue)
@@ -168,7 +176,9 @@ Namespace TwoDimensional
''' True, wenn die Fläche größer als die Toleranz ist
Public Shared Function IsValidTriangleFromVertices(vertices As PointF(), Optional tolerance As Double = 0.000001) As Boolean
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If tolerance <= 0 Then Throw New ArgumentException("Die Toleranz muss größer als 0 sein.", NameOf(tolerance))
+ If tolerance <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveTolerance, NameOf(tolerance))
+ End If
ValidateVertices(vertices)
Return AreaFromVertices(vertices) > tolerance
@@ -180,19 +190,28 @@ Namespace TwoDimensional
Private Shared Sub ValidateSides(a As Double, b As Double, c As Double)
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If a <= 0 Then Throw New ArgumentException("Seite a muss größer als 0 sein.", NameOf(a))
- If b <= 0 Then Throw New ArgumentException("Seite b muss größer als 0 sein.", NameOf(b))
- If c <= 0 Then Throw New ArgumentException("Seite c muss größer als 0 sein.", NameOf(c))
-
+ If a <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(a))
+ End If
+ If b <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(b))
+ End If
+ If c <= 0 Then
+ Throw New ArgumentException(My.Resources.CheckPositiveSide, NameOf(c))
+ End If
If a + b <= c OrElse a + c <= b OrElse b + c <= a Then
- Throw New ArgumentException("Die angegebenen Seiten bilden kein gültiges Dreieck.")
+ Throw New ArgumentException(My.Resources.InvalidTriangleSides)
End If
End Sub
Private Shared Sub ValidateVertices(vertices As PointF())
' Prüft Eingaben und führt den Berechnungsschritt dieser Methode aus.
- If vertices Is Nothing Then Throw New ArgumentException("Die Eckpunkte dürfen nicht Nothing sein.", NameOf(vertices))
- If vertices.Length <> 3 Then Throw New ArgumentException("Es müssen genau 3 Eckpunkte angegeben werden.", NameOf(vertices))
+ If vertices Is Nothing Then
+ Throw New ArgumentException(My.Resources.CheckVerticesNotNull, NameOf(vertices))
+ End If
+ If vertices.Length <> 3 Then
+ Throw New ArgumentException(My.Resources.RequireExactlyThreeVertices, NameOf(vertices))
+ End If
End Sub
Private Shared Function Distance(p1 As PointF, p2 As PointF) As Double
diff --git a/ResXManager.config.xml b/ResXManager.config.xml
new file mode 100644
index 0000000..a186864
--- /dev/null
+++ b/ResXManager.config.xml
@@ -0,0 +1,4 @@
+
+
+ de-DE
+True
\ No newline at end of file