POV-Ray : Newsgroups : povray.advanced-users : How to address last 2 components of 5-component vectors? Server Time: 22 Oct 2017 21:01:16 GMT
 How to address last 2 components of 5-component vectors? (Message 1 to 10 of 46)
 From: Bald Eagle Subject: How to address last 2 components of 5-component vectors? Date: 7 Jul 2016 13:35:00 Message:
```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!
```
 From: Le Forgeron Subject: Re: How to address last 2 components of 5-component vectors? Date: 7 Jul 2016 14:37:41 Message: <577e6935\$1@news.povray.org>
```Le 07/07/2016 15:30, Bald Eagle a Ã©crit :
> 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?
>

You can access the component of 5D vector as a colour: red, green, blue, filter,
transmit

Yes, in that order. Which mean that .t == .filter, not .transmit
```
 From: Bald Eagle Subject: Re: How to address last 2 components of 5-component vectors? Date: 7 Jul 2016 14:55:00 Message:
```So,
after more coffee, and more reading, and piecing together the breadcrumbs, and
recalling doing something like this in 2013,

I deduced that with

#declare Vector = <1, 2, 3>;

individual components can be addressed as:

Vector.x, Vector.y, and Vector.z
but also as
Vector.u, Vector.v, and Vector.t

the 4th "TERM" in a 4-term vector is filter, since POV-Ray interprets this as a
color expression.
Vector.filter (not Vector.f)
and a 5th term is transmit
Vector.transmit (not Vector.t - that would be Term 3)

Search terms (for future reference)
..x .y .z .t .u .v .filter .transmit
4-component vector
5-component vector
4-term vector
5-term vector
4-term color expression
5-term color expression
```
 From: Bald Eagle Subject: Re: How to address last 2 components of 5-component vectors? Date: 7 Jul 2016 15:05:00 Message:
```Sorry, I was hasty and in error.
The following ought to be correct,
with a short scene file appended to demonstrate how it works.

> #declare Vector = <1, 2, 3>;
>
> individual components can be addressed as:
>
> Vector.x, Vector.y, and Vector.z
> but also as
> Vector.u, Vector.v, and Vector.z
>
> the 4th "TERM" in a 4-term vector is filter, since POV-Ray interprets this as a
> color expression.
> Vector.filter (not Vector.f) or Vector.t
> and a 5th term is transmit
> Vector.transmit (not Vector.t - that would be Term 4)
>
>
> Search terms (for future reference)
> .x .y .z .t .u .v .filter .transmit
> 4-component vector
> 5-component vector
> 4-term vector
> 5-term vector
> 4-term color expression
> 5-term color expression

########################################################################

#version 3.7;
global_settings {assumed_gamma 1.0}
#include "debug.inc"
Set_Debug (true)

#declare Vector = <1, 2, 3, 4, 5>;

#debug concat( "Vector.x =        ", str(Vector.x, 3, 0), "\n")
#debug concat( "Vector.u =        ", str(Vector.u, 3, 0), "\n\n")
#debug concat( "Vector.y =        ", str(Vector.y, 3, 0), "\n")
#debug concat( "Vector.v =        ", str(Vector.v, 3, 0), "\n\n")
#debug concat( "Vector.z =        ", str(Vector.z, 3, 0), "\n\n")
#debug concat( "Vector.t =        ", str(Vector.t, 3, 0), "\n")
#debug concat( "Vector.filter =   ", str(Vector.filter, 3, 0), "\n\n")
#debug concat( "Vector.transmit = ", str(Vector.transmit, 3, 0), "\n\n")
```
 From: Le Forgeron Subject: Re: How to address last 2 components of 5-component vectors? Date: 7 Jul 2016 15:12:58 Message: <577e717a\$1@news.povray.org>
