home *** CD-ROM | disk | FTP | other *** search
/ Learning Maya 3 / Learning_Maya_3.iso / docs / mel_scripts / includes / spiral.mel < prev    next >
Encoding:
Text File  |  2000-05-17  |  1.7 KB  |  46 lines

  1. //
  2. // Copyright (C) 1997-2000 Alias|Wavefront,
  3. // a division of Silicon Graphics Limited.
  4. //
  5. // The information in this file is provided for the exclusive use of the
  6. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  7. // and incorporate this code into other products for purposes authorized
  8. // by the Alias|Wavefront license agreement, without fee.
  9. //
  10. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  11. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  12. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  13. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  14. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. // PERFORMANCE OF THIS SOFTWARE.
  17. //
  18. // Alias|Wavefront Script File
  19. // MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //
  22. //    Description:
  23. //        This proc creates a spiral centred about the origin, with a specific
  24. //        height, radius and number of rounds/turns/cycles.
  25. //
  26. //        This is done by creating a cylinder of the correct size, then
  27. //        creating a curve-on-surface on the cylinder (which is in
  28. //        the form of a spiral), then duplicating the curve-on-surface
  29. //        to get a 3D spiral.
  30. //    example: 
  31. //        spiral 5 1 10
  32. //
  33. global proc string spiral( float $ht, float $radius, float $numRounds )
  34.  
  35. {
  36.     string $cylinder[] = `cylinder -ch off -ax 0 1 0 -p 0 0 0 -r 1.0 -hr 1.0`;
  37.     scale $radius $ht $radius $cylinder[0];
  38.     string $cos = `curveOnSurface -d 1 -uv 0.0 0.0 -uv 1.0 ($numRounds*8.0) $cylinder[0]`;
  39.     string $duplicatedCrv[] = `duplicateCurve -ch off $cos`;
  40.  
  41.     delete $cos;
  42.     delete $cylinder[0];
  43.  
  44.     return $duplicatedCrv[0];
  45. }
  46.