Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions I suck in Trigonometry

  • I suck in Trigonometry

    Posted by Roland R. kahlenberg on December 4, 2013 at 11:22 pm

    I really do. 🙁

    Here’s why –
    1) I have two points, A and B.
    A is centered in the comp.
    B in position terms is [+290,0] from A

    2) I’m trying to auto place objects, using position, around a 290-pixel diameter of a circle.

    3) I need to find C, which connects lines between A and C and B and C. I also know the angle for A to C.

    What’s the Expression to find the (1) length between A and C and
    (2) length between B and C?

    TIA
    RoRK

    Intensive mocha & AE Training in Singapore and Other Dangerous Locations

    Imagineer Systems (mocha) Certified Instructor
    & Adobe After Effects CS6 ACE/ACI

    Aimee Murray replied 7 years, 6 months ago 3 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    December 5, 2013 at 12:50 am

    I’m confused. Are B and C located on the circle? Is the circle diameter 290, or is the radius 290?

  • Roland R. kahlenberg

    December 5, 2013 at 1:10 am

    Thanks for the reply Dan. The diameter is 290.

    Here’s the image of what I’m looking at in my comp.

    I obviously have position for A. I also have angles for AB and AC (I don’t have the position for B and C – as stated originally).

    I now need position coordinates for B and C. Sense make?

    Thanks
    RoRK

    Intensive mocha & AE Training in Singapore and Other Dangerous Locations

    Imagineer Systems (mocha) Certified Instructor
    & Adobe After Effects CS6 ACE/ACI

  • Dan Ebberts

    December 5, 2013 at 1:19 am

    From your image, it looks like C is at 306 degrees, which would give you this for C’s position:

    angle = 306;
    diameter = 290;
    center = [thisComp.width,thisComp.height]/2; // position of A

    a = degreesToRadians(angle);
    r = diameter/2;
    center + r*[Math.cos(a),Math.sin(a)]

    Dan

  • Roland R. kahlenberg

    December 5, 2013 at 2:29 am

    Thanks Dan! And you were right about the diameter/radius thingy. 🙂

    Bestest
    Roland

    Intensive mocha & AE Training in Singapore and Other Dangerous Locations

    Imagineer Systems (mocha) Certified Instructor
    & Adobe After Effects CS6 ACE/ACI

  • Roland R. kahlenberg

    December 5, 2013 at 4:51 am

    AccCKKK!

    Points in the first 2 quadrants; from top right work fine. Points on the other 2 quadrants are not accurate.

    I’m dealing with 3D layers for the points and each of the cross-sections in the image I first posted are on separate Z-positions. Could this be the issue?

    RoRK

    Intensive mocha & AE Training in Singapore and Other Dangerous Locations

    Imagineer Systems (mocha) Certified Instructor
    & Adobe After Effects CS6 ACE/ACI

  • Dan Ebberts

    December 5, 2013 at 5:41 am

    Probably. It depends on what you’re doing with the position values. It might be that you need to include the z coordinate in the position value and then use toComp()to line that up with the camera view.

    Dan

  • Aimee Murray

    October 26, 2018 at 12:30 pm

    7 hours. I’ve been working with a very similar expression and been so confused as to why it won’t work. Then I see your “degreesToRadians” bit of script and the penny drops. Thanks!

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