# Free Planes - Polygon Point Fitting

The Polygon Point Fitting feature allows you to easily work with unreliable or not 100% accurate data (with e.g. rounding errors).

It works by finding best fitted plane, i.e. the plane which is as close as possible to a (sub)set of entered points in 3D-space.

The algorithm works in multiple steps.

Calculate the fitted plane

Only points for which the

`Fit`

property is enabled (checkbox in second column from left is checked / green) are checked and the best plane (in the least-squares normal distance sense) is fitted to them.This allows to work with unreliable or not 100% accurate data, because the algorithm finds the best approximation to the data.

Project the points onto the fitted plane

A plane is flat as the name says. In the first step the best plane approximation to the selected fitting points was calculated. In order to work with the points, they need to form a plane.

Thus they must now projected be onto the fitted plane. This works by drawing a straight line, which is perpendicular to the fitted plane, through the point and the fitted plane. The intersection between this line and the surface is the projected point

Further internal calculations

In order for the obtained plane and projected points to be usable, more internal calculations (e.g. rotation matrices) and checks (e.g. for self-intersecting polygons follow)

Note

Points which do not have the `Fit`

property enabled (checkbox in the second column from left is unchecked / grey) **do not** contribute to the fitted plane.
That means they are ignored in the first step, but are projected in the second step. Please see next section
for tips and tricks

**Working with the Polygon Point Fitting**

Tip

Be aware the points, which do not have the `Fit`

property enabled **do not** contribute to the fitted plane.

Enable the `Fit`

property for points with relatively high precision / confidence! Do this by clicking the checkbox (it should then be solid green).

This way, the plane is fitted to the “good” points, and the “bad” points are only projected onto the plane. This means that “bad” points do not pull the fitted plane away from its most probable location.

Note

Be aware that the polygon is built from the projected points, not the original points.

In case you get any unexpected warnings or errors, please check whether the projected points make sense, as they determine the polygon and not the original points.

When editing a polygon, a variety of additional information is plotted (original points, fitted points, arrows, etc…) which help you identify the issue.

Tip

Make use of the colours and additional information in edit mode!

The colours were chosen so that they intuitively provide consistent and helpful information. Point Colours:

White: Fitted points

Green: “Good” original points (i.e. close to the fitted surface / original point and its projected counterpart are close together)

Red: “Bad” original (i.e. more than 25cm away from the fitted surface / original point and its projected counterpart are more than 25cm away from each other)

Arrow Colours:

White: Arrows that indicate the order of points and the shape of the (intended) polygon

Yellow: Arrows between the original points and their projected counterparts

Additionally, Labels attached to the points allow you to quickly identify points

Tip

Understand what *least-squares normal distance sense* means and what the *best fitted plane* is:

The algorithm which calculates the *best fitted plane* from a set of points tries to minimize sum of the squared distances between the fitted plane
and the set of points.

The distances between the fitted plane and each point are taken in perpendicular direction to the plane, squared and then summed.
The plane with the lowest sum is the *best fitted plane*.

Fortunately, our algorithm does not need to try planes and select the best one (which would be time consuming and inaccurate), but rather immediately calculates the best plane using sophisticated mathematical techniques.

Warning

Even if technically possible, calculated projected points are currently not being showed in edit mode if specific warnings or errors occured This will soon be fixed in a future version

Warning

Warnings and Errors are currently not entirely consistent. It may happen that no meaningful polygon can be formed, even if just a warning occurs. This will soon be fixed in a future version.

Warnings will then indicate that a polygon could be formed, but attention is advised.

Errors will then indicate that no meaningful polygon could be found.

**Possible Point Fitting Warnings**

Warning:

`Point is far away from fitted surface`

This warning is shown for specific points. It is generated when the respective point is more than 25cm away from the fitted surface. Generally this indicates that your entered data points are comparatively far away from a flat plane.

If you believe the results are correct, you can carry on.

Warning:

`At least one point is far away`

Generated as a summary warning if at least one point fulfills the condition as described above

Warning:

`Polygon contains duplicate points`

The points must form a closed, non-self-intersecting polygon and therefore no duplicates can exist. Please remove the duplicated point.

Warning:

`Polygon is self-intersecting`

The shape drawn must not intersect itself. This is ‘blocked’ in System Optimiser to prevent rendering errors. Additionally, self-interesecting polygons are seldom intended and usually exist due to accidently swapped points.

Error:

`The points are too close together`

When all points are very close together, it is not possibly to find a meaningful fitted plane as this fitted plane is very sensitive to changes in the input coordinates. Additionally, all points being close together is most probably an error in entering the data or even if correct, would give a surface that is too small to make sense.

Error:

`All points lie (approximately) on a line!`

When all points approximately lie on a straight line, it is not possible to draw a surface through them.

Error:

`Internal error: ...`

…This shouldn’t happen! Please contact the System Optimiser team.