|
![](/i/fill.gif) |
A few questions about the variable you used:
'arcSweepStart' & 'arcSweepEnd' are they location vectors or normal
vectors because you use them as normals in the planes?
The way you use them if they're not pointing in the right direction
it'll get funky.
'centre' I'm questing would be the midpoint between two atoms.
'arcRadius' This I'm not sure of. If your connection two atoms at
variable distances from each other, then the radius would have to be
calculated, so that the end points of your bond would touch both atoms.
If in your model the atoms are all equal distance the 'arcRadius' is
redundant
Ian K wrote:
> 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
|
![](/i/fill.gif) |