```Le 07/07/2016 17:02, Bald Eagle a Ã©crit :
> Sorry, I was hasty and in error.
> The following ought to be correct,
> with a short scene file appended to demonstrate how it works.
>

x,u,red -> 1st

y,v,green -> 2nd

z,blue -> 3rd

t,filter -> 4th

transmit -> 5th

>> #declare Vector = <1, 2, 3>;
>>
>> individual components can be addressed as:
>>
>> Vector.x, Vector.y, and Vector.z
>> but also as
>> Vector.u, Vector.v, and Vector.z
>>
>> the 4th "TERM" in a 4-term vector is filter, since POV-Ray interprets this as a
>> color expression.
>> Vector.filter (not Vector.f) or Vector.t
>> and a 5th term is transmit
>> Vector.transmit (not Vector.t - that would be Term 4)
>>
>>
>> Search terms (for future reference)
>> .x .y .z .t .u .v .filter .transmit
>> 4-component vector
>> 5-component vector
>> 4-term vector
>> 5-term vector
>> 4-term color expression
>> 5-term color expression
>
> ########################################################################
>
> #version 3.7;
> global_settings {assumed_gamma 1.0}
> #include "debug.inc"
>   Set_Debug (true)
>
> #declare Vector = <1, 2, 3, 4, 5>;
>
> #debug concat( "Vector.x =        ", str(Vector.x, 3, 0), "\n")
> #debug concat( "Vector.u =        ", str(Vector.u, 3, 0), "\n\n")
> #debug concat( "Vector.y =        ", str(Vector.y, 3, 0), "\n")
> #debug concat( "Vector.v =        ", str(Vector.v, 3, 0), "\n\n")
> #debug concat( "Vector.z =        ", str(Vector.z, 3, 0), "\n\n")
> #debug concat( "Vector.t =        ", str(Vector.t, 3, 0), "\n")
> #debug concat( "Vector.filter =   ", str(Vector.filter, 3, 0), "\n\n")
> #debug concat( "Vector.transmit = ", str(Vector.transmit, 3, 0), "\n\n")
>
>
```
 From: Bald Eagle Subject: Re: How to address last 2 components of 5-component vectors? Date: 7 Jul 2016 16:35:00 Message:
```Le_Forgeron <jgr### [at] freefr> wrote:

> x,u,red -> 1st
> y,v,green -> 2nd
> z,blue -> 3rd
> t,filter -> 4th
> transmit -> 5th

Aha!   Yes, and I forgot about .red, .green, .blue, and especially .gray  :O

Also:
[F1] help (Windows) brings me this when I search for "gray":

3.3.1.7.5 Color Operators
Color vectors may be combined in expressions the same as float or vector values.
Operations are performed on a component by component basis. For example rgb
<1.0,0.5,0.2>*0.9 evaluates the same as rgb<1.0,0.5,0.2>*<0.9,0.9,0.9> or
rgb<0.9,0.45,0.18>. Other operations are done on a similar component by
component basis.

You may use the dot operator to extract a single component from a color. Suppose
the identifier Shade was previously defined as a color. Then Shade.red is the
components. shade.gray returns the gray value of the color vector.
```
 From: Jim Holsenback Subject: Re: How to address last 2 components of 5-component vectors? Date: 7 Jul 2016 17:16:18 Message: <577e8e62\$1@news.povray.org>
```On 7/7/2016 10:37 AM, Le_Forgeron wrote:
> Le 07/07/2016 15:30, Bald Eagle a Ã©crit :
>> 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?
>>
>
> You can access the component of 5D vector as a colour: red, green, blue, filter,
transmit
>
> Yes, in that order. Which mean that .t == .filter, not .transmit
>

OK ... so please be a bit more specific. What /exactly/ is "bad" and
needs clarification. Comment on the talk page and I'll work it into the
docs.
```
 From: Bald Eagle Subject: Re: How to address last 2 components of 5-component vectors? Date: 7 Jul 2016 17:40:00 Message:
