Once the geometry routine has calculated all the intersections along a line of sight it calls the midfind subroutine which compares the calculated values of the velocity component along the line of sight at each intersection. If there is a velocity reversal between two intersections then that segment is marked for later action.
Once all the intersections have been checked those segments that were marked for action are each dealt
with in turn in order to find the exact position for the velocity reversal. This is done by
splitting each segment in half and calculating the velocity component at the mid point. It then
takes the mid point and whichever end of the segment has a different sign for its velocity
component and finds a new mid point (if the signs change then the changeover must be in that
segment). It repeats this enough times to pin down the location of the switch over and force .
This point is then
inserted into the
array as though it were another intersection (all points occuring after
it in the array are moved up one position so they are not overwritten). This effectively creates
another segment on the line of sight which enables the main program to deal correctly with the velocity
change. This is repeated for all segments on the line of sight that have velocity reversals.
The midfind subroutine also searches for the point on the line of sight closest to the
centre line of the cloud. The reasons for this are given on page , only
the method is explained here. The problem is to find the closest approach of the line given
by
as in equation 4.8 to the line
.
Let the line that joins the
central line
in the cloud to the line of sight in the
plane be
.
The points
and
are the co-ordinates of the intersection
between the two lines and will be different for each
(in most cases). The distance to
the line
for any given point on the line of sight is thus
.
So now
equating coefficients for
and
we get two equations
and
.
Squaring these and adding them
together then gives the distance to the line r=0 (since
). So