Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Calculating the intersection(s) of two circles / handling multiple solutions…

  • Calculating the intersection(s) of two circles / handling multiple solutions…

    Posted by Chad Zichterman on March 19, 2015 at 11:04 pm

    I’m trying to build a way to handle fixed-distance joints without buying Newton 2 (I’ll get it eventually, but I’m broke at the moment).

    My approach involves finding shared solutions to circular equations:

    Assume two center points, A and B, defining circles by their respective radii. A and B each have their anchor points at the very tip of a straight-line object, hence the circle around each represents all the possible points the other end of that line (segment) could be.

    I have placed a null at the tip of each segment (opposite the anchor, let’s call them C and D), and suspended a beam between those two tips (of objects A and B, resulting in segments AC and BD) as a rough approximation of where the driven point would be.

    My goal is to create a fixed-distance joint, parented to the null at the tip of B(Point D) (the rotation of B is the driver), such that when B is rotated, the other null (Point C, at the tip of A) is adjusted (through calculation) to move, but stay constrained to the circle defined by the radius of A.

    This, effectively, means calculating the intersection(s) of two circles, centered on A and D, respectively. Point D is automatically taken care of by the driver (B’s Rotation, which moves the null at D), but C –the tip of object A I’m trying to keep both on a circular track AND a fixed distance from D– must be calculated.

    The basic contingencies I have anticipated already are:

    *If the distance between the anchors of A and B is greater than the sum of the radii for A and B (AC+BD), there is no intersection;
    *If the distance between A and B is equal to the sum of the radii for A and B, there is one intersection;
    *If the distance between A and B is less than the sum of the radii for A and B, there are two solutions.

    If zero solutions, I’d just leave the position of C alone (this is basically an irrelevant case, as I wouldn’t be building a fixed-distance joint).

    I’m looking for an efficient way to build an expression capable of handling the two latter cases (one or two solutions), and disambiguating the two-solution case so that I end up with just one x,y for the null for Point C.

    Chad Zichterman replied 11 years, 5 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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