POV-Ray : Newsgroups : povray.newusers : Intersections not quite working? : Intersections not quite working? Server Time
28 Jul 2024 12:24:21 EDT (-0400)
  Intersections not quite working?  
From: Ian K
Date: 16 Mar 2009 13:45:00
Message: <web.49be8fcd44abb44af8e064a80@news.povray.org>
So, I'm pretty new at this, but I'm trying to render arcs to display the angles
between bonds in molecules, using a function that takes the vectors of the
bonds and uses the intersection of two semicircular prisms to draw an acute arc
- something like this:


#macro drawAcuteArc(centre, arcSweepStart, arcSweepEnd, arcRadius, borderWidth)
  #local arcDepth = 0.1;
  #local arcNorm = vcross(arcSweepStart,arcSweepEnd);
  #local arcAngle = VRotation(arcSweepStart, arcSweepEnd, arcNorm);
  #debug "Angle = "
  #debug str(arcAngle, 0, 3)

  intersection {
    //Semicircle 1
    difference{
      cylinder{ centre - arcDepth * arcNorm, centre + arcDepth * arcNorm,
arcRadius }
      plane{ arcSweepStart, 0 translate centre }
    }

    //Semicircle 2
    difference{
      cylinder{ centre - arcDepth * arcNorm, centre + arcDepth * arcNorm,
arcRadius }
      plane{ arcSweepEnd, 0 translate centre}
    }

    pigment {rgbf <1,0,0,0>}
  }
#end

drawAcuteArc(0, <0,1,1>, <1,0,0>, 5.5, 0.5)



The only problem is that this doesn't do that. It seems to instead give me a
slice where the arc would start, and a slice where the arc would stop, and no
arc.

If I make the faces more differently placed, it seems to intersect correctly - I
tried making one of the cylinders bigger than the other, and it seemed that only
faces that were created by the intersection, rather than faces which were
coincident in the creating models, were shown. This seems a little dodgy - is
it a bug?

Thanks,
-Ian


Post a reply to this message

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