home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH9 / SRC / DSPIRAL.CLS < prev    next >
Encoding:
Text File  |  1995-11-15  |  697 b   |  30 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "DistortSpiral"
  6. Attribute VB_Creatable = False
  7. Attribute VB_Exposed = False
  8. Option Explicit
  9.  
  10. ' The center about which to twist.
  11. Public cx As Single
  12. Public cz As Single
  13.  
  14. ' ************************************************
  15. ' Apply a shape distorting transformation to
  16. ' the point.
  17. ' ************************************************
  18. Sub Distort(x As Single, y As Single, z As Single)
  19. Dim r As Single
  20. Dim dx As Single
  21. Dim dz As Single
  22.  
  23.     dx = x - cx
  24.     dz = z - cz
  25.     r = Sqr(dx * dx + dz * dz) / 50 / 3.14
  26.     
  27.     x = cx + dx * Sin(r) - dz * Cos(r)
  28.     z = cz + dx * Cos(r) + dz * Sin(r)
  29. End Sub
  30.