|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ken <tyl### [at] pacbellnet> wrote:
: 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.
Do you mean something like this? If the last parameter is "" then it
just creates the object, else it writes it to the file specified by that
parameter.
#macro Diamond (NumSides, TopRadius, TopHeight, CentreRadius, BottomDepth, Filename)
#if(strcmp(Filename,"")!=0)
#fopen File Filename write
#write(File,"mesh {\n")
#else
mesh {
#end
#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);
#if(strcmp(Filename,"")=0)
triangle { P1, P3, BottomTip }
triangle { P1, P3, P4 }
triangle { P1, P4, P2 }
triangle { TopCentre, P4, P2 }
#else
#write(File," triangle { ",P1,", ",P3,", ",BottomTip," }\n")
#write(File," triangle { ",P1,", ",P3,", ",P4," }\n")
#write(File," triangle { ",P1,", ",P4,", ",P2," }\n")
#write(File," triangle { ",TopCentre,", ",P4,", ",P2," }\n")
#end
#local P1 = P3;
#local P2 = P4;
#local LongSide = (LongSide = true ? false : true);
#local C = C + (ARK * 2);
#end
#if(strcmp(Filename,"")=0)
}
#else
#write(File,"}\n")
#fclose File
#end
#end
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Nieminen Mika wrote:
>
> Ken <tyl### [at] pacbellnet> wrote:
> : 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.
>
> Do you mean something like this? If the last parameter is "" then it
> just creates the object, else it writes it to the file specified by that
> parameter.
>
> #macro Diamond (NumSides, TopRadius, TopHeight, CentreRadius, BottomDepth, Filename)
That looks like it should do it. I'll test it out and if I run into any problems
I let you know. Can I assume that in the file name parameter an extention can
be provided i.e. mesh.inc ?
Thanks for the example Warp.
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Nieminen Mika wrote:
>
> Ken <tyl### [at] pacbellnet> wrote:
> : 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.
>
> Do you mean something like this? If the last parameter is "" then it
> just creates the object, else it writes it to the file specified by that
> parameter.
Is there any way to append to an existing file with the fopen command ?
Just wondering :)
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ken <tyl### [at] pacbellnet> wrote:
: Is there any way to append to an existing file with the fopen command ?
: Just wondering :)
At last I can tell this to you: Read the manual ;)
Yes it is possible. If I remember correctly, you can write "append"
instead of "write" in the #fopen command.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ken <tyl### [at] pacbellnet> wrote:
: Can I assume that in the file name parameter an extention can
: be provided i.e. mesh.inc ?
Why not? Of course you can.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Nieminen Mika wrote:
>
> Ken <tyl### [at] pacbellnet> wrote:
> : Is there any way to append to an existing file with the fopen command ?
>
> : Just wondering :)
>
> At last I can tell this to you: Read the manual ;)
Manual ? Is there a reference to that in the docs ? :)
> Yes it is possible. If I remember correctly, you can write "append"
> instead of "write" in the #fopen command.
thanks,
--
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Take a look under section 4.2.3 in the pov.doc.
Alberto
Ken wrote:
> Nieminen Mika wrote:
> >
> > Ken <tyl### [at] pacbellnet> wrote:
> > : Is there any way to append to an existing file with the fopen command ?
> >
> > : Just wondering :)
> >
> > At last I can tell this to you: Read the manual ;)
>
> Manual ? Is there a reference to that in the docs ? :)
>
> > Yes it is possible. If I remember correctly, you can write "append"
> > instead of "write" in the #fopen command.
>
> thanks,
>
> --
> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Alberto wrote:
>
> Take a look under section 4.2.3 in the pov.doc.
>
> Alberto
I know that :] What I meant is if there is a reference to reading the manual
in the documentation. It was a joke but perhaps poorly worded.
--
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
|
|
| |
| |
|
|
|
|
| |
|
|