Best Fit

The best fit feature uses a least squares algorithm to compute the best fit line or circle for the points selected.  The user can assign a weight to each point that is between 1 and 15,  a point with a weight of 15 acts as if there are 15 of the points at the same location and thus skews the fit closer to that point.  This is done to skew the result in favor of certain points.  A weight of 0 means do not adjust this point or give it “infinite” weight.
 
When you choose Best Fit from the CGCogo menu you will see the following prompt:
Enter the type of best fit problem [Line/Arc/Tan-arc-tan] <L>:
Best Fit Line:
Press <Enter> for Line to calculate the best fit line through a series of points.   In the example in the figure below, 2075 is an Iron Pin Found that we do not want adjusted, so the weight will be set to 0.
Enter a point ID or pick a point symbol on the line: for the example, type or pick 2075
Enter weight for point 2075 <1>: for the example type 0 (zero) and <Enter>
Enter a point ID or pick a point symbol on the line: for the example, type or pick 2076
Enter weight for point 2076 <1>: for the example, type 8 and <Enter>
Continue entering point ID - weight pairs until done then press <Enter> when asked for the next point ID.
The point locations and weights  will be used to compute the best fit line .  
The results, a list of the point IDs entered and their offsets from the best fit line and the bearing of the line, is printed at the command line and written to the print file.
Printed output for the line example
Pt.:                 2075   Wt.:    0   Offset:       0.000 RT
Pt.:                 2076   Wt.:    8   Offset:       5.360 LT
Pt.:                 2077   Wt.:    3   Offset:       3.411 RT
Pt.:                 2078   Wt.:    6   Offset:       1.915 RT
Pt.:                 2079   Wt.:    2   Offset:       6.326 LT
Pt.:                 2079   Wt.:    2   Offset:       6.326 LT
Pt.:                 2080   Wt.:    4   Offset:       1.093 RT
Pt.:                 2081   Wt.:    4   Offset:       0.986 RT
N: 6354.64727  E: 8112.07615  Dir: N 88°30'32"E
N: 6366.14982  E: 8553.96369  Dir: S 88°30'32"W
At the [Edit/Ok/Quit] <0>: prompt:
If you are satisfied with the results, press <Enter> for Ok and the endpoint coordinates will be computed and saved.
For each point saved, the Saving Point dialog (see below) will be shown.


Clicking OK will cause the point to be saved to the coordinate file.

If, on the other hand, you wish to edit the input data, type E and <Enter>. You see the following prompt:
[Add/Change/Delete/eXit]:
Add - add another point to the calculation
Change - change the weight of one of the points
Delete - remove one of the points from the calculation
eXit - when done editing.
If you wish to cancel the command without calculating the line type Q and <Enter>.
Best Fit ARC:
This option allows you to calculate the best fit arc through a series of points.   As with the Line option, each point can be weighted from 0 (no adjustment) to 15.
At the Enter the type of best fit problem prompt, type A and <Enter> to choose the Arc option.
Enter the point ID - weight pairs as in the Line option.
When all the point ID - weight pairs have been entered press <Enter> at the  Enter or Pick a C&G point on the line prompt.
A table of the results similar to that for the Line option will be displayed at the command line.
Output for the example in shown in the figure

Pt.:                 2083   Offset:       2.862 OUT
Pt.:                 2084   Offset:       3.699 IN
Pt.:                 2085   Offset:       3.608 OUT
Pt.:                 2086   Offset:       6.280 IN
Pt.:                 2087   Offset:       5.584 OUT
Pt.:                 2088   Offset:       1.393 IN
N: 6369.30690  E: 8269.70677  RAD: 237.282

The [Edit/Ok/Quit] <O>: prompt and its options for editing the input data are explained in the section on the Line option.

If you are satisfied with the results, press <Enter> for Ok and the PC, PT and radius point of the best fit arc will be saved to the coordinate file using the Saving Point dialog.

