POV-Ray : Newsgroups : povray.advanced-users : It gets even weirder. : Re: It gets even weirder. Server Time
3 Feb 2023 14:56:55 EST (-0500)
  Re: It gets even weirder.  
From: Bald Eagle
Date: 27 Aug 2018 18:00:01
Message: <web.5b8473f629c104f2458c7afe0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:

> >> PEBCAK Error.
>
> I guess I can do better. Sorry for that. It was intended purely humorously.

Indeed.  Still accurate.  ;)

> ....the next loop - even if running properly - seems
> to be designed to access StitchedArray up to index 12 and 36, which may
> bite you even after cleaning out the problem currently at hand.

> This is dangerous, as you're using a non-integral loop variable with a
> non-integral stepping, and it may not exactly end up at U2 even though
> mathematically it should. The loop may run sort or long, i.e. Phi may
> end up anywhere between U2-Phi_inc+epsilon to U2+Phi_inc-epsilon.
>
> The resulting Phi/Phi_inc should nominally be 12, but may be anywhere
> between 12-1+epsilon = 11+epsilon to 12+1-epsilon = 13-epsilon.

> I recommend using `U = ceil(Phi/Phi_inc - 0.5)` or some such, i.e.
> proper rounding.

Which is "wrong" according to some, but if it works, it'll be fine.  :)

> Or maybe better still, use U and V as the loop variables, and from those
> compute the angle, rather than vice versa.



"Your code was crap, and didn't anyone ever tell you not to do things like
that?"

"The pile of code accumulated as a result of your excremental coding practices
was giving off a pile of steam that was obscuring a logical view of the
problem."
"GIVE ME THAT."
(grabs code and hurls the offending parts in the bit bucket)
"Here."

#for (U, 0, Usize-1)
 #for (V, 0, Vsize-1)
  #declare Phi = (U*Phi_inc);
  #declare Theta = (V*Theta_inc);

Much more better.

And now back to the funnerer stuff.

------------------------------------------------
Today's daily summary:

Broke POV-Ray with a previously unknown bug.
("That's why we let you sit at the Adult keyboard, BE, No one breaks things as
well or as often as you do.")
Spurred good ole' jr to do some fancy array-slinging and show off a bit.
(I think he can do better  ;)  )
Learned NOT TO DO THAT.    EVER AGAIN.

That plus a host of other things made today annoying and arduous, but
well-spent.


Post a reply to this message

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