POV-Ray : Newsgroups : povray.newusers : vector data structure Server Time
30 Jul 2024 16:24:38 EDT (-0400)
  vector data structure (Message 1 to 7 of 7)  
From: bongotastic
Subject: vector data structure
Date: 20 Feb 2004 15:42:41
Message: <40367141@news.povray.org>
Hi,

    I assume this can be found somewhere in some documents. If you know it
from the top of your head, please let me know.

    I am trying to change one components of a vector:

#declare pt = <0,0,0>;
#declare pt = VRand_On_Sphere(MySeed);
#declare pt.z = pt.z / 2.0;

The third line does not process, saying that  a '=' is expected but a '.' is
found. The docs indicate that it should work. Am I declaring my variable pt
wrong?

Thanks for your help.

bongo


Post a reply to this message

From: Warp
Subject: Re: vector data structure
Date: 20 Feb 2004 16:27:13
Message: <40367bb1@news.povray.org>
bongotastic <cbl### [at] csdalca> wrote:
> #declare pt = <0,0,0>;
> #declare pt = VRand_On_Sphere(MySeed);
> #declare pt.z = pt.z / 2.0;

> The third line does not process, saying that  a '=' is expected but a '.' is
> found. The docs indicate that it should work. Am I declaring my variable pt
> wrong?

  Actually I'm not sure now whether assigning to a vector component should
work or not according to the documentation...

  Anyways, you can get that working like this (a bit longer, but at
least it should work):

#declare pt = <pt.x, pt.y, pt.z/2>;

  In fact, this should work as well:

#declare pt = pt*<1, 1, 0.5>;

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: vector data structure
Date: 20 Feb 2004 17:01:31
Message: <403683bb@news.povray.org>
As far as I've understood the docs, doing a .x or such, like Vector.x, would
not return a "handle" to the X-Component of the Vector, but actually return
the value stored there. So Vector.x actually IS a value, not a reference. If
the Vector would be <1,1,1>, then
#declare Vector.x = Vector.x/2;
would be like
#declare 1 = 1/2;
which obviously wouldn't work (on a logical basis, not sure how the parser
handles that).

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Email: tim.nikias (@) nolights.de


Post a reply to this message

From: Kurts
Subject: Re: vector data structure
Date: 21 Feb 2004 06:11:15
Message: <kurtzlepirate-936ACA.12111421022004@news.povray.org>
In article <40367141@news.povray.org>, "bongotastic" <cbl### [at] csdalca> wrote:

> Hi,
> 
>     I assume this can be found somewhere in some documents. If you know it
> from the top of your head, please let me know.
> 
>     I am trying to change one components of a vector:
> 
> #declare pt = <0,0,0>;
> #declare pt = VRand_On_Sphere(MySeed);
> #declare pt.z = pt.z / 2.0;
> 
> The third line does not process, saying that  a '=' is expected but a '.' is
> found. The docs indicate that it should work. Am I declaring my variable pt
> wrong?
> 
> Thanks for your help.
> 
> bongo
> 
> 

  #set pt = <pt.x, pt.y, pt.z*0.50>;


Post a reply to this message

From: Warp
Subject: Re: vector data structure
Date: 21 Feb 2004 08:40:58
Message: <40375fea@news.povray.org>
Kurts <kur### [at] yahoofr> wrote:
>   #set

  Yeah, sure.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Christopher James Huff
Subject: Re: vector data structure
Date: 21 Feb 2004 12:24:35
Message: <cjameshuff-07C09D.12251521022004@news.povray.org>
In article <kurtzlepirate-936ACA.12111421022004@news.povray.org>,
 Kurts <kur### [at] yahoofr> wrote:

>   #set pt = <pt.x, pt.y, pt.z*0.50>;

Or something which matches what he's doing more closely:

#declare pt = pt/<1, 1, 2>;

And be aware that #set is a MegaPOV-only feature.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: bongotastic
Subject: Re: vector data structure
Date: 21 Feb 2004 13:29:07
Message: <4037a373$1@news.povray.org>
Thanks all for the pointers.  I did not get from the docs that vector.x was
a returned value rather than a reference handle.

#set is indeed not in povray's documentation.

Cheers,


Post a reply to this message

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