How to insert a joint in a chain

Let’s say we need to insert a new joint in between two joints. But The new joint has to be perfectly aligned with the existing ones (meaning in a straight line). Here are two methods to do this:

1) First method:

Assuming the joints are correctly oriented, we can:

2) Second method:

In case the joints are NOT correctly oriented: