POV-Ray : Newsgroups : povray.advanced-users : distinguishing types in scene language : Re: distinguishing types in scene language Server Time
3 May 2024 04:43:00 EDT (-0400)
  Re: distinguishing types in scene language  
From: Chris Huff
Date: 28 Sep 2000 06:58:18
Message: <chrishuff-EEAA78.06003328092000@news.povray.org>
In article <39cf0b83@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>   I don't even think that making a set of functions returing a bool value 
> for this would be hard. For example:
...snip...
>   For exampe isvector() would return true if the parameter is a vector, 
> else false.

I have no idea how to code that, but it should be quite possible. 
However, I think the first thing that would happen is that someone would 
write a macro to put all those functions into one which returns a 
different number or character for each type. Just one function should 
work fine...
type_of(IDENTIFIER)
returns:
    1-float
    2-2D vector
    3-3D vector
    4-color
etc...

Then variables for each type could be put in a standard include...
// types.inc

#declare FLOAT = 1;
#declare VECTOR_2D = 2;
#declare VECTOR_3D = 3;
#declare COLOR = 4;

so you could just use this:

#if(type_of(MyIdentifier) = COLOR)

instead of:

#if(is_color(MyIdentifier))

Not only would it take less keywords, but it would be more flexible and 
nearly as easy to use.(easier in some situations)

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

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