VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsHalbkugel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Public n_Radius As Single
Dim R As Single, Ysz As Single, c As Single
Private Const Pi = 3.141592654

Public Property Get Radius() As Single  'Lesen
  Radius = n_Radius
End Property

Public Property Let Radius(ByVal sNeuRadius As Single)  'Schreiben
  n_Radius = sNeuRadius
End Property

Public Property Get Volumen() As Single
  Volumen = 4 / 3 * Radius ^ 3 * Pi / 2
End Property

Public Property Let Volumen(ByVal sNeuVolumen As Single)
  Radius = (3 * sNeuVolumen / 4 / Pi) ^ (1 / 3)
End Property

Public Property Get Oberflaeche() As Single
  Oberflaeche = 3 * Radius ^ 2 * Pi
End Property

Public Property Let Oberflaeche(ByVal sNeuOberflaeche As Single)
  Radius = Sqr(sNeuOberflaeche / 3 / Pi)
End Property

Public Property Get Ys() As Single
  Ys = 0.375 * Radius
End Property

Public Property Let Ys(ByVal sNeuYs As Single)
  Radius = sNeuYs / 0.375
End Property

Public Sub ZeichneHalbkugel()
  R = Radius
  'In Abhängigkeit von R wird ein Wert c bestimmt, der
  'die Ausnutzung der PictureBox immer einigermaßen
  'günstig ergibt. Weitere Verfeinerung ist möglich.
  'In jedem Fall ist so die Darstellung immer maßstäblich.
  'Allerdings ist darauf zu achten, dass die Höhe der
  'PictureBox ca. = Breite / 2 beträgt. Height ca. Width/2
  If R < 200 Then
    c = 30
  ElseIf R < 100 Then
    c = 15
  ElseIf R < 50 Then
    c = 5
  ElseIf R < 20 Then
    c = 1
  Else
    c = 40
  End If
  Form1.Picture1.Scale (-R - c, R + c)-(R + c, -c / 2)
  Form1.Picture1.Cls
  Form1.Picture1.Circle (0, 0), R, QBColor(9), -0.000001, -Pi
  Form1.Picture1.Line (-R, 0)-(R, 0), QBColor(10)
  Form1.Picture1.Line (0, 0)-(0, Ys), QBColor(12)
  Form1.Picture1.Circle (0, Ys), 1, QBColor(15)
  Form1.Picture1.CurrentY = Ys - 2
  Form1.Picture1.CurrentX = 2
  Form1.Picture1.Print "Ys = "; Ys
End Sub
