POV-Ray : Newsgroups : povray.newusers : debbug : Re: debbug Server Time
29 Jul 2024 10:29:12 EDT (-0400)
  Re: debbug  
From: Chris B
Date: 22 Jan 2006 18:27:27
Message: <43d414df@news.povray.org>
"shimon_a10" <shi### [at] wallacoil> wrote in message 
news:web.43d3ea6da7a603e5a8ded0@news.povray.org...
> "Brian Elliott" <NotForSpam@AskIfUWant> wrote:
>> "shimon_a10" <shi### [at] wallacoil> wrote in message
>> news:web.43d26b0828974d5c5a8ded0@news.povray.org...
>> > Hi, for everybody.
>> >
>> > 1. As anew user in the PovRay, I want to know how can i debbug my plan,
>> > and
>> >   where can i see the results of any step in the plan.
>>
>> Hi Shimon
>>
>> For an explanation and example of how to do this, see manual section
>> 3.2.2.7:  "User Message Directives".  It tells how to print and format
>> messages from your POV script, and you'll be most likely to use the 
>> #debug
>> directive.  If you are using PoV for Windows, the text appears in the
>> messages window.  If you are using Linux or other *NIX then the text 
>> prints
>> on your terminal output.  Can be redirected to a file.
>>
>> Also you likely want to build your messages from variables and their 
>> values.
>> The functions concat() and str() will do this.  Manual section 3.2.1.7.3:
>> "String Functions"
>>
>> Brian
>
> Hi, Brian and thanks for your help.
>
> 1. I want to know how or where can i see the valus or results of 
> variables,
>   like in matlab as i want to follow or debug my plan.
> 2. I'll be glad if you write for me a simple plan that make me understand
>   the point.
> 3. thanks again.
> 4. bye.
>
> shimon
>

Hi Shimon,

In POV-Ray, rather than use the word 'plan' it is clearer to use the term 
SDL (Scene Description Language) or Scene file.

At most points in a scene file you can add a #debug directive to display a 
line of text. The #debug directive writes the line of text to the debug 
stream, which, by default in the Windows version, writes it into the 
'Messages' window, which is displayed in the far left tab in the Windows 
POV-Ray User Interface.

You can include variables in the text written out using the #debug 
directive, but any non-text variables that you wish to include in the text 
stream will need to be converted to text first. Numeric variables are 
converted to text using the str() function, Vector variables are converted 
to text using the vstr() function.

As Brian mentioned you will often find yourself using the concat() function 
to build something that is easy to read because this concatenates bits of 
text together.
One thing you often need to add to the end of a string is the escape 
sequence '\n' which adds a line feed (newline or carriage return) to the 
text stream.

Here are some examples:
    #debug "Hello World.\n"
    // Just uses text, but can be usefull to help you make sure that a bit 
of SDL is being executed.

    #declare MyString = "Hello World";
    #debug concat(MyString,".\n")
    // Concatenates the contents of the variable 'MyString' with the new 
line character.

    #declare MyNumber = 3.14;
    #debug concat("My number is: ",str(MyNumber,0,0),"\n")
    // Converts the variable 'MyNumber' into a string, prefixes some text 
and appends
    // a new line character.

    #declare MyVector = <1,2,3>;
    #debug concat("My vector is: <",vstr(3,MyVector,",",0,0),">\n")
    // Converts the variable 'MyVector' into a string, prefixes some text 
and a left chevron
    // and appends a right chevron and a new line character.

Hope this helps get you started.

Regards,
Chris B.


Post a reply to this message

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