# Solving a complicated moving geometry problem ? Classic List Threaded 5 messages Open this post in threaded view
|

## Solving a complicated moving geometry problem ?

 Hi.I am looking for guidance on how to solve a complicated moving geometry problem.Let's say I have 2 objects.Object #1 is a very small ball on a string at fixed point(x,y,z) with speed, S.  It can move in any direction provided it stays on a path dictated by the string.  And the length of the string is increasing at a fixed rate.  The ball is infinitely small in this example.   Radius << smaller than the cylinder.The other end of the string is attached to the origin at 0,0,0.Object #2 is a stationary inclined cylinder of diameter D and length L.I want to swing the ball such that it hits the cylinder tangentially.  The cylinder lies within the radius of the string that the ball is attached to.For simplification, we could say that the axis of the cylinder passes through 0,0,0.I want to calculate the following:1) The vector the ball should be aimed at to collide tangentially with the cylinder.2) The time to collision.3) The point (x,y,z) of collision.The cylinder surface can be modelled as (x-u) ^2 + (y-v)^2 + (z-w)^2 = 3/8 D^2.Where u, v and w are on a line that forms the center of the cylinder, asau + by + cz = k     a,b,c and k are constants.The ball on the string can be modelled as:position(x,y, z)  = r cos(theta) sin(phi) , r cos(theta) cos(phi), r  sin(theta))theta and phi are known at the start, but will change as the ball travels. speed of ball = S   Assume it stays constant throughout its trajectory.. where r = the length of the string and theta and phi are the angles the string makes with the various planes.  The string gets longer at a constant rate, so...dr/dt = Kdposition/dt = ... the whole long derivative of the position equation.Mass and gravity can be ignored.This is where I am stuck.  How do I calculate the initial trajectory vector of the ball such that it strikes the cylinder tangentially ?  I can represent the surface of the cylinder as a set of lines parallel to the cylinder axis at radius R.   If the ball strikes the cylinder tangentially the velocity of the ball will be perpendicular to the contact point and the cylinder axis. Thoughts ?
Open this post in threaded view
|

## Re: Solving a complicated moving geometry problem ?

 So it seems the ball is following a trajectory that does not depend on the cylinder. Hence just turn around the question: given the trajectory of the ball (that you can solve using an ODE) where can I place a cylinder (with your constraints) such that its surface is tangential to the trajectory? Another easy approach is to conde the crossing of the cylinder surface by the ball, and the tangential condition as event functions, and add that to your ODE solver, then search the initial conditions that trigger the events. Check https://octave.org/doc/interpreter/Matlab_002dcompatible-solvers.html#Matlab_002dcompatible-solversto learn how to use events.
Open this post in threaded view
|

## Re: Solving a complicated moving geometry problem ?

 Thank you for your comments.  I'll check the links out.The problem (in my mind) is that I don't know the trajectory of the ball such that it will strike the surface tangentially.   The string is increasing in length with time.  As it increases in length the contact point moves and the flight time increases.  So I don't have a point on the cylinder from which to calculate a trajectory.Maybe I just need to sleep on it.  Or solve an easier case first, ie not tangential, and I'll see the solution.It's just math, after all.On Thu, Jan 2, 2020 at 8:13 PM Juan Pablo Carbajal <[hidden email]> wrote:So it seems the ball is following a trajectory that does not depend on the cylinder. Hence just turn around the question: given the trajectory of the ball (that you can solve using an ODE) where can I place a cylinder (with your constraints) such that its surface is tangential to the trajectory? Another easy approach is to conde the crossing of the cylinder surface by the ball, and the tangential condition as event functions, and add that to your ODE solver, then search the initial conditions that trigger the events. Check https://octave.org/doc/interpreter/Matlab_002dcompatible-solvers.html#Matlab_002dcompatible-solvers to learn how to use events.
Open this post in threaded view
|

## Re: Solving a complicated moving geometry problem ?

 I think I just figured it out... if I calculate the tangent line along the surface of the cylinder, then I just have an increasing radius arc intersecting a line.  I think I know how to calculate the tangent points that make up the line.On Thu, Jan 2, 2020 at 8:29 PM linux guy <[hidden email]> wrote:Thank you for your comments.  I'll check the links out.The problem (in my mind) is that I don't know the trajectory of the ball such that it will strike the surface tangentially.   The string is increasing in length with time.  As it increases in length the contact point moves and the flight time increases.  So I don't have a point on the cylinder from which to calculate a trajectory.Maybe I just need to sleep on it.  Or solve an easier case first, ie not tangential, and I'll see the solution.It's just math, after all.On Thu, Jan 2, 2020 at 8:13 PM Juan Pablo Carbajal <[hidden email]> wrote:So it seems the ball is following a trajectory that does not depend on the cylinder. Hence just turn around the question: given the trajectory of the ball (that you can solve using an ODE) where can I place a cylinder (with your constraints) such that its surface is tangential to the trajectory? Another easy approach is to conde the crossing of the cylinder surface by the ball, and the tangential condition as event functions, and add that to your ODE solver, then search the initial conditions that trigger the events. Check https://octave.org/doc/interpreter/Matlab_002dcompatible-solvers.html#Matlab_002dcompatible-solvers to learn how to use events.
Open this post in threaded view
|

## Re: Solving a complicated moving geometry problem ?

The 'equation of the cylinder' seems to be the equation of an ellipsoid/sphere.
When I was a student I developed applications which solved intersections between geometric entities. Please verify:  Ellipsoid

On Friday, January 3, 2020, 5:34:09 AM GMT+2, linux guy <[hidden email]> wrote:

I think I just figured it out... if I calculate the tangent line along the surface of the cylinder, then I just have an increasing radius arc intersecting a line.  I think I know how to calculate the tangent points that make up the line.

On Thu, Jan 2, 2020 at 8:29 PM linux guy <[hidden email]> wrote:

The problem (in my mind) is that I don't know the trajectory of the ball such that it will strike the surface tangentially.   The string is increasing in length with time.  As it increases in length the contact point moves and the flight time increases.  So I don't have a point on the cylinder from which to calculate a trajectory.

Maybe I just need to sleep on it.  Or solve an easier case first, ie not tangential, and I'll see the solution.

It's just math, after all.

On Thu, Jan 2, 2020 at 8:13 PM Juan Pablo Carbajal <[hidden email]> wrote:
So it seems the ball is following a trajectory that does not depend on
the cylinder.
Hence just turn around the question: given the trajectory of the ball
(that you can solve using an ODE) where can I place a cylinder (with
your constraints) such that its surface is tangential to the
trajectory?
Another easy approach is to conde the crossing of the cylinder surface
by the ball, and the tangential condition as event functions, and add
that to your ODE solver, then search the initial conditions that
trigger the events.
Check https://octave.org/doc/interpreter/Matlab_002dcompatible-solvers.html#Matlab_002dcompatible-solvers
to learn how to use events.