POV-Ray : Newsgroups : povray.general : Debugging help : Re: Debugging help Server Time
20 Apr 2024 10:00:24 EDT (-0400)
  Re: Debugging help  
From: Anthony D  Baye
Date: 23 May 2017 03:35:00
Message: <web.5923e5451ef603fefd6b6fe10@news.povray.org>
"omniverse" <omn### [at] charternet> wrote:
> clipka <ano### [at] anonymousorg> wrote:
> >
> > My spontaneous guess would be that the use of `acos` here might be to
> > blame, as it will only return values in the range from -90 to +90
> > degrees, losing information about the quadrant. Maybe try rephrasing
> > that as an expression satisfying the form `atan(A/B)`, and then use
> > `atan2(A,B)` instead to make sure you get the quadrant right.
> >
> > I haven't fully thought it through, but I think the following should do
> > the trick:
> >
> >     #local wall_th = degrees(atan2(wall_vec.x, wall_vec.z));
> >
> > (You may need to tweak the expression a bit, e.g. swapping the `.x` and
> > `.z`, and/or changing the sign of one or both of them.)
>
> Well, since no one has actually posted about the solution to this given there I
> thought I would try it. Rendered okay as done for macro portion below.
>
> I was looking at it yesterday and thought it must be possible just to put
> conditional #if regarding certain degrees for wall_th but only got me thoroughly
> confused. I'm no math wizard, by far! Just wanted to see how this went.
>
> #macro Wall(START, END, HEIGHT, BSIZE, MWIDTH)
>
>     #local wall_vec = vnormalize(END - START);
>     #local wall_vec = <wall_vec.u, 0, wall_vec.v>;
>     #local wall_dlength = vlength(END - START);
>     #local wall_perp = vcross(wall_vec, y);
>   // #local wall_th  = degrees(acos(vdot(wall_vec,x))); // replaced with...
> #local wall_th = degrees(atan2(wall_vec.z, wall_vec.x)); // ...Clipka answer
>     #local remainder = 0;
> // commented intersection removed from here
>     union {
>     #local wall_aheight = 0.0;
>     #while(wall_aheight < HEIGHT)
>     #local wall_alength = 0.0;
>         #while(wall_alength < wall_dlength)
>             #local nbLength =
>             (remainder > 0 ? remainder : min(BSIZE.x, wall_dlength -
> wall_alength));
>             #local remainder = 0;
>             object {
>              Block(nbLength, BSIZE.y, BSIZE.z) rotate -(wall_th)*y
> translate <START.u, wall_aheight, START.v> + wall_alength*wall_vec
> } // object closing brace
>         #local wall_alength = wall_alength + nbLength + MWIDTH;
>         #end
>     #local remainder = BSIZE.x - nbLength;
>     #local wall_aheight = wall_aheight + BSIZE.y + MWIDTH;
>     #end
>     } // union closing brace
> // prism removed from here
> #end

Yeah... I did try it,but I got interrupted while I was replying and never got
back to it.

No joy so far.

Regards,
A.D.B.


Post a reply to this message

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