POV-Ray : Newsgroups : povray.newusers : Intersections not quite working? : Re: Intersections not quite working? Server Time
28 Jul 2024 12:38:21 EDT (-0400)
  Re: Intersections not quite working?  
From: Ian K
Date: 16 Mar 2009 21:00:00
Message: <web.49bef5299813c63bce8107250@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> Things like that can happen with coincident surfaces.
>
> In the general case, the workround is to displace one of the components
> slightly
>
>   #local arcDepth2 = arcDepth*1.00001;
>
>     //Semicircle 2
>     difference{
>       cylinder{ centre - arcDepth2 * arcNorm, centre + arcDepth2 *
>         arcNorm, arcRadius }
>       plane{ arcSweepEnd, 0 translate centre}
>     }
>
>
> However, in this case you don't need a second cylinder. You can just
> difference both planes from the same one:
>
> #macro drawAcuteArc(centre, arcSweepStart, arcSweepEnd, arcRadius,
> borderWidth)
>   #local arcDepth = 0.1;
>   #local arcNorm = vcross(arcSweepStart,arcSweepEnd);
>
>   difference{
>     cylinder{ centre - arcDepth * arcNorm, centre + arcDepth
>        * arcNorm, arcRadius }
>     plane{ arcSweepStart, 0 translate centre }
>     plane{ arcSweepEnd, 0 translate centre}
>     pigment {rgbf <1,0,0,0>}
>    }
> #end

Many thanks for this, and for the obtuse form.

My original intention was to use two cylinders so that once I'd got it working,
I'd be able to use the same macro for reflex angles just by calculating the
angle and changing the 'intersection' to a 'merge', which is why the original
looks like it does. I'm now thinking it would be easier to plan to detect the
angle inside an umbrella drawArc function and then use the appropriate macro
from inside.

-Ian


Post a reply to this message

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