home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 22 / PC Actual CD 22.iso / SHARE / prog / POVRAY / STAR.ZIP / star.inc < prev    next >
Encoding:
Text File  |  1997-08-15  |  1.7 KB  |  69 lines

  1. /*
  2.  
  3.     STAR OBJECT INCLUDE FILE v1.0 - main include file
  4.     Copyright (C) 1997 Thomas Willhalm
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; either version 2 of the License, or
  9.     (at your option) any later version.
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20.  
  21. */
  22.  
  23. /*
  24.     Declare star object with given number of vertices
  25.  
  26.     Usage:
  27.     PRE: <s_nmb>     number of vertices (default is 0.05)
  28.              <s_rad>     radius of edges
  29.              <s_maj>     radius of the star (default is 1)
  30.         POST: <star> contains the star
  31.         SIDE: <s_pos> altered
  32.  
  33. */
  34.  
  35. #ifndef (s_maj)
  36.   #declare s_maj=1
  37. #end
  38. #ifndef (s_rad)
  39.   #declare s_rad=0.05
  40. #end
  41.  
  42. #if (s_nmb=4)
  43.   #declare star =
  44.     union {
  45.       #declare s_pos=0
  46.       #while (s_pos<s_nmb)
  47.     sphere { y*s_maj,s_rad rotate 90*s_pos*x}
  48.     cylinder{ 
  49.       y*s_maj, vaxis_rotate(y*s_maj,x,90), s_rad 
  50.       rotate 90*s_pos*x
  51.     }
  52.         #declare s_pos = s_pos+1
  53.       #end
  54.     }
  55. #else
  56.   #declare star =
  57.     union {
  58.       #declare s_pos=0
  59.       #while (s_pos<s_nmb)
  60.     sphere { y*s_maj,s_rad rotate 360/s_nmb*s_pos*x}
  61.     cylinder{ 
  62.       y*s_maj, vaxis_rotate(y*s_maj,x,360/s_nmb*2), s_rad 
  63.       rotate 360/s_nmb*s_pos*x
  64.     }
  65.         #declare s_pos = s_pos+1
  66.       #end
  67.     }
  68. #end
  69.