Discussion:
Extrapolated null position based on two tracked points
(too old to reply)
N***@adobeforums.com
2009-03-13 17:49:02 UTC
Permalink
The photo is pretty self-explanatory. If I have two tracked points, how can I determine the coordinates for a third position? I plan on wiring the distance of the extrapolated null to a slider to control the distance from the tracked points.

<Loading Image...>
M***@adobeforums.com
2009-03-16 13:01:01 UTC
Permalink
Determine the angle based on teh difference, then use it to drive sinus and cosinus:

Radius=thisLayer.effect("Slider")("Slider");

A=thislayer.Tracker("A").featureCenter;
B=thislayer.Tracker("B").featureCenter;

DiffX=B[0]-A[0];
DiffX=B[1]-A[1];

Ang=Math.atan2(DiffY,DiffX);

X=Math.cos(Ang)*Radius;
Y=Math.sin(Ang)*Radius;

[X,Y]

Mylenium
D***@adobeforums.com
2009-03-16 13:38:42 UTC
Permalink
You can simplify the math a little if you keep everything as vectors:

slider = effect("Slider Control")("Slider");
T1 = thisComp.layer("your_track_layer").motionTracker("Tracker 1")("Track Point 1").attachPoint;
T2 = thisComp.layer("your_track_layer").motionTracker("Tracker 1")("Track Point 2").attachPoint;
T1 + normalize(T1-T2)*slider

Dan
N***@adobeforums.com
2009-03-16 19:37:46 UTC
Permalink
You guys are awesome! $$$ (or €€€) for the tip jar! :)
N***@adobeforums.com
2009-03-17 18:56:59 UTC
Permalink
That works great. Now how would I keep null rotation matched based on the vector formed by the two trackers?
M***@adobeforums.com
2009-03-18 07:20:54 UTC
Permalink
You simply use the angle my formula spits out --> radiansToDegrees(Ang). You may just need to add 180 degrees to reverse it...

Mylenium
N***@adobeforums.com
2009-03-24 19:45:50 UTC
Permalink
Thanks -- I'll try it!

Loading...