POV-Ray : Newsgroups : povray.general : Help with "programmatically" determining intersection : Help with "programmatically" determining intersection Server Time
3 May 2024 04:58:33 EDT (-0400)
  Help with "programmatically" determining intersection  
From: Bald Eagle
Date: 16 Mar 2016 23:10:00
Message: <web.56ea1f7e7eb839c15e7df57c0@news.povray.org>
I have 2 involute curves that I'm "plotting" with spheres as I increase theta in
the following manner:

#declare Z1 = Base * (sin(theta) - theta*cos(theta));
#declare Z2 = -Base * (sin(theta) - theta*cos(theta));  // Opposite side of
involute tooth
sphere{ <X, T1, Z1>, T1 pigment {Blue} rotate -y*Tooth1*AngularSpacing}
sphere{ <X, T1, Z2>, T1 pigment {Blue} rotate -y*Tooth2*AngularSpacing}

Since I'm using a loop to increase theta in discrete increments, I can't test if
the 2 points are coincident because I might have already skipped over the place
where they would be.

I could probably devise a practical method of skipping over this problem and
obtaining the end result, but I'd like to learn how to best handle this issue
and have that one extra coding skill to employ in the future.

I've tried testing to see if the difference of the z components is below a
certain value:

#declare NegInvolute = transform {rotate <0, -AngularSpacing, 0>};
#declare NI_Point = vtransform (<X, T1, Z2>, NegInvolute);
#if ( abs(Z1) - abs(NI_Point.z) < 0.1)
but that seems to highlight every point leading up to the intersection, and if I
witch the position of the terms in the difference, I get all of the points after
the intersection - and it doesn't seem like it as close to or including the
actual intersection point as I'd expect.   And it seems kind of clumsy and
inelegant.

What's the best way to go about determining the intersection of intermittently
plotted curves?


Post a reply to this message

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