home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "mdSineWave"
- Option Explicit
-
- Global Const pi = 3.14159265358979
-
- Public Type OrderedPair
- X As Currency
- Y As Currency
- End Type
-
- Global Const WV_SIN = 0
- Global Const WV_COS = 1
- Global Const WV_TAN = 2
- Global Const WV_SEC = 3
- Global Const WV_CSC = 4
- Global Const WV_COT = 5
- Global Const WV_0 = "SIN"
- Global Const WV_1 = "COS"
- Global Const WV_2 = "TAN"
- Global Const WV_3 = "SEC"
- Global Const WV_4 = "CSC"
- Global Const WV_5 = "COT"
-
- Public CenterPoint As OrderedPair
- Public Squares As OrderedPair
- Public PixelUnit As Integer
- Public UnitMode As Long
-
- Public WvHigh As Currency
- Public WvWide As Currency
- Public WvXPos As Currency
- Public WvYPos As Currency
- Public WvXMult As Currency
- Public WvType As Integer
-
- Public Function Cosine(ByVal i As Double) As Double
- Cosine = Cos(i * (pi / 180))
- End Function
-
- Public Function Sine(ByVal i As Double) As Double
- Sine = Sin(i * (pi / 180))
- End Function
-
- Public Function Tangent(ByVal i As Double) As Double
- Tangent = Tan(i * (pi / 180))
- End Function
-
- Public Function Secant(ByVal i As Double) As Double
- Secant = 1 / Cosine(i)
- End Function
-
- Public Function Cosecant(ByVal i As Double) As Double
- Cosecant = 1 / Sine(i)
- End Function
-
- Public Function Cotangent(ByVal i As Double) As Double
- Cotangent = 1 / Tangent(i)
- End Function
-
- Public Function Wave(ByVal i As Double) As Double
- Select Case WvType Mod 6
- Case WV_SIN
- Wave = Sine(i)
- Case WV_COS
- Wave = Cosine(i)
- Case WV_TAN
- Wave = Tangent(i)
- Case WV_SEC
- Wave = Secant(i)
- Case WV_CSC
- Wave = Cosecant(i)
- Case WV_COT
- Wave = Cotangent(i)
- End Select
- End Function
-
- Public Function WaveName() As String
- WvType = WvType Mod 6
- If WvType = 0 Then WaveName = WV_0
- If WvType = 1 Then WaveName = WV_1
- If WvType = 2 Then WaveName = WV_2
- If WvType = 3 Then WaveName = WV_3
- If WvType = 4 Then WaveName = WV_4
- If WvType = 5 Then WaveName = WV_5
- End Function
-
- Function GetType(Wave As String) As Integer
- If Trim(UCase(Wave)) = WV_0 Then
- GetType = 0
- ElseIf Trim(UCase(Wave)) = WV_1 Then
- GetType = 1
- ElseIf Trim(UCase(Wave)) = WV_2 Then
- GetType = 2
- ElseIf Trim(UCase(Wave)) = WV_3 Then
- GetType = 3
- ElseIf Trim(UCase(Wave)) = WV_4 Then
- GetType = 4
- ElseIf Trim(UCase(Wave)) = WV_5 Then
- GetType = 5
- Else
- GetType = 0
- End If
- End Function
-
- Public Function GetGraphPos(Point As OrderedPair) As OrderedPair
- GetGraphPos.X = Point.X + CenterPoint.X
- GetGraphPos.Y = Point.Y + CenterPoint.Y
- End Function
-
- Public Function GetWaveY(X As Currency) As Currency
- GetWaveY = (Wave(X) * PixelUnit * -WvHigh)
- End Function
-
- Function Distance(Point1 As OrderedPair, Point2 As OrderedPair) As Currency
- Dim X As Currency, Y As Currency
- X = (Point1.X - Point2.X) ^ 2
- Y = (Point1.Y - Point2.Y) ^ 2
- Distance = Sqr(X + Y)
- End Function
-
- Function GetSign(Number As Currency) As Integer
- GetSign = Number / Abs(Number)
- End Function
-