POV-Ray : Newsgroups : povray.general : How to extract the fifth value of a 5D vector? Server Time
1 Aug 2024 14:29:00 EDT (-0400)
  How to extract the fifth value of a 5D vector? (Message 1 to 8 of 8)  
From: Roman Reiner
Subject: How to extract the fifth value of a 5D vector?
Date: 28 Oct 2005 08:30:01
Message: <web.43621989499ae6d9c0c113bc0@news.povray.org>
I found a little "problem" (with solution) that i'd like to share with you.
According to the reference Pov-Ray supports 5D-Vectors but there seems to be
no way to extract the fifth value (directly) or am i missing something? the
first four values can be extracted with .x .y .z and .t and thats it!?
I managed to handle with this problem with the following piece of code:

//start of code

#include "math.inc"

#declare someVector = <0,3,2,1,5>;
#declare value1 = someVector.x;
#declare value2 = someVector.y;
#declare value3 = someVector.z;
#declare value4 = someVector.t;

#declare value5 = VLength5D(someVector-<value1,value2,value3,value4,0>);

//end of code

Is this really the only possibility? Isn't it somehow silly to support
5D-Vectors without supporting a fifth dot-operater to get this additional
value?

Greetings Roman


Post a reply to this message

From: Mike Williams
Subject: Re: How to extract the fifth value of a 5D vector?
Date: 28 Oct 2005 08:56:18
Message: <+mcMWCAs$hYDFwDA@econym.demon.co.uk>
Wasn't it Roman Reiner who wrote:
>I found a little "problem" (with solution) that i'd like to share with you.
>According to the reference Pov-Ray supports 5D-Vectors but there seems to be
>no way to extract the fifth value (directly) or am i missing something? the
>first four values can be extracted with .x .y .z and .t and thats it!?
>I managed to handle with this problem with the following piece of code:
>
>//start of code
>
>#include "math.inc"
>
>#declare someVector = <0,3,2,1,5>;
>#declare value1 = someVector.x;
>#declare value2 = someVector.y;
>#declare value3 = someVector.z;
>#declare value4 = someVector.t;
>
>#declare value5 = VLength5D(someVector-<value1,value2,value3,value4,0>);
>
>//end of code
>
>Is this really the only possibility? Isn't it somehow silly to support
>5D-Vectors without supporting a fifth dot-operater to get this additional
>value?

This works
#declare value5 = someVector.transmit;

Don't get confused by the fact that ".t" is the same as ".filter", and
isn't short for ".transmit"

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: JYR
Subject: Re: How to extract the fifth value of a 5D vector?
Date: 28 Oct 2005 10:25:01
Message: <web.436233b293f5284339b8d62e0@news.povray.org>
"Roman Reiner" <lim### [at] gmxde> wrote:
> Is this really the only possibility? Isn't it somehow silly to support
> 5D-Vectors without supporting a fifth dot-operater to get this additional
> value?

Actually, 5D-vectors are to be thought of as colors... see:

3.2.1.4.3  Operators
<...>The dot operator is also used in color expressions which are covered
later.

3.2.1.5.4  Color Operators
<...>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 float value of the red component of Shade. Similarly
Shade.green, Shade.blue, Shade.filter and Shade.transmit extract the float
value of the other color components. shade.gray returns the gray value of
the color vector.

Hoping this helps!!!

JYR


Post a reply to this message

From: JYR
Subject: Re: How to extract the fifth value of a 5D vector?
Date: 28 Oct 2005 10:30:01
Message: <web.4362358b93f5284339b8d62e0@news.povray.org>
Sorry, i didn't see that Mike Williams had already addressed this
question!!!

JYR


Post a reply to this message

From: Roman Reiner
Subject: Re: How to extract the fifth value of a 5D vector?
Date: 28 Oct 2005 12:15:01
Message: <web.43624d6593f5284337c5f0ab0@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> Don't get confused by the fact that ".t" is the same as ".filter", and
> isn't short for ".transmit"

Ahh! that helps a lot. as you wrote I supposed .t to be short for .transmit
(like .r, .g, .b are short for .red .green .blue) and tried .f for .filter.

Thanks. Roman


Post a reply to this message

From: John VanSickle
Subject: Re: How to extract the fifth value of a 5D vector?
Date: 28 Oct 2005 17:59:42
Message: <43629f4e$1@news.povray.org>
Mike Williams wrote:

> Wasn't it Roman Reiner who wrote:
> 
>>I found a little "problem" (with solution) that i'd like to share with you.
>>According to the reference Pov-Ray supports 5D-Vectors but there seems to be
>>no way to extract the fifth value (directly) or am i missing something? the
>>first four values can be extracted with .x .y .z and .t and thats it!?
>>I managed to handle with this problem with the following piece of code:
>>
>>//start of code
>>
>>#include "math.inc"
>>
>>#declare someVector = <0,3,2,1,5>;
>>#declare value1 = someVector.x;
>>#declare value2 = someVector.y;
>>#declare value3 = someVector.z;
>>#declare value4 = someVector.t;
>>
>>#declare value5 = VLength5D(someVector-<value1,value2,value3,value4,0>);
>>
>>//end of code
>>
>>Is this really the only possibility? Isn't it somehow silly to support
>>5D-Vectors without supporting a fifth dot-operater to get this additional
>>value?
> 
> 
> This works
> #declare value5 = someVector.transmit;
> 
> Don't get confused by the fact that ".t" is the same as ".filter", and
> isn't short for ".transmit"

Paragraph 3.2.1.4.3. of Da Rulez:

"For a 4D vector use .x, .y, .z, and .t to extract each float component."

Regards,
John


Post a reply to this message

From: Roman Reiner
Subject: Re: How to extract the fifth value of a 5D vector?
Date: 29 Oct 2005 04:00:00
Message: <web.43632ad393f5284337c5f0ab0@news.povray.org>
John VanSickle <evi### [at] hotmailcom> wrote:
> Paragraph 3.2.1.4.3. of Da Rulez:
>
> "For a 4D vector use .x, .y, .z, and .t to extract each float component."
>
> Regards,
> John

Paragraph 0.0.0.0.1 of Da Rulez:

"Read the question before answering" ;-)

Just kidding

Roman


Post a reply to this message

From: stephen parkinson
Subject: Re: How to extract the fifth value of a 5D vector?
Date: 29 Oct 2005 05:03:06
Message: <43633aca$1@news.povray.org>
Roman Reiner wrote:
> John VanSickle <evi### [at] hotmailcom> wrote:
> 
>>Paragraph 3.2.1.4.3. of Da Rulez:
>>
>>"For a 4D vector use .x, .y, .z, and .t to extract each float component."
>>
>>Regards,
>>John
> 
> 
> Paragraph 0.0.0.0.1 of Da Rulez:
> 
> "Read the question before answering" ;-)
> 
> Just kidding
> 
> Roman
> 
> 
> 
> 
> 
also in exams, read the rubrics (sp?)

ie 2 questions from part A and 5 from part B


Post a reply to this message

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