POV-Ray : Newsgroups : povray.advanced-users : Tangent to two ellipses? : Re: Tangent to two ellipses? Server Time
29 Jun 2024 02:06:46 EDT (-0400)
  Re: Tangent to two ellipses?  
From: Le Forgeron
Date: 17 Oct 2010 15:22:58
Message: <4cbb4d12$1@news.povray.org>
Le 17/10/2010 19:43, Tim Cook nous fit lire :

> ...which is why I (well, tried to) specify the particular one of those
> in which I'm interested.


Ascending left from lower (0,0 ?) to right of upper (0.5,2.875 ?) still
does not say if it is crossing the lines of center or not between the
centers.

> 
>>> (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)
>>>
>> The second case is just identical, a point is a 0-radius circle.
> 
> Figured as much.  I vaguely remember asking a similar question about two
> /circles/ on this or another group, but two ellipses is...a bit
> trickier.  Even just being able to figure out the slope of a tangent to
> a particular point on an ellipse would be a help.
> 

Well, the tangent vector is shitty, but finding the distance from such
line to a point should allow to bisect the right value.

let's a=2/2; /* half of 2 on x*/
let's b=1.4375/2; /* half of 1.4375 on y */

Contact point (origin) is <x,y> with
x = a cos(t)
y = b sin(t)

Direction of tangent (as unit vector, thanks wolfram):<m,n>
m = -a sin(t)/q
n = b cos(t)/q
with (and that the shitty part) q = sqrt(b²cos²t + a²sin²t)
(notice that q is not constant!)

Distance of line to point <i,j>:
i= -2.03125
j= 0.21875

k = sqrt((i-x)²+(j-y)²)
(k is length of point to contact, we need to normalise to have a nice
dot product which we can predict)

value to reach 1: ((i-x)*m+(j-y)*n)/k
(1 is a maximum)

Or using a cross product (the tangent must align...):
(to reach 0, intermediate value): (j-y)*m-(i-x)*n
(and we avoid a square root and might be able to also drop q)

so (j-b cos(t))*sin(t)*(-a) - (i-a sin(t))*cos(t)*b == 0
Good luck. (there is 2 t to find in [-pi;pi])


Post a reply to this message

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