POV-Ray : Newsgroups : povray.newusers : rounding and logic functions : Re: rounding and logic functions Server Time
19 May 2024 17:01:47 EDT (-0400)
  Re: rounding and logic functions  
From: Alain
Date: 4 Aug 2013 21:44:29
Message: <51ff037d$1@news.povray.org>

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

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