Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Intersection of 2 vectors (vanishing point)

  • Intersection of 2 vectors (vanishing point)

    Posted by Peter O’connell on October 3, 2008 at 3:34 pm

    Hi I am trying to calculate the vanishing point (E) for some footage I have tracked and applied a 4 corner pin track to. Points a,b,c and d represent the cornerpin points and I am trying to calculate point E by calculating the intersection of vector ab and cd.
    ——-a
    —————-b

    —————————E
    —————-d
    ——-c

    Cross product?Atan2? I’m not sure how to approach this.
    Any help would be greatly appreciated
    Pete

    Peter O’connell replied 17 years, 7 months ago 3 Members · 4 Replies
  • 4 Replies
  • Darby Edelen

    October 3, 2008 at 5:18 pm

    Unfortunately I don’t have the time to really dig into this, so I’ll just share the first link I found on google with you 🙂

    https://www.gotoandplay.it/_articles/2006/08/vectors.php

    Hopefully that gives you some ideas?

    Darby Edelen

  • Peter O’connell

    October 3, 2008 at 6:16 pm

    Hi Darby, I saw that one but I was hoping there might be a javascript implementation around that would be more AE friendly.
    Thanks
    Pete

  • Dan Ebberts

    October 3, 2008 at 6:54 pm

    This seems to work as long as a-b or c-d isn’t vertical (you could put in some code to test for that):

    a = thisComp.layer(“a”).position;
    b = thisComp.layer(“b”).position;
    c = thisComp.layer(“c”).position;
    d = thisComp.layer(“d”).position;

    //y = mx + b
    m1 = (b[1] – a[1])/(b[0] – a[0]);
    m2 = (d[1] – c[1])/(d[0] – c[0]);
    b1 = a[1] – m1*a[0];
    b2 = c[1] – m2*c[0];
    x = (b2 – b1)/(m1 – m2);
    y = m1*x + b1;
    [x,y]

    Dan

  • Peter O’connell

    October 4, 2008 at 4:40 pm

    Dan Ebberts to the rescue yet again
    Thanks so much!
    Pete

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy