|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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)
--
Tim Cook
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 17/10/2010 07:38, Tim Cook nous fit lire :
> 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
>
Orientation ?
Are they true ellipses or just scaled circles ?
> How do I find the endpoints of the tangent ascending from the left of
> the lower circle to the right of the upper circle?
Why do you need such endpoints ? (with precision)
Wouldn't an approximation be enough ?
Between 2 non colliding circles, there is 4 tangents. (two are crossings
between the centers, the two others are parallel or crossing on the side
of the smaller circle past its center)
(well, symetry rules along the axis defined by 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.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 2010-10-17 03:05, Le_Forgeron wrote:
> Le 17/10/2010 07:38, Tim Cook nous fit lire :
>> 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
>>
> Orientation ?
0 rotation, major axis along x.
> Are they true ellipses or just scaled circles ?
Er? I thought that's what ellipses were...rather, a circle being a
special case of an ellipse. (One site I looked at mentioned scaling
everything so one ellipse is a unit circle at origin and solving from
there...?)
>> How do I find the endpoints of the tangent ascending from the left of
>> the lower circle to the right of the upper circle?
>
> Why do you need such endpoints ? (with precision)
> Wouldn't an approximation be enough ?
Well, enough precision to get a smooth surface in a render.
Approximation is fine. I'm working at five decimal places right now...
> Between 2 non colliding circles, there is 4 tangents. (two are crossings
> between the centers, the two others are parallel or crossing on the side
> of the smaller circle past its center)
> (well, symetry rules along the axis defined by the centers)
...which is why I (well, tried to) specify the particular one of those
in which I'm interested.
>> (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.
--
Tim Cook
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 2010-10-17 13:43, Tim Cook a écrit :
>> Are they true ellipses or just scaled circles ?
>
> Er? I thought that's what ellipses were...rather, a circle being a
> special case of an ellipse. (One site I looked at mentioned scaling
> everything so one ellipse is a unit circle at origin and solving from
> there...?)
Yes, a circle is a special case of an ellipse.
No, an ellips is not an unevenly scalled circle. It's close but not
quite the same.
>
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 2010-10-17 13:23, Alain wrote:
> No, an ellips is not an unevenly scalled circle. It's close but not
> quite the same.
Odd...what is the exact difference?
(Also, it means my question is about finding tangents and points on
scaled circles, not ellipses...)
--
Tim Cook
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Tim Cook <z99### [at] gmailcom> wrote:
> On 2010-10-17 13:23, Alain wrote:
> > No, an ellips is not an unevenly scalled circle. It's close but not
> > quite the same.
> Odd...what is the exact difference?
I'm not sure there is a difference.
The canonical form of an ellipse is: x^2/a^2 + y^2/b^2 = 1, where 'a' is
the horizontal radius and 'b' is the vertical radius.
For the sake of simplicity, let's keep the vertical radius at 1 and only
modify the horizontal radius to get our ellipse. If we wanted a function
in terms of 'x' (so that we can eg. draw the top half of the ellipse), we
would solve 'y', so we get (assuming b=1): y = sqrt(1 - (x/a)^2)
Now let's take the canonical form of a circle of radius 1: x^2 + y^2 = 1
If we solve 'y', we get: y = sqrt(1 - x^2)
If we wanted to scale our circle horizontally, we would have to divide
'x' by the scaling factor. In other words, if we want to scale the circle
horizontally by factor 'f', we would have to divide 'x' by 'f'. (For example,
if we wanted to scale the circle to be twice as wide as it is tall, we would
have to divide 'x' by 2.)
Thus we get: y = sqrt(1 - (x/f)^2), which is exactly the equation for the
ellipse where the vertical radius is 1 and the horizontal radius is 'f'.
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 2010-10-17 14:22, Le_Forgeron wrote:
> Good luck. (there is 2 t to find in [-pi;pi])
Well, this is a place to start. If I come up with a tidy generalised
form, maybe I can make a macro that lets you build two arbitrary
(non-rotated, at least) ellipses joined by one of their tangents...(ha ha).
--
Tim Cook
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 2010-10-17 14:22, Le_Forgeron wrote:
> 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)
ehm...what value are you using for t here? (it occurs to me that I
should've been able to figure that out, how you find a point on an
ellipse...use the same formulas as for a circle, but with different x
and y radius values)
--
Tim Cook
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Le 18/10/2010 05:55, Tim Cook a écrit :
> On 2010-10-17 14:22, Le_Forgeron wrote:
>> 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)
>
> ehm...what value are you using for t here? (it occurs to me that I
> should've been able to figure that out, how you find a point on an
> ellipse...use the same formulas as for a circle, but with different x
> and y radius values)
>
Well t is anything in the range [0;2pi](modulo 2pi).
(or [-pi;pi]... and so on)
--
Real software engineers work from 9 to 5, because that is<br/>
the way the job is described in the formal spec. Working<br/>
late would feel like using an undocumented external procedure.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|