POV-Ray : Newsgroups : povray.newusers : How can I print a vector to the screen? Server Time
27 Nov 2024 21:54:04 EST (-0500)
  How can I print a vector to the screen? (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Steve
Subject: How can I print a vector to the screen?
Date: 14 Apr 2002 18:35:55
Message: <slrnabk0up.tm8.steve@zero-pps.localdomain>
Is there a way to print a vector using #debug?  And if so could someone
please give an example?

This is only part of my current problem, I'm trying to center text but 
there is NO documentation on this, though in both the POV docs and in the
VFAQ this is listed as a question that is answered - but the question is 
not answered it just says use min and max_extent.  

I know quit a bit about programming and am able to work most things out, but
after three hours of going through the documentation I can't come up with
a working solution for either of the problems posted above, I'd be grateful
if someone could post an example of how to center an object. 

-- 
sphere{z*5,1pigment{rgb.5}finish{reflection.3specular.5}}box{<-50,-3,-50>
<50,-2,50>pigment{checker/*\__\\__/  * \_\\__*/scale 2}finish{ambient.7}}
light_source/*__\\__\\__\\__\\__\(    ~ )\__\\__\\__\\__\\*/{<2,5,1>*4,1} 
/*\\__\\__\\__\\__\\__\\__\\__\\__\~  -/__\\__\\__\\__\\__\\*//* Steve */


Post a reply to this message

From: Christopher James Huff
Subject: Re: How can I print a vector to the screen?
Date: 14 Apr 2002 21:54:34
Message: <chrishuff-9C2955.20563414042002@netplex.aussie.org>
In article <slr### [at] zero-ppslocaldomain>,
 Steve <ste### [at] zeroppsuklinuxnet> wrote:

> Is there a way to print a vector using #debug?  And if so could someone
> please give an example?

The #debug statement only takes strings, so you will need to convert the 
vector to a string first. Since you seem to be using POV-Ray 3.5, look 
up the documentation for the vstr() function.


> This is only part of my current problem, I'm trying to center text but 
> there is NO documentation on this, though in both the POV docs and in the
> VFAQ this is listed as a question that is answered - but the question is 
> not answered it just says use min and max_extent.  

The answer is to use min_extent() and max_extent(). ;-)
Once you have the coordinates of each corner of the bounding box, it is 
very simple to translate it so it is centered over the origin or any 
other desired point. Just find the center and translate by -CenterPos.
Or you could use the standard macro for this: Center_Trans() in 
transforms.inc.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Sebastian H 
Subject: Re: How can I print a vector to the screen?
Date: 15 Apr 2002 01:11:37
Message: <3CBA6181.40902@web.de>
Steve wrote:
> Is there a way to print a vector using #debug?  And if so could someone
> please give an example?
> 

Try this:

// ----------
//
// Simply "returns" a vector in a string in POV-Ray notation
//
#macro v_string (V)
  concat ("<", str (V.x, 0, 4),", ", str (V.y, 0, 4),", ", str (V.z, 0, 
4),">")
#end


#declare Wanna_see_this_vector = <2, 0.1, 12.5>;

// Should print <2, 0.1, 12.5> to the debug output
#debug v_string (Wanna_see_this_vector)
// ----------


Post a reply to this message

From: Warp
Subject: Re: How can I print a vector to the screen?
Date: 15 Apr 2002 08:01:48
Message: <3cbac12c@news.povray.org>
Sebastian H. <seb### [at] webde> wrote:
> #macro v_string (V)
>   concat ("<", str (V.x, 0, 4),", ", str (V.y, 0, 4),", ", str (V.z, 0, 
> 4),">")
> #end

  Why not use vstr() instead?

-- 
#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: Tom Melly
Subject: Re: How can I print a vector to the screen?
Date: 15 Apr 2002 08:35:28
Message: <3cbac910@news.povray.org>
"Steve" <ste### [at] zeroppsuklinuxnet> wrote in message
news:slr### [at] zero-ppslocaldomain...

> a working solution for either of the problems posted above, I'd be grateful
> if someone could post an example of how to center an object.
>

It's worth noting that "centering an object" rarely makes sense, since most
things don't have a centre in human terms, and nothing has a centre in POV
terms. Using the bounding box is a workaround, but, for example, the centre of
an L-shaped shape, according to its bounding box, is going to be an empty area
(half way and half way along).

I realise that this isn't really an issue when thinking about a text-string, but
conceptually you can get very stuck if you think of POV objects as having a
centre (generally because, if you decide that objects have a centre, then you
expect transformations to work with those centres).


Post a reply to this message

From: Steve
Subject: Re: How can I print a vector to the screen?
Date: 15 Apr 2002 08:43:56
Message: <slrnable71.vmr.steve@zero-pps.localdomain>
On Sun, 14 Apr 2002 20:56:34 -0500, Christopher James Huff wrote:
> In article <slr### [at] zero-ppslocaldomain>,
>  Steve <ste### [at] zeroppsuklinuxnet> wrote:
> 
>> Is there a way to print a vector using #debug?  And if so could someone
>> please give an example?
> 
> The #debug statement only takes strings, so you will need to convert the 
> vector to a string first. Since you seem to be using POV-Ray 3.5, look 
> up the documentation for the vstr() function.

