POV-Ray : Newsgroups : povray.advanced-users : Write to file example needed : Write to file example needed Server Time
30 Jul 2024 10:15:12 EDT (-0400)
  Write to file example needed  
From: Ken
Date: 17 Aug 1999 01:00:29
Message: <37B8EC59.9E201405@pacbell.net>
As the subject says could someone be so kind as to provide me with an
example of how to set up the macro below to write the macros output to a
file. Preferably with an optional switch to either render the file OR
write the file. Yeah I checked the docs but my attempts have yet so far
yielded poor results.

Thank you,


  #version 3.1

  #macro Diamond (NumSides, TopRadius, TopHeight, CentreRadius, BottomDepth)
  mesh{
  #local ARK       =  pi / NumSides      ;
  #declare //#local
  BottomTip = <0, -BottomDepth, 0>;
  #local TopCentre = <0,    TopHeight, 0>;
  #local LongSide  =  true               ;
  #local CurrentPoint = <cos(-2.5*ARK), 0, sin(-2.5 * ARK)>     ;

  #local P1           = CurrentPoint*CentreRadius               ;
  #local P2           = CurrentPoint*TopRadius + (y * TopHeight);

  #local  C            = -1.5*ARK;
  #while (C < ((2*pi)+(-2.5*ARK)))
  #if    (LongSide     = true )
  #local  CurrentPoint = <cos(C), 0, sin(C)>;
  #else
  #local  CurrentPoint = <cos(C + ARK), 0, sin(C + ARK)>;
  #end

  #local P3 = CurrentPoint*CentreRadius           ;
  #local P4 = CurrentPoint*TopRadius+(y*TopHeight);

  triangle {       P1,P3, BottomTip}
  triangle {       P1,P3,        P4}
  triangle {       P1,P4,        P2}
  triangle {TopCentre,P4,        P2}

  #local P1 = P3;
  #local P2 = P4;
  #local LongSide = (LongSide = true ? false : true);

  #local C = C + (ARK * 2);
  #end }
  #end

  // --- End File ---------------------------------------



-- 
Ken Tyler

See my 700+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.