```Jim Holsenback <spa### [at] nothanksnet> wrote:

> OK ... so please be a bit more specific. What /exactly/ is "bad" and
> needs clarification. Comment on the talk page and I'll work it into the
> docs.

Jerome posted at
http://wiki.povray.org/content/Reference_Talk:Vector_Expressions

"The page Vector sends to Numeric Expression, but that one dismiss any details
about DOT_ITEM by sending back to Vector / Colour Pages, none of which cover the
subject."

I think that addressing the following ought to explicitly, clearly and
unambiguously describe what the values are as well as show examples of their
usage.

(I'm assuming that Vector.gray = (Vector.red + Vector.green + Vector.blue)/3
and that would be a helpful tidbit in the docs as well. )

#version 3.7;
global_settings {assumed_gamma 1.0}
#include "debug.inc"
Set_Debug (true)

#declare Vector = <1, 2, 3, 4, 5>;

#debug concat( "Vector.x =        ", str(Vector.x, 3, 0), "\n")
#debug concat( "Vector.red =      ", str(Vector.red, 3, 0), "\n")
#debug concat( "Vector.u =        ", str(Vector.u, 3, 0), "\n\n")

#debug concat( "Vector.y =        ", str(Vector.y, 3, 0), "\n")
#debug concat( "Vector.green =    ", str(Vector.green, 3, 0), "\n")
#debug concat( "Vector.v =        ", str(Vector.v, 3, 0), "\n\n")

#debug concat( "Vector.blue =     ", str(Vector.blue, 3, 0), "\n")
#debug concat( "Vector.z =        ", str(Vector.z, 3, 0), "\n\n")

#debug concat( "Vector.t =        ", str(Vector.t, 3, 0), "\n")
#debug concat( "Vector.filter =   ", str(Vector.filter, 3, 0), "\n\n")

#debug concat( "Vector.transmit = ", str(Vector.transmit, 3, 0), "\n\n")

#debug concat( "Vector.gray = ", str(Vector.gray, 3, 0), "\n\n")
```
 From: Le Forgeron Subject: Re: How to address last 2 components of 5-component vectors? Date: 7 Jul 2016 17:48:17 Message: <577e95e1\$1@news.povray.org>
```Le 07/07/2016 19:16, Jim Holsenback a Ã©crit :
> On 7/7/2016 10:37 AM, Le_Forgeron wrote:
>> Le 07/07/2016 15:30, Bald Eagle a Ã©crit :
>>> 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?
>>>
>>
Grail")
>> You can access the component of 5D vector as a colour: red, green, blue, filter,
transmit
>>
>> Yes, in that order. Which mean that .t == .filter, not .transmit
>>
>
> OK ... so please be a bit more specific. What /exactly/ is "bad" and needs
clarification. Comment on the talk page and I'll work it into the docs.

As stated in the talk page of Vector Expressions:
The page Vector sends to Numeric Expression, but that one dismiss any details about
DOT_ITEM by sending back to Vector / Colour Pages, none of which cover the subject.

In Numerics Expressions page, we have "The DOT_ITEM syntax is actually a vector or
color operator but it returns a float value. See Vector Operators or Color Operators
for details".

It reminds me of the house that get you mad, in Asterix (The twelve tasks of Asterix,
8th task): To get permit A38, you need the blue sheet... to get the blue sheet, you
need to apply with the pink and green ...

Here the loop is smaller, but no one would give a newbie the information about getting
a component from a vector (or colour).

I would suggest to leave "Numeric_Expressions" as it is so far, and adding, in both
"Vector_Expressions" and "Colour_Expressions", a dedicated section about getting
individual component out of a vector and colour.

In that section, the illustration of dot item with a basic example. Such as:

#declare Vector = < 1, 2, 3, 4, 5>;
#declare First_Component_1 = Vector.red;// 1
#declare First_Component_2 = Vector.u;// 1
#declare First_Component_3 = Vector.x;// 1
#declare Second_Component_1 = Vector.green;// 2
#declare Second_Component_2 = Vector.v;// 2
#declare Second_Component_3 = Vector.y;// 2
#declare Third_Component_1 = Vector.blue;// 3
#declare Third_Component_2 = Vector.z;// 3
#declare Fourth_Component_1 = Vector.filter;// 4
#declare Fourth_Component_2 = Vector.t;// 4
#declare Fifth_Component = Vector.transmit;// 5

(and repeat with a Colour= rgbtf <...> )

The section need a visible title (visible in Table of content)

// Above text was also added into the talk page. Best regards.
```
 From: Le Forgeron Subject: Re: How to address last 2 components of 5-component vectors? Date: 7 Jul 2016 17:52:28 Message: <577e96dc\$1@news.povray.org>
```Le 07/07/2016 19:39, Bald Eagle a Ã©crit :
> (I'm assuming that Vector.gray = (Vector.red + Vector.green + Vector.blue)/3
> and that would be a helpful tidbit in the docs as well. )

Sorry to disappoint you, but gray formula is more complex (the weight of each of the 3
components are different)

It is documented at least in
http://wiki.povray.org/content/Documentation:Tutorial_Section_3.2

but it might be useful to repeat it in the "Colour_Expressions" page.

gray value = Red*29.7% + Green*58.9% + Blue*11.4%
```