POV-Ray : Newsgroups : povray.advanced-users : distinguishing types in scene language Server Time
16 Jun 2024 02:31:08 EDT (-0400)
  distinguishing types in scene language (Message 11 to 13 of 13)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Mark Wagner
Subject: Re: distinguishing types in scene language
Date: 8 Oct 2000 00:37:37
Message: <39dffa11$1@news.povray.org>
Chris Huff wrote in message ...
>it may be that everything is stored internally as
>5-component vectors, but I do not think so.(I know the expression parser
>uses these 5D vectors in some areas, but I really don't understand it
>well enough.)

All colors are stored as 5D vectors.  I think that the parameters for a
julia_fractal are stored as 4D vectors, but I'm not absolutely sure on this.
3D and 2D vectors are both stored as 3D.


Mark


Post a reply to this message

From: Neil Freebairn
Subject: Re: distinguishing types in scene language
Date: 9 Oct 2000 12:27:55
Message: <39e1f20b@news.povray.org>
That's exactly what I was looking for. Very elegant, many thanks.

I also agree with other contributors that a more generic solution would be
very useful.

Neil

Ron Parker <ron### [at] povrayorg> wrote in message
news:slr### [at] fwicom...
> On Sun, 24 Sep 2000 22:08:05 +0100, Neil Freebairn wrote:
> >Is there any way to tell a identifier which evaluates to a vector from an
> >identifier which evaluates to a real?
>
> (reply confined to advanced-users, which is the most appropriate of the
> crossposted groups.)
>
> If what you're going to get is guaranteed to be either a scalar or a 3-d
> vector, you can do something like this:
>
> #macro scalar_or_vector( A )
>
>   #declare C = rgbft 0 + A;
>
>   #if ( C.filter = C.red )
>     #debug "scalar\n"
>   #else
>     #debug "vector\n"
>   #end
>
> #end
>
>
> --
> Ron Parker   http://www2.fwi.com/~parkerr/traces.html
> My opinions.  Mine.  Not anyone else's.
> Proudly not helping RIAA and SDMI steal my rights --
>   http://www.eff.org/Misc/EFF/Newsletters/EFFector/HTML/effect13.08.html


Post a reply to this message

From: Ron Parker
Subject: Re: distinguishing types in scene language
Date: 9 Oct 2000 12:48:20
Message: <slrn8u3thn.1n1.ron.parker@fwi.com>
On Mon, 9 Oct 2000 17:27:07 +0100, Neil Freebairn wrote:
>That's exactly what I was looking for. Very elegant, many thanks.
>

Looking at it now, I see that there will be a couple of problems.  First,
it can't properly deal with vectors with an X value of zero.  If you fix that
by testing the green or blue values as well, it still can't properly deal
with zero vectors.  To fix it, make another local that's equal to
rgbft 0 + (1 + A) ,
then compare that vector's red and filter components as well.  Only if both
comparisons are equal is it a scalar (because 1+A is either a vector or a 
scalar, whichever A was, and either A or 1+A is going to have a nonzero X
component.)

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.
Proudly not helping RIAA and SDMI steal my rights -- 
  http://www.eff.org/Misc/EFF/Newsletters/EFFector/HTML/effect13.08.html


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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