home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / p / ply15dat.zip / SECTORL.PI < prev    next >
Text File  |  1992-09-20  |  856b  |  36 lines

  1. // Set up the camera
  2. viewpoint {
  3.    from <0,2,-5>
  4.    at <0,0,0>
  5.    up <0,1,0>
  6.    angle 30
  7.    resolution 160, 160
  8.    }
  9.  
  10. // Set up background color & lights
  11. background SkyBlue
  12. light <10, 20, -30>
  13. include "..\colors.inc"
  14.  
  15. // Conversion from polar to rectangular (for a left-handed
  16. // coordinate system):
  17. //
  18. //  r     = sqrt(x^2 + y^2 + z^2),
  19. //  theta = atan(y/x),
  20. //  phi   = atan(sqrt(x^2 + y^2)/z)
  21. //
  22. // Surface is:
  23. //   r = 1 + c * LegendreP(3,0,cos(phi))*cos(n*theta)
  24. //   r = 1 + c * 2.5 * cos(phi)^3 - 1.5 * cos(phi)
  25. // For this surface, use c = 0.2
  26.  
  27. // Define a zonal harmonic surface
  28. define theta atan(y/x)
  29. define phi atan(sqrt(x^2 + z^2)/y)
  30. define r sqrt(x^2 + y^2 + z^2)
  31. object {
  32.    function r - (1 + (0.5 * cos(phi)^3 - 0.3 * cos(phi)) * cos(3 * theta))
  33.    shiny_red
  34.    bounding_box <-2, -2, -2>, <2, 2, 2>
  35.    }
  36.