POV-Ray : Newsgroups : povray.newusers : Extracting x value from a vector Server Time
6 Nov 2024 11:21:39 EST (-0500)
  Extracting x value from a vector (Message 1 to 6 of 6)  
From:
Subject: Extracting x value from a vector
Date: 9 Feb 1999 03:13:16
Message: <36bfee1c.0@news.povray.org>
Hi!
How can I assign the x (or y, z) value stored in a vector with a variable?

Thanks
Steve
http://csi.findhere.com
csi### [at] usanet


Post a reply to this message

From: Mike
Subject: Re: Extracting x value from a vector
Date: 9 Feb 1999 05:03:46
Message: <36C00733.458B305F@aol.com>
#declare this = <1, 2, 3>

sphere {<this.x, this.y, this.z>, this.x + this.y + this.z}

gives:

sphere {<1, 2, 3>, 6}

well, you get the idea...

-Mike


> 
> Hi!
> How can I assign the x (or y, z) value stored in a vector with a variable?
> 
> Thanks
> Steve
> http://csi.findhere.com
> csi### [at] usanet


Post a reply to this message

From: Julius Klatte
Subject: Re: Extracting x value from a vector
Date: 10 Feb 1999 15:23:15
Message: <36c1eab3.0@news.povray.org>
#declare Myvector=<1,2,3>

if you want the x, you can type Myvector.x (as Mike said).
This is actually tha same as saying Myvector*<1,0,0>

Julius


Post a reply to this message

From: Spider
Subject: Re: Extracting x value from a vector
Date: 10 Feb 1999 17:06:16
Message: <36C2019F.A9892664@bahnhof.se>
Julius Klatte wrote:
> 
> #declare Myvector=<1,2,3>
> 
> if you want the x, you can type Myvector.x (as Mike said).
> This is actually tha same as saying Myvector*<1,0,0>
> 
Isn't the first one faster, since there si no vector multiplication
involved ???

I'd think it is, perhaps do a test with some 100 000 000 tries of each..
or, just assume .x is faster :-)

//Spider


Post a reply to this message

From: Nieminen Mika
Subject: Re: Extracting x value from a vector
Date: 11 Feb 1999 14:57:50
Message: <36c3363e.0@news.povray.org>
Julius Klatte <jku### [at] hotmailcom> wrote:
: if you want the x, you can type Myvector.x (as Mike said).
: This is actually tha same as saying Myvector*<1,0,0>

  I dont think so.
  If Myvector is <2,3,4>, Myvector.x is the float value 2 while
Myvector*<1,0,0> is the vector value <2,0,0>.

-- 
main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
*_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp -*/


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Extracting x value from a vector
Date: 12 Feb 1999 02:10:08
Message: <36c3d3d0.0@news.povray.org>
In article <36c3363e.0@news.povray.org> , Nieminen Mika <war### [at] cctutfi>  
wrote:

>   I dont think so.
>   If Myvector is <2,3,4>, Myvector.x is the float value 2 while
> Myvector*<1,0,0> is the vector value <2,0,0>.

Hmm, this depends on the definition of the "*", it could mean dot product or
cross product...but in POV-Ray it is simply  <v1.x * v2.x, v1.y * v2.y, v1.z
* v2.z>.


    Thorsten


Post a reply to this message

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