|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>
> I was doing a simple #if - #else - #end loop and trying to trigger an update
> once every "hour".
> #if ( Time1 = ceil ( Time1 ) )
>
Using such a loop would only work for a *very* long parse operation as
it can only be evaluated during that time. When rendering or editing
your scene, the loop is never used.
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 08/03/2013 05:52 PM, Bald Eagle wrote:
>
>> Well, that would be too easy, wouldn't it :-P
>
> Right-o. What's life without a challenge, eh?
>
>> I guess he'll be happy about hints
>> like yours pointing out potential for even further improvement. After
>> all there's one thing that becomes more and more difficult the more one
>> gets acquainted to a piece of software and its documentation: To notice
>> potential problems that new users might run into.
>
> Indeed. You acheive a certain myopia and over-familiarity. That's why you have
> OTHER people proofread your work, because you tend read right THROUGH the
> errors.
>
> I'm trying to illustrate to myself how things work, so maybe some of those ideas
> will help out with clarifying the docs.
>
>
What did you have in mind ... I could add an index entry to ceil and
floor so they come up when round is the search term. That would be on
windows version only. Mileage may vary. As far as expanding the
reference section
http://wiki.povray.org/content/Reference:Numeric_Expressions#Functions
(where ceil and floor are mentioned) I don't see a lot of room there
given the format used for the rest of the functions. Maybe a small
example /could/ be made to fit into the current scheme, but that
/really/ doesn't do anything to address the fact you weren't aware that
ceil and floor could be used like clipka showed ... at the moment kings
x on coming up with a different layout. For the heck of it I took a
quick tour of the tutorial and see that it's lacking in any sort of
information about writing functions, so I guess I'm out of ideas
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Well, to start off, I find that things like this help me to understand things
WAY more than text.
http://news.povray.org/povray.binaries.tutorials/thread/%3Cweb.51f61e827603294573fc9ebb0%40news.povray.org%3E/
A picture's worth a thousand words, and all that.
Here's what my first impressions are when I look at that wiki page:
That green text is WAY too small.
I don't know what a unary minus or a unary plus is.
I'd expect mention of exponential functions in the precedence listing.
I'd also point out that (A^2) is not a valid expression - pow(x,2) is the way to
write that in POV-Ray. And don't confuse pow() with pwr().
I think I tried doing an #if (X=<Y), but the <has to precede the =
I don't know what a bit-wise operation is
THEN should be searchable and linked to the ? operator
abs(A)
Absolute value of A. If A is negative, returns -A otherwise returns A.
#debug concat ("ABS -1 = ",str(abs(-1),3,0)) returns 1, not -1.
I don't know what hyperbolic trig functions are (off the top of my head)
#declare Step = 0;
#while (Step <= 2)
#debug concat ("Number = ",str(Step,3,1))
#debug "\n"
#debug concat ("ceiling = ",str(ceil(Step),3,1))
#debug "\n"
#debug concat ("floor = ",str(ceil(Step),3,1))
#debug "\n"
#debug "\n"
#declare Step = Step + 0.1;
#end
Floor and ceiling return the same value.
THAT's what's wrong with them.
For the function inside(), what is the "object identifier"? is that something
like #declare O=object{}?
strlen() is useful for text functions, but for rendering text in an image, I'd
like to know how large that text will actually be.
You have tan(A) and tanh(), but tan2(A,B) is ... elsewhere.
will val(s) accept val("3X")?
I HAD to render and animate the dot product file in order to understand what it
did. The text didn't help me understand that it was a vector perpendicular to
the two vectors I was ... dotting.
.... and as a noob, I find it a little disorienting when an example uses some
obscure POV-Ray function without a prior simple/common one...
#if (image_width < 300) crand 0.1 #else crand 0.5 #end
.... because now I have to interrupt my train of thought and go off on some
tangent to look up what "crand" is.
So, there's an example of my constructive criticism.
Feel free to email me with requests for illustrations or proofreading /
commentary.
Thanks for what I'm sure is a TON of hard work, James. I've been there, so I
know what it's like.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Alain <kua### [at] videotronca> wrote:
> >
> > I was doing a simple #if - #else - #end loop and trying to trigger an update
> > once every "hour".
> > #if ( Time1 = ceil ( Time1 ) )
> >
>
> Using such a loop would only work for a *very* long parse operation as
> it can only be evaluated during that time. When rendering or editing
> your scene, the loop is never used.
>
>
> Alain
Well, the parse and render phases are something I need to better understand,
because I long to do cool stuff with functions and macros, and I've seen that
asked plenty of times. Lots of reading and experiments for me.
I used the loop in my render, and it seemed to work fine.
#if ( Time1 = ceil ( Time1 ) )
#declare A = A + B;
#declare B = B + 2;
text { ttf "arial.ttf" str (B, 3, 0) 0.1, 0 translate <Time1-2,
Level1*Y_Factor+2, -0.4> pigment {color Yellow}}
#debug concat ("Time1 = ", str (Time1, 3, 1))
#debug "\n"
#debug concat ("A = ", str (A, 3, 1))
#debug "\n"
#else
#end // end if
once I got the #if comparator right, it worked just like I expected it to.
#if ( Time1 / Step = int (Time1/Step) DID NOT work.
Go figure.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 04.08.2013 03:41, schrieb Bald Eagle:
> I don't know what hyperbolic trig functions are (off the top of my head)
Don't worry - nobody knows (and nobody really needs them) except for a
few math geeks :-P
> #declare Step = 0;
> #while (Step <= 2)
> #debug concat ("Number = ",str(Step,3,1))
> #debug "\n"
> #debug concat ("ceiling = ",str(ceil(Step),3,1))
> #debug "\n"
> #debug concat ("floor = ",str(ceil(Step),3,1))
> #debug "\n"
> #debug "\n"
> #declare Step = Step + 0.1;
> #end
>
> Floor and ceiling return the same value.
> THAT's what's wrong with them.
Um... that might be because you wrote "ceil(Step)" in /both/ debug
lines? :-P
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>
> Well, to start off, I find that things like this help me to understand things
> WAY more than text.
>
http://news.povray.org/povray.binaries.tutorials/thread/%3Cweb.51f61e827603294573fc9ebb0%40news.povray.org%3E/
> A picture's worth a thousand words, and all that.
>
> Here's what my first impressions are when I look at that wiki page:
>
> That green text is WAY too small.
That depends on your browser settings for monospace text.
On most browsers, the default is effectively much to small.
> I don't know what a unary minus or a unary plus is.
An unary operator is the + or - that precede a single value. In "-A",
the minus sign is an unary -.
In this expression:
-(A*-B)
The minus sign before the bracket and the one before "B" are unary minus
signs.
> I'd expect mention of exponential functions in the precedence listing.
> I'd also point out that (A^2) is not a valid expression - pow(x,2) is the way to
> write that in POV-Ray. And don't confuse pow() with pwr().
It's because the caret "^" operator can often become ambiguous.
What do you *realy* mean if you have 2^2/3?
It can be 2^(2/3) OR be (2^2)/3.
or what about 2^3^4...
It can be 2^(3^4) OR (2^3)^4.
In both cases, the result are NOT the same.
Depending on your background, or domain of work/activity, it can be
evaluated either right to left or left to right.
> I think I tried doing an #if (X=<Y), but the <has to precede the =
It's also that way in both the BASIC, Fortran and C/C++ programing
languages.
> I don't know what a bit-wise operation is
It's an operation that is conducten on each individual bit of some
values. It's seldom used. It can only be used on integer values.
> THEN should be searchable and linked to the ? operator
In my view, it should rather be linked to the #if operator. It comes
from the notation:
IF condition THEN action on true ELSE action on false
>
> abs(A)
> Absolute value of A. If A is negative, returns -A otherwise returns A.
> #debug concat ("ABS -1 = ",str(abs(-1),3,0)) returns 1, not -1.
And that's the correct result. abs(-1) = -(-1) = +1 or just 1.
It should have been told to you in elementary school. At least, I learnd
that in 4th or 5th grade...
>
> I don't know what hyperbolic trig functions are (off the top of my head)
Nether do I.
>
> #declare Step = 0;
> #while (Step <= 2)
> #debug concat ("Number = ",str(Step,3,1))
> #debug "\n"
> #debug concat ("ceiling = ",str(ceil(Step),3,1))
> #debug "\n"
> #debug concat ("floor = ",str(ceil(Step),3,1))
> #debug "\n"
> #debug "\n"
> #declare Step = Step + 0.1;
> #end
>
> Floor and ceiling return the same value.
> THAT's what's wrong with them.
Just because you use str(ceil(Step),3,1)) for both strings.
>
> For the function inside(), what is the "object identifier"? is that something
> like #declare O=object{}?
Yes.
It can be any previously declared object.
>
> strlen() is useful for text functions, but for rendering text in an image, I'd
> like to know how large that text will actually be.
For that, you can use a monospace font where each character will be 1
unit whide or use the min_extent() and max_extent() functions.
>
> You have tan(A) and tanh(), but tan2(A,B) is ... elsewhere.
>
> will val(s) accept val("3X")?
Yes and will return 3.
val("a35") will return zero.
It evaluate a string starting with some numeric character up to the
first non-numeric character or the last one.
Numeric characters include the leter "e" as it's used for the
exponential notation: 1e4 = 10000, 1.3e-2 = 0.012.
>
> I HAD to render and animate the dot product file in order to understand what it
> did. The text didn't help me understand that it was a vector perpendicular to
> the two vectors I was ... dotting.
You are not alone. Many peoples don't understand that operation without
that kind of example.
>
> .... and as a noob, I find it a little disorienting when an example uses some
> obscure POV-Ray function without a prior simple/common one...
> #if (image_width < 300) crand 0.1 #else crand 0.5 #end
> .... because now I have to interrupt my train of thought and go off on some
> tangent to look up what "crand" is.
>
> So, there's an example of my constructive criticism.
>
> Feel free to email me with requests for illustrations or proofreading /
> commentary.
>
> Thanks for what I'm sure is a TON of hard work, James. I've been there, so I
> know what it's like.
>
>
>
>
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Alain <kua### [at] videotronca> wrote:
>>>
>>> I was doing a simple #if - #else - #end loop and trying to trigger an update
>>> once every "hour".
>>> #if ( Time1 = ceil ( Time1 ) )
>>>
>>
>> Using such a loop would only work for a *very* long parse operation as
>> it can only be evaluated during that time. When rendering or editing
>> your scene, the loop is never used.
>>
>>
>> Alain
>
> Well, the parse and render phases are something I need to better understand,
> because I long to do cool stuff with functions and macros, and I've seen that
> asked plenty of times. Lots of reading and experiments for me.
>
> I used the loop in my render, and it seemed to work fine.
>
> #if ( Time1 = ceil ( Time1 ) )
> #declare A = A + B;
> #declare B = B + 2;
> text { ttf "arial.ttf" str (B, 3, 0) 0.1, 0 translate <Time1-2,
> Level1*Y_Factor+2, -0.4> pigment {color Yellow}}
> #debug concat ("Time1 = ", str (Time1, 3, 1))
> #debug "\n"
> #debug concat ("A = ", str (A, 3, 1))
> #debug "\n"
> #else
> #end // end if
>
> once I got the #if comparator right, it worked just like I expected it to.
>
> #if ( Time1 / Step = int (Time1/Step) DID NOT work.
> Go figure.
It's probably due to some floating point rounding errors. If you have
Time1=1000 and Step=10, then Time1/Step can result in something like
99.9999999 that will show as 100 or 100.00001011 that also show as 100.
Now, int(99.999999) will evaluate as 99 whitch will fail the equality
test with 99.999999.
That's because ALL calculations are performed as floating point and a
division by 10 becomes a multiplication by 0.1, a value that can't be
represented exactly using any floating point binary notation.
In fact, almost only values that are exact powers of 2 will give exact
result in a division.
>
>
Your scene file is a text file.
The parse is the interpretation of the scene file. It goes over your
code to find what to render.
It construct the actual data representing your scene in a totaly numeric
form.
Once the parcing is termined, you can change and save your scene WITHOUT
any effect on the resulting image. You can't save your modifications
during the parse phase.
The rendering comes next, it's the step that actualy create the image
that you can see from the numerical model created during the parse.
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>> I'd expect mention of exponential functions in the precedence listing.
>> I'd also point out that (A^2) is not a valid expression - pow(x,2) is
>> the way to
>> write that in POV-Ray. And don't confuse pow() with pwr().
> It's because the caret "^" operator can often become ambiguous.
> What do you *realy* mean if you have 2^2/3?
> It can be 2^(2/3) OR be (2^2)/3.
> or what about 2^3^4...
> It can be 2^(3^4) OR (2^3)^4.
> In both cases, the result are NOT the same.
> Depending on your background, or domain of work/activity, it can be
> evaluated either right to left or left to right.
Should have added some spaces...
What do you *realy* mean if you have 2^ 2/3?
It can be 2^(2/3) OR be (2^ 2)/3.
or what about 2^ 3^ 4...
It can be 2^(3^ 4) OR (2^ 3)^ 4.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Should have added some spaces...
>
> What do you *realy* mean if you have 2^ 2/3?
> It can be 2^(2/3) OR be (2^ 2)/3.
> or what about 2^ 3^ 4...
> It can be 2^(3^ 4) OR (2^ 3)^ 4.
That's the purpose of heirarchy.
I'd write them the way you wrote them with the parentheses.
I've always learned that ^ precedes /, so 2^2/3 would be (2^2)/3.
But _allowing_ the use of a carat would be useful.
I suppose I could something clever with an include file...
[I can't believe I wrote that about abs... my brain must have been OFF!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>
>> Should have added some spaces...
>>
>> What do you *realy* mean if you have 2^ 2/3?
>> It can be 2^(2/3) OR be (2^ 2)/3.
>> or what about 2^ 3^ 4...
>> It can be 2^(3^ 4) OR (2^ 3)^ 4.
>
> That's the purpose of heirarchy.
>
> I'd write them the way you wrote them with the parentheses.
> I've always learned that ^ precedes /, so 2^2/3 would be (2^2)/3.
Yes, but many peoples will use that for 2^ (2/3) by only adding a space
between the ^ and the second 2, space that will be ignored by the parser.
> But _allowing_ the use of a carat would be useful.
>
> I suppose I could something clever with an include file...
>
> [I can't believe I wrote that about abs... my brain must have been OFF!
>
>
The caret WAS supported in older versions but was removed. I still find
some old, legacy, scenes using the caret operator. They cause errors
that are resolved using the pow(x, y) format.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|