image

Link That Slides on Curve

I am attempting to make a link slide on a curve. When I started writing the code to handle this, I thought that maybe there is a better way. There must be a way to write the simulation code so that there are no special cases. Some way to take the two things that define the location of a link and just magically find the location of the link.

Here’s why I think there must be a better way:

I will find the center point of the sliding connector arc. This must be the same for both sliding connectors.
I determine that connector B is the one being used for positioning and create a circle with the same center as the slider arc and a radius from that center to connector B. This represents all possible locations of B.
Now I make a circle around G with a radius that is the length of link 5.
Where the two circles meet are the only valid locations of B during the step of the simulation. If G moves, which it does, then B will move.
After that, I just take the old and new locations of B and use the angle difference around the arc center point to rotate link 1 into the proper position.

So that’s why there should be a better way. Each different configuration of links and connectors requires some special case code. In this case, there is a circle derived from D and E but if they were not on curved paths, there would be a line derived from them.

The code is not hard to write at all. It very simple. It’s the code that calls this code that is painful to write. The detection of each special case is confusing after there are a lot of special cases.

The interesting thing is that sliding connectors have all of these special cases but rotating connectors work the same all the time and there is only one case to handle.

Mega-Links

image

Mega-Link Configuration

I also need to consider simulating links that are connected to each other with multiple connections. This configuration shown above should work but it doesn’t. The reason that it should work is that links 1 and 2 are really acting as a single link in this case since their connection to each other cannot pivot. This is another interesting dilemma where there should be some simple way to handle this and I just cannot figure it out. The complex way is easy to code but it yet another special case of some sort.

Then again, this program is for designing mechanism movement, not mechanism looks. A single link will work just fine for this even though it will not have that nice bend in it.

image

Not Bothering With Mega-Link