|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I have a question about povray data typing.
I would like to write a general macro that would take an array and
output it either to standard output or to a file. The fact is that I
don't know if the elements are float values, vectors, objects or
transforms (which couldn't be output of course), or even others arrays.
So my question is : is there a way to know ??
Thanks,
JC
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
JC (Exether) wrote:
> I have a question about povray data typing.
>
> I would like to write a general macro that would take an array and
> output it either to standard output or to a file. The fact is that I
> don't know if the elements are float values, vectors, objects or
> transforms (which couldn't be output of course), or even others arrays.
>
> So my question is : is there a way to know ??
The next version of MegaPOV will contain a feature to determine the type
of a variable.
Christoph
--
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 25 Oct. 2003 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
That's great ! Is it going to be included in the official version some
time too ?
I was actually trying to do a bit more than just printing an array, I
wanted to write some general data structuring macros with type creation,
object instanciation and save/load. So I'm looking forward this feature. :-)
JC
Christoph Hormann wrote:
> JC (Exether) wrote:
>
>> I have a question about povray data typing.
>>
>> I would like to write a general macro that would take an array and
>> output it either to standard output or to a file. The fact is that I
>> don't know if the elements are float values, vectors, objects or
>> transforms (which couldn't be output of course), or even others arrays.
>>
>> So my question is : is there a way to know ??
>
>
> The next version of MegaPOV will contain a feature to determine the type
> of a variable.
>
> Christoph
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Mon, 10 Nov 2003 07:19:09 +0100, "JC (Exether)" <no### [at] spamfr> wrote:
> That's great ! Is it going to be included in the official version some
> time too ?
I doubt it will be derived directly because it's kind of hack, but POV 4.0 is
supposed to be rewritten so nobody knows what will be included.
> I was actually trying to do a bit more than just printing an array, I
> wanted to write some general data structuring macros with type creation,
Well.. having arrays you can workaround it having second array with types
identification constants at the same positions. Look at below untested sample:
#declare UNDEFINED_TYPE = 0;
#declare STRING_TYPE = 1;
#declare FLOAT_TYPE = 2;
#declare OBJECT_TYPE = 3;
#macro Store(Value,Type)
#local A=array[2];
#local A[0]=array[1];
#local A[1]=array[1];
#local A[0][0]=Value;
#local A[1][0]=Type;
A
#end
#macro Store_String(String)
Store(String,STRING_TYPE)
#end
#macro Store_Float(Float)
Store(Float,FLOAT_TYPE)
#end
#macro Store_Object(Object)
Store(Object,OBJECT_TYPE)
#end
#macro Type_Of(Entry)
#local Type = UNDEFINED_TYPE;
#ifdef(Entry)
#ifdef(Entry[1])
#local A=Entry[1];
#ifdef(A[0])
#local Type = A[0];
#endif
#endif
#endif
Type
#end
#macro Is(Entry,Type)
( Type_Of(Entry) = Type )
#end
#macro Is_String(Entry)
Is(Entry,STRING_TYPE)
#end
#macro Is_Float(Entry)
Is(Entry,FLOAT_TYPE)
#end
#macro Is_Object(Entry)
Is(Entry,OBJECT_TYPE)
#end
#declare Array=array[10]; // Ten values
#declare Array[0] = StoreString( "test" );
#declare Array[1] = StoreFloat( 3.1415926 );
#declare Array[2] = StoreObject( sphere{ 0 1 } );
#if ( Is_String( Array[0] ) )
#debug "Array[0] is string\n"
#endif
> object instanciation and save/load. So I'm looking forward this feature. :-)
Thanks for patience :-)
ABX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|