Global Shift and Scale

From CloudCompareWiki
Jump to navigation Jump to search


Introduction

When loading (or generating) an entity with very big coordinates (typically greater than 105), CloudCompare will warn the user about this and suggest to shift (or rescale) the entity in order to work in a local coordinate system with smaller coordinates:

CloudCompare will suggest the user to shift the cloud if its original coordinates are too big

It is strongly advised to shift/scale the entities in this case.

But why?

This is due to the fact that both CloudCompare and OpenGL works with 32 bits float values. This allows an increase of speed and a 50% memory gain compared to 64 bits values.

However the 32 bits representation has a limited resolution (accuracy). Without entering into too much details here, we can say that the bigger the number is, the less decimals can be stored. As a rule of thumb the 'relative' precision (i.e. the smallest quantity that can be represented relatively to the maximal value) is roughly between 10-7 and 10-8.

This is generally more than sufficient for real life point clouds expressed in the scanner coordinate system (e.g. for a 100 meters range scan, the data representation precision will be around 10-5 or 10-6 m = 1 to 10 microns).

However if the cloud is expressed in a geo-referenced coordinate system, the point coordinates can be very big (typically about 106). In this case the data representation precision rises up to 1 or 10 cm!

This is why it is very important to 'shift' the points when loading the file in CloudCompare. Otherwise the original precision will be lost.

CloudCompare stores the shift and scale values as meta-data and (tries to) keep them all along the entity life. Eventually, when the user saves the entity CloudCompare will restore the original coordinate system (if the output file format allows for 64 bits values storage).

Mathematics

The global shift and global scale encode the transformation between the original (global) coordinate system of the entity and the working local) coordinate system.

Let T(x,y,z) be the global shift (translation), S be the global scale, and P a 3D point, then:

Plocal = (Pglobal + T) * S

or equivalently:

Pglobal = Plocal / S - T

Properties

The shift and scale values are displayed in the entity properties (if the entity support this):

Cc properties shift scale.jpg

Edition

At any time the user can edit the shift and scale values associated to a given entity. See the 'Edit > Edit global shift and scale' tool.

Activation parameters

Since version 2.7, the user can choose the limit above which the Global Shift & Scale mechanism will be triggered. See the 'File > Global Shift settings' dialog:

Cc global shift and scale limits.jpg

These parameters are persistant. And they will be used for both the standard version and the command line version.

Bookmarks

By default CloudCompare tries to guess the best shift vector automatically (typically when loading a file, CloudCompare will use the very first point coordinates as shift quantity). But the user is free to input the shift and scale values (especially if one works with several clouds and want to work in a particular local coordinate system).

Once a first shift/scale has been used, CloudCompare will:

  • use it for the next clouds if it works for them as well
  • let the user recall it whatever the case thanks to the drop down menu in the middle (just above the 'Shift' fields - see the Last input entry)

However this information will only be stored during the active session of CloudCompare (it will be lost once you close the program). In order to keep the information persistent, you can edit the global_shift_list_template.txt file next to CloudCompare's executable and follow the instructions inside. This is a good way to store persistent shift/scale information sets (kind of "bookmarks").