POV-Ray : Newsgroups : povray.advanced-users : Help with eval_pigment Server Time
29 Jul 2024 10:20:09 EDT (-0400)
  Help with eval_pigment (Message 1 to 4 of 4)  
From: Alf Peake
Subject: Help with eval_pigment
Date: 11 Mar 2002 18:46:35
Message: <3c8d41db$1@news.povray.org>
v3.5 question.

The docs say that eval_pigment() evaluates the color of a pigment. Am
I wrong in treating this as a vector?  If not, what am I doing here
that annoys vlength() or sqrt(vdot(,)) in 3.5? It worked fine in
MegaPov 0.7.

I'm using WinPOV-Ray 3.5b12, Win98SE, Celeron 500 and 160MB.

Alf

--8<---------8<---------

#include "functions.inc" // Remove this line in MegaPov
#declare Map9 = pigment{ image_map{ png "test"} }
#declare Pig9 = eval_pigment( pigment{ Map9 }, <0.5, 0.5, 0>);
//#declare Pig9 = <0.5, 0.6, 0.7>; // This line is OK

// Next line is OK and also using Pig9.green
#debug concat( "\n .y = ", str( Pig9.y, 0, 3),"\n" )
// Next is OK in MegaPov 0.7 but not in Pov 3.5
#debug concat( " vlength = ",str( vlength( Pig9 ), 0, 3),"\n" )

sphere{0,0 pigment{ rgb 0 } } // Kills "no objects ..."

/*
Pov 3.5 Error message, cursor stops on "9":
#debug concat( " vlength = ",str( vlength( Pig9 ) <----ERROR
Parse Error: Vector expected but color expression found.
*/


Post a reply to this message

From:
Subject: Re: Help with eval_pigment
Date: 12 Mar 2002 02:23:17
Message: <osar8u4ker5unsukmajr3vgi04i0est69l@4ax.com>
On Mon, 11 Mar 2002 23:42:13 -0000, "Alf Peake" <alf### [at] peake42freeservecouk>
wrote:
> The docs say that eval_pigment() evaluates the color of a pigment. Am
> I wrong in treating this as a vector?

Yes. Look into documentation to compare number of components inside vector and
inside color.

But You can convert rgb color value to xyz vector with simple macro:

#macro RGB2XYZ(Color)
  <Color.red,Color.green,Color.blue>
#end

ABX


Post a reply to this message

From: Mike Williams
Subject: Re: Help with eval_pigment
Date: 12 Mar 2002 02:54:46
Message: <ywebjCA$Obj8EwlZ@econym.demon.co.uk>
Wasn't it Alf Peake who wrote:
>v3.5 question.
>
>The docs say that eval_pigment() evaluates the color of a pigment. Am
>I wrong in treating this as a vector?  If not, what am I doing here
>that annoys vlength() or sqrt(vdot(,)) in 3.5? It worked fine in
>MegaPov 0.7.

In 3.5, colours are 5d vectors (red, blue, green, filter, transmit), but
vlength only works with 3d vectors.

You can either convert your colour to a 3d vector
        vlength(<Pig9.x,Pig9.y,Pig9.z>)
or use VLength5D from "math.inc"
        VLength5D(Pig9)
If filter and transmit both happen to be zero, the two methods give the
same value.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Alf Peake
Subject: Re: Help with eval_pigment
Date: 12 Mar 2002 10:46:50
Message: <3c8e22ea@news.povray.org>
Thank you Mike and ABX.

Yes, I had seen about 5D vectors in the docs but my brain seems to
have ignored that info :-/  I had a workaround but wanted to check to
make sure.

Thanks again

Alf


Post a reply to this message

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