Advertisement
jargon

basKealTrig.bas

Feb 23rd, 2013
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Attribute VB_Name = "basKealTrig"
  2. 'pi=3.14159263:for theta=0 to 1 step 1/64:print fix(theta*64),fix(kealtheta(cos(2*pi*theta),sin(2*pi*theta))*64):next theta
  3. Public Function KealTheta(tx As Variant, ty As Variant) As Double
  4.    
  5.     Dim tmpb As Double
  6.     Dim x As Double, y As Double
  7.     x = tx
  8.     y = ty
  9.    
  10.     tmpb = CBoolSwitch(Abs(y) > Abs(x), Abs(y), Abs(x))
  11.    
  12.     Select Case tmpb
  13.     Case 0
  14.         Exit Function
  15.     Case Else
  16.         KealTheta = CBoolSwitch(tmpb = Abs(y), CBoolSwitch(y < 0, 6 * tmpb + x, 2 * tmpb - x), CBoolSwitch(x < 0, 4 * tmpb - y, CBoolSwitch(y < 0, 8 * tmpb + y, y))) / tmpb / 8
  17.     End Select
  18.  
  19. End Function
  20.  
  21. Public Function KealResetX(x1 As Variant, y1 As Variant, y2 As Variant) As Double
  22.    
  23.     KealResetX = x1 * y2 / y1
  24.    
  25. End Function
  26.  
  27. Public Function KealResetY(x1 As Variant, y1 As Variant, x2 As Variant) As Double
  28.    
  29.     KealResetY = y1 * x2 / x1
  30.    
  31. End Function
  32.  
  33. Public Function KealOf1(Value As Variant) As Double
  34.        
  35.     KealOf1 = (1 + (Value - Fix(Value))) - Fix((1 + (Value - Fix(Value))))
  36.    
  37. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement