POV-Ray : Newsgroups : povray.general : Help! Can anyone figure this math? : Re: Help! Can anyone figure this math? Server Time
13 Aug 2024 19:22:48 EDT (-0400)
  Re: Help! Can anyone figure this math?  
From: Philippe Debar
Date: 31 Aug 1998 18:10:52
Message: <35eb115c.0@news.povray.org>
Peter Popov wrote in message <35eb075c.0@news.povray.org>...
>It may be too late now,
Never too late. As I said in my first post, I found a workaround - and
you provided others. So urgency is out... but I'd like to know the
'good' solution.

>but I have a question: can't you use spheres to join
>cones?
Yes... but the torus and the sphere solutions handle different cases.
With a sphere, you can join cones on different axis, you can't with
a torus. My cones would be on the same axis. They could be joined
smoothly by either adding a torus or removing a torus from a
cylinder. You can't do that with a sphere.

>Here's a clip from an include I am writing:
>(...)
>The rather complex CSG is used to ensure that only the part of the sphere
>joining the two cones is used, and the rest is clipped.
>P.S. I am not very good in intersecting planes, so this code isn't very
>clear. If you find a better way to do the above please post it here. 10x


Kind of 'connect the dots' code? I tend to use boxes rather than planes,
this is a old habit. I never ever checked, but I have a feeling that pov is
(or was) quicker with finite boxes then with infinite planes. I may be
completely mistaken.
I tried unsucessfully to simplify the principle of your code. I found other
ways to work but they were just as complicated. The only advice I can
give is to be more systematic. For example, either you switch the
substraction order of your vectors (in the plane definition), either you
switch where the inverse keyword is. Doing both at the same time is
confusing.

So, I'll write (didn't check with pov but seems all right):

union
  {
  cone { Last, RLast, Current, RCurrent }
  cone { Current, RCurrent, Next, RNext }
  intersection
    {
    // moved everything to <0,0,0>: less code that way;
    // all is translated below with only one translate statement
    sphere { 0, RCurrent }
    union
      {
      difference // simpler than intersection + inverse
        {
        plane { Next-Current, 0 }
        plane { Current-Last, 0 }
        }
      difference // same as above with planes permutated
        {
        plane { Current-Last, 0 }
        plane { Next-Current, 0 }
        }
      }
    bounded_by { sphere { 0, RCurrent*1.00001 } }
    translate Current
    }
  }

>Hope this helps.
>Peter

Me too,

Philippe


Post a reply to this message

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