POV-Ray : Newsgroups : povray.advanced-users : How to address last 2 components of 5-component vectors? : Re: How to address last 2 components of 5-component vectors? Server Time
3 May 2024 15:25:24 EDT (-0400)
  Re: How to address last 2 components of 5-component vectors?  
From: clipka
Date: 16 Jul 2016 09:08:16
Message: <578a31c0$1@news.povray.org>
Am 16.07.2016 um 14:47 schrieb Bald Eagle:

> I tried to implement the (partial) example code on the referenced documentation
> page by issuing the directive:
> 
> #debug concat( "fn_Pigm(1, 2, 3).hf  = ", str(fn_Pigm(1, 2, 3).hf, 3, 0),
> "\n\n")
> 
> [ At first I used it literally, as:
> 
> #debug concat( "fn_Pigm().hf  = ", str(fn_Pigm().hf, 3, 0), "\n\n")
> 
> even though I expected, and got, an error:
> .....VectorComponents.pov" line 44: Parse Error: Expected 'numeric expression', )
> found instead
> 
> so the docs should clarify the need for a vector argument]

Uh... there is nothing missing in the docs there. fn_Pigm() is a
function, and therefore requires parameters when invoked. Simple as that.

> and got:
> 
> ..... VectorComponents.pov" line 41: Parse Error: Expected 'x, y, z or color
> component', undeclared identifier 'hf' found instead

That is to be expected; as mentioned before, '.hf' is only available in
functions.


> I cannot do:
> 
> #declare fn_Pigm =
> function {
> pigment {Pigment}.hf
> } // end function

You need to do:

#declare fn_Pigm = function { pigment { Pigment } }
#declare fn_Hf = function { fn_Pigm(x,y,z).hf }

The first line declares a pigment function, which returns a colour
(well, actually I think it's a vector; but since I haven't examined the
code closely, I'm not exactly sure).

The second line invokes the function, computes the .hf value from the
resulting colour, and returns it as a scalar.


Post a reply to this message

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