Thanks Chris, I'm suffereing severely as there isn't a text version of the 
3.5 docs available yet (or wasn't last night).  

> 
>> This is only part of my current problem, I'm trying to center text but 
>> there is NO documentation on this, though in both the POV docs and in the
>> VFAQ this is listed as a question that is answered - but the question is 
>> not answered it just says use min and max_extent.  
> 
> The answer is to use min_extent() and max_extent(). ;-)
> Once you have the coordinates of each corner of the bounding box, it is 
> very simple to translate it so it is centered over the origin or any 
> other desired point. Just find the center and translate by -CenterPos.
> Or you could use the standard macro for this: Center_Trans() in 
> transforms.inc.

Thanks, I'll have a go at this.  Now that I can #debug vectors I'll be 
able to sort something out. 

-- 
sphere{z*5,1pigment{rgb.5}finish{reflection.3specular.5}}box{<-50,-3,-50>
<50,-2,50>pigment{checker/*\__\\__/  * \_\\__*/scale 2}finish{ambient.7}}
light_source/*__\\__\\__\\__\\__\(    ~ )\__\\__\\__\\__\\*/{<2,5,1>*4,1} 
/*\\__\\__\\__\\__\\__\\__\\__\\__\~  -/__\\__\\__\\__\\__\\*//* Steve */


Post a reply to this message

From: Steve
Subject: Re: How can I print a vector to the screen?
Date: 15 Apr 2002 08:43:57
Message: <slrnablebn.vmr.steve@zero-pps.localdomain>
On Mon, 15 Apr 2002 07:13:37 +0200, Sebastian H. wrote:
> Steve wrote:
>> Is there a way to print a vector using #debug?  And if so could someone
>> please give an example?
>> 
> 
> Try this:
> 
> // ----------
> //
> // Simply "returns" a vector in a string in POV-Ray notation
> //
> #macro v_string (V)
>   concat ("<", str (V.x, 0, 4),", ", str (V.y, 0, 4),", ", str (V.z, 0, 
> 4),">")
> #end

Thanks that syntax is what I needed. 
 
> 
> #declare Wanna_see_this_vector = <2, 0.1, 12.5>;
> 
> // Should print <2, 0.1, 12.5> to the debug output
> #debug v_string (Wanna_see_this_vector)
> // ----------
> 

Thanks again, I may incorporate soemthing liek this.  I just hope my 
3.5 hasn't expired on me. 

-- 
#local i=.1;#local I=(i/i)/i;#local l=(i+i)/i;#local ll=(I/i)/l;box{<-ll,
-((I/I)+l),-ll><ll,-l,ll>pigment{checker scale l}finish{ambient((I/l)/I)+
(l/I)}}sphere{<i-i,l-l,(I/l)>l/l pigment{rgb((I/l)/I)}finish{reflection((
I/l)/I)-(l/I)specular(I/l)/I}}light_source{<I-l,I+I,(I-l)/l>l/l} // Steve


Post a reply to this message

From: Sebastian H 
Subject: Re: How can I print a vector to the screen?
Date: 15 Apr 2002 15:16:06
Message: <3CBB276E.1080801@web.de>
> 
> Thanks again, I may incorporate soemthing liek this.  I just hope my 
> 3.5 hasn't expired on me. 
> 

This is what happened to me this morning when I wanted to trace a little 
  animation while stying at university :-)))

Sebastian H.


Post a reply to this message

From: Sebastian H 
Subject: Re: How can I print a vector to the screen?
Date: 15 Apr 2002 15:30:57
Message: <3CBB2AE9.80205@web.de>
Warp wrote:
> Sebastian H. <seb### [at] webde> wrote:
> 
>>#macro v_string (V)
>>  concat ("<", str (V.x, 0, 4),", ", str (V.y, 0, 4),", ", str (V.z, 0, 
>>4),">")
>>#end
> 
> 
>   Why not use vstr() instead?
> 

You're right vstr() would be a better (!!?) solution but since this is a 
new user group I thought it won't hurt to give an example of how to use 
the concat () and str () which are very essencial in my thoughts (I use 
them a lot).
(Beside I wrote this little macro just yesterday for myself and had 
somwhere in mind that there exists a vstr () function which takes soooo 
many args :-).)


Sebastian H.

(Oh dear, I have to improve my english...)


Post a reply to this message

From: Warp
Subject: Re: How can I print a vector to the screen?
Date: 15 Apr 2002 17:21:54
Message: <3cbb4472@news.povray.org>
Sebastian H. <seb### [at] webde> wrote:
> (Beside I wrote this little macro just yesterday for myself and had 
> somwhere in mind that there exists a vstr () function which takes soooo 
> many args :-).)

  You can use vstr() in your macro.

-- 
#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

Goto Latest 10 Messages Next 2 Messages >>>

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