|
![](/i/fill.gif) |
Tim Cook wrote:
> I have a spline which I which to simplify to a series of CSGed cylinders
> and boxes.
>
> cylinder 1 is located at 0, 0 with major and minor axes of 2 and 1.4375
> cylinder 2 is located at 0.5, 2.875 with maj./min. axes of 1.786, 1.03125
>
> How do I find the endpoints of the tangent ascending from the left of
> the lower circle to the right of the upper circle?
>
> (Also on this spline is needed a tangent descending from the left of the
> lower circle to intersect point -2.03125, 0.21875, the method of
> solution of which is probably related to the other problem)
This part if simpler, for the ellipse defined as
x(t)=a*cos(t)+x0;
y(t)=b*sin(t)+y0;
x0=0;
y0=0;
px=-2.03125;
py= 0.21875;
dx=x0-px;
dy=y0-py;
D=(a^2*dy^2-b^2*a^2+dx^2*b^2);
t=atan2(-(a^2*dy^2+dx*dy*D^(1/2))*b, a*(-dx*b^2+dy*D^(1/2))*dy)+pi;
s=atan2(-(a^2*dy^2-dx*dy*D^(1/2))*b, a*(-dx*b^2+dy*D^(1/2))*dy)+pi;
the point on the ellipse for the tangent line
you need through the point (px,py) would be
Q=(x(s),y(s)) = (-1.87534111088024,0.499567815891366)
As for the tangent to two ellipses
xt(t)=a*cos(t)+xt0;
yt(t)=b*sin(t)+yt0;
xs(s)=c*cos(s)+xs0;
ys(s)=d*sin(s)+ys0;
there are two constrains for two unknowns t and s:
tan_ell1 = (+/-) tan_ell2
tan_ell1 = tan_line
the second parameter s is dependent on t:
s=arctan((+/-)a*d*tan(t)/(b*c));
finally it boils out to a single non-linear equation in t
(ys(s)-yt(t))/(xs(s)-xt(t))= (+/-) b/a/tan(t)
Maple gives an analytic solution, but it is unreasonably long.
Two points to take care of: signs and (+/-) pi to the value of arctangent.
Post a reply to this message
Attachments:
Download 'el00.pdf' (5 KB)
|
![](/i/fill.gif) |