POV-Ray : Newsgroups : povray.advanced-users : How to address last 2 components of 5-component vectors? Server Time
1 Jun 2024 11:54:26 EDT (-0400)
  How to address last 2 components of 5-component vectors? (Message 41 to 46 of 46)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: clipka
Subject: Re: How to address last 2 components of 5-component vectors?
Date: 10 Jul 2016 17:15:00
Message: <5782bad4$1@news.povray.org>
Am 10.07.2016 um 20:32 schrieb William F Pokorny:

> I think I generally understand the promotion and demotion going on when
> colors are expected and we have various floats or vectors as the
> starting point/right-hand-argument.
> 
> When I originally questioned the line:
> 
> [ rgbft ] <5_Term_Vector> |
> 
> it was because our saying rgbft was optional per the brackets in just
> the five term vector case did not make sense to me for a syntax
> specification.
> 
> That "...the missing terms are automatically created from existing input
> when needed" is the point.
> 
> The rgb string is also optional for a float and multiple vector
> specifications. Why is it we are not showing the user it is optional
> with brackets as in [rgb], but doing it for rgbft and the 5 term vector
> case?

Because this allows to put a bit of semantic information between the
lines: If none of the colour keywords is specified at all, behaviour is
as if `rgbft` was used.

The only sensible alternatives (and the ones most closely matching the
actual internal processing) would be to specify either

COLOR_VECTOR:
     rgb <3_Term_Vector>    |
     rgbf <4_Term_Vector>   |
     rgbt <4_Term_Vector>   |
     rgbft <5_Term_Vector>  |
     srgb <3_Term_Vector>   |
     srgbf <4_Term_Vector>  |
     srgbt <4_Term_Vector>  |
     srgbft <5_Term_Vector> |
     <5_Term_Vector>

which loses that between-the-lines information about the semantics, or

COLOR_VECTOR:
     [ rgb | rgbf | rgbt | rgbft | srgb | srgbf | srgbt |
     srgbft ] VECTOR

which discards even more information about the semantics.


Post a reply to this message

From: William F Pokorny
Subject: Re: How to address last 2 components of 5-component vectors?
Date: 11 Jul 2016 08:13:48
Message: <57838d7c$1@news.povray.org>
On 07/10/2016 05:14 PM, clipka wrote:
> Am 10.07.2016 um 20:32 schrieb William F Pokorny:
>>
>> The rgb string is also optional for a float and multiple vector
>> specifications. Why is it we are not showing the user it is optional
>> with brackets as in [rgb], but doing it for rgbft and the 5 term vector
>> case?
>
> Because this allows to put a bit of semantic information between the
> lines: If none of the colour keywords is specified at all, behaviour is
> as if `rgbft` was used.
>
> The only sensible alternatives (and the ones most closely matching the
> actual internal processing) would be to specify either
>
> COLOR_VECTOR:
>       rgb <3_Term_Vector>    |
>       rgbf <4_Term_Vector>   |
>       rgbt <4_Term_Vector>   |
>       rgbft <5_Term_Vector>  |
>       srgb <3_Term_Vector>   |
>       srgbf <4_Term_Vector>  |
>       srgbt <4_Term_Vector>  |
>       srgbft <5_Term_Vector> |
>       <5_Term_Vector>
>
> which loses that between-the-lines information about the semantics, or
>
> COLOR_VECTOR:
>       [ rgb | rgbf | rgbt | rgbft | srgb | srgbf | srgbt |
>       srgbft ] VECTOR
>
> which discards even more information about the semantics.
>
Alright. Thanks everyone for the time spent due my question.

Bill P.


Post a reply to this message

From: Bald Eagle
Subject: Re: How to address last 2 components of 5-component vectors?
Date: 16 Jul 2016 08:50:01
Message: <web.578a2ce4ff0686005e7df57c0@news.povray.org>
> No error for that page, as it is a page about function{}. Just you cannot use .hf
outside of function{}.


Sorry to keep this thing going for this long, but perhaps someone can post some
working code to clarify HOW to use .hf "IN" (a) function.

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]

and got:

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

doing:

#declare Pigment =
 pigment {
  agate
  color_map {
   [0 color rgb 0]
   [1 color rgb 1]
  } // end color map
 } // end pigment

#declare fn_Pigm =
function {
pigment {Pigment}
} // end function

I cannot do:

#declare fn_Pigm =
function {
pigment {Pigment}.hf
} // end function

.... VectorComponents.pov" line 41: Parse Error: No matching } in '{', . (period)
found instead

or:

#declare fn_Pigm =
function {
pigment {Pigment.hf}
} // end function

.... VectorComponents.pov" line 41: Parse Error: No matching } in 'pigment', .
(period) found instead


Since so much has been covered and clarified, I just wanted to address this one
last (?) loose thread.


Post a reply to this message

From: clipka
Subject: Re: How to address last 2 components of 5-component vectors?
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

From: Thomas de Groot
Subject: Re: How to address last 2 components of 5-component vectors?
Date: 17 Jul 2016 03:24:05
Message: <578b3295$1@news.povray.org>
On 16-7-2016 14:47, Bald Eagle wrote:
> Sorry to keep this thing going for this long, but perhaps someone can post some
> working code to clarify HOW to use .hf "IN" (a) function.
>

I have an example right at hand. Two steps:

//step 1:
#declare F_HF_00 =
function {
   pigment {
     image_map {
       tga "MyOwn.tga" gamma 1.0
       map_type 0
       interpolate 2
     }
     warp {repeat x}
     warp {repeat y}
     scale 50
     warp {
       turbulence <1.5, 9, 1.5>
       octaves 1 //[6]
       lambda 1  //[2]
       omega 0.2 //[0.5]
     }
     scale 1/50
   }
}

//step 2:
#declare Landscape =
height_field {
   function 2000, 2000 {F_HF_00(x,y,z).hf}
   //smooth
   translate <-0.5, -0.5, -0.5>
   scale <-1, 1, 1>
   scale <MyScale, 100, MyScale>
   clipped_by {
     box {
       <-0.5, -0.5, -0.5>, <0.5, 0.5, 0.5>
       scale <MyScale, 1, MyScale> * <0.99, 500, 0.99>
     }
   }
}

Note: The clipped_by line might be necessary to cut out the artefacts 
generated by the function at the borders of the height_field.


-- 
Thomas


Post a reply to this message

From: Sherry K  Shaw
Subject: Re: How to address last 2 components of 5-component vectors?
Date: 20 Jul 2016 02:12:59
Message: <578f166b$1@news.povray.org>
Bald Eagle wrote:
> At first I mis-read the docs and thought I could have 6-component vectors, and
> address them x, y, z, t, u, v.
>
> I trimmed that to 5, and thought that maybe x, y, z, u, v was the way to go, but
> I should have known better.
>
> I need to use those last 2 values - what are they called?
>
> Thanks!
>
>

Betcha thought you were asking a totally simple question.  :)

Sherry "Been Doing This For Twenty-Plus Years and Never Cease To Be 
Enlightened, Educated, and Amazed" Shaw

-- 
#macro T(E,N)sphere{x,.4rotate z*E*60translate y*N pigment{wrinkles scale
.3}finish{ambient 1}}#end#local I=0;#while(I<5)T(I,1)T(1-I,-1)#local I=I+
1;#end camera{location-5*z}plane{z,37 pigment{granite color_map{[.7rgb 0]
[1rgb 1]}}finish{ambient 2}}//                                   TenMoons


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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