Page 1 of 1

Find lines intersection

Posted: July 30th, 2009, 8:39 am
by Thunderino
graphic.jpg
graphic.jpg (15.59 KiB) Viewed 27203 times
Hi all! This is the problem. I'm animating a technical graphic with 2 axes.
The X axis is time and the Y axes is another parameter. The white line moves straight forward from 1 to 11 and the white circle moves exactly on the red line because the red line is a path i did in Photoshop and put in the circle position property. I want the white circle to be always positioned in the intersection between the white and the red line. I tryed to link the x axes of the circle to the x axes of the line and leave its Y values but in this way the circle goes off the red line...
Thenks for the help!

Re: Find lines intersection

Posted: August 1st, 2009, 2:04 am
by zold
Fun problem. At first crack, I would say that you need to have the line follow the circle instead of vice-versa, by expression-linking the line's (x) position to the circle. so the line's position would have an expression something like:

Code: Select all

[thisComp.layer("circle").position[0], value[1]]
But I realize this may be a problem if you want the line to be moving at a constant speed from left to right, in which case this requires more thought on my or someone's part ...

Re: Find lines intersection

Posted: August 2nd, 2009, 11:35 am
by Thunderino
You're right, this is the problem. The lines moves at a constant speed so you should tell to the circle to move faster or slower. It's difficult to understand how I can tell to the circle to go faster without crossing the line. Very nice question it seems!!

Re: Find lines intersection

Posted: November 17th, 2009, 12:03 pm
by Mylenium
Should be simple. Just some quick thoughts:

- determine the ratio of the line traveling speed compared to the duration of the graph curve draw on
- feed the resulting multiplier into a valueAtTime() expression referencing the line for X and the respective Y value from the curve

Mylenium

Re: Find lines intersection

Posted: November 17th, 2009, 1:38 pm
by kobyg
Thunderino,
If this is still relevat, please post a project file so we can understand better how you've built the elements,
and understand the problem better, and hopefully could find a solution.
If I understood the problem correctly, this is not as simple as it seems, but I have an idea how to solve it.
I just have to see your project file to see if I understood the problem correctly.

Koby.