Tan-arc-tan:
This option allows you to calculate a combination of the best fit tangent line going into a curve, the best fit arc for the curve itself and the best fit tangent line out of the curve through a series of points defining two tangent lines and an arc.

The two tangent lines are calculated using a least squares solution and then the best fit arc is calculated.  The method used to find the best fit arc is to calculate a radius and radius point for each point on the arc using a function that calculates a curve between tangents through a known point. Each radius and radius point is weighted based on the central angles between the PC, point-on-arc and PT points. The larger the central angles, the higher the resulting weight will be. All the calculated radii and radius points are then averaged. It is not necessary that you locate the actual PC or PT points in the field.

At the prompt
Enter the type of best fit problem [Line/Arc/Tan-arc-tan] <L>:

First you must enter the points on the 1st tangent line. At the series of prompts to:
Enter a point ID or pick a point symbol on 1st tangent:
and
Enter weight for point XXXXX <1>:
enter the point ID - weight pairs for the tangent going into the curve.
When done entering the tangent line points, press <Enter> when asked for the next point.
Next at the series of prompts:
Enter a point ID or pick a point symbol on the arc:
enter the points for the arc.  Weights for these points are calculated by the program.
In the example shown in the figure, there are 2 points defining the first tangent, 3 points defining the arc and 2 points defining the tangent out.
Output for example shown in figure

Pt.:                 2210   Wt.:    0   Offset:       0.000
Pt.:                 2211    Wt.:    5   Offset:       0.000

N: 6512.07291  E: 8572.91824  Dir: N 45°00'00"E

N: 6567.12692  E: 8627.97226  Dir: S 45°00'00"W

Pt.:                 2212   Wt.:    5   Offset:       0.000 LT
Pt.:                 2213   Wt.:    1   Offset:       0.000 LT

N: 6585.04757  E: 8796.89599  Dir: S 45°00'49"E

N: 6505.88861  E: 8876.09255  Dir: N 45°00'49"W

Pt.:                 2214   Offset:       1.736 OUT
Pt.:                 2215   Offset:       3.232 IN
Pt.:                 2216   Offset:       2.324 OUT

N: 6492.00101  E: 8721.39653  RAD: 119.183

The [Edit/Ok/Quit] <O>: prompt following the output is explained in the Line option.
If you are satisfied with the results press <Enter> for Ok.
The coordinates for the endpoints of the tangents and PC, PT and radius point of the curve are computed and saved to the coordinate file using the Saving Point dialog.

Prompts

Enter the type of best fit problem [Line/Arc/Tan-arc-tan] <L>: Type "L" and Enter or just Enter for a best fit line, "A" and Enter for a best fit arc or "T" and Enter for the best fit of a curve with two straight tangents in and out.

For a best fit line or arc:
Enter or Pick a C&G point on the line (or Arc): Type a point ID or pick a point symbol on the screen.  Repeats until all points are entered and the user presses Enter at this prompt.
Enter weight for point <####> <1>:  Enter a number between 0 and 15 (0 = infinite weight).

For best fit tan-arc-tan:
Enter a point ID or pick a point symbol on 1st tangent: Enter or pick as many points and weights as desired for the first tangent line.
Enter a point ID or pick a point symbol on the arc: Enter of pick as many points as desired for the arc (weights are determined by the program).
Enter a point ID or pick a point symbol on 2nd tangent: Enter or pick as many points and weights as desired for the second tangent line.

[Edit/Ok/Quit] <0>: Type "E" and Enter if you wish to change the weight of a point or add or delete points. Type "O" and Enter or just Enter to calculate the best fit line, arc or line-arc-line and store its defining points in the coordinate file.  Type "Q" and Enter to quit without calculating the best fit points.
[Add/Change/Delete/eXit]: if you choose Edit then this prompt allows you to Add a point, Change a weight, or Delete a point.  When done editing press "X" and Enter to return to the Edit/Ok/Quit prompt.

Pulldown Menu Location: CG-Survey > Cogo
Keyboard Command: cg_bfit
Prerequiste:  Coordinate file.