<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.cloudcompare.org/doc/wiki/index.php?action=history&amp;feed=atom&amp;title=Distances_Computation</id>
	<title>Distances Computation - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.cloudcompare.org/doc/wiki/index.php?action=history&amp;feed=atom&amp;title=Distances_Computation"/>
	<link rel="alternate" type="text/html" href="https://www.cloudcompare.org/doc/wiki/index.php?title=Distances_Computation&amp;action=history"/>
	<updated>2026-04-30T01:23:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://www.cloudcompare.org/doc/wiki/index.php?title=Distances_Computation&amp;diff=47287&amp;oldid=prev</id>
		<title>Daniel at 09:39, 11 November 2021</title>
		<link rel="alternate" type="text/html" href="https://www.cloudcompare.org/doc/wiki/index.php?title=Distances_Computation&amp;diff=47287&amp;oldid=prev"/>
		<updated>2021-11-11T09:39:53Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:39, 11 November 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l8&quot;&gt;Line 8:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 8:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Cloud-cloud distances =&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Cloud-cloud distances =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Simple approach ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Cloud-cloud distances can be computed by selecting two point clouds and then clicking on the [[Image:CloudCloudDistanceIcon.png]] icon.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Cloud-cloud distances can be computed by selecting two point clouds and then clicking on the [[Image:CloudCloudDistanceIcon.png]] icon.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l50&quot;&gt;Line 50:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 52:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;CloudCompare can split the computed distances along the 3 main dimensions (X, Y and Z). If the &amp;#039;&amp;#039;split X, Y and Z components&amp;#039;&amp;#039; checkbox is checked, CloudCompare will generate 3 more scalar fields, on for each axis.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;CloudCompare can split the computed distances along the 3 main dimensions (X, Y and Z). If the &amp;#039;&amp;#039;split X, Y and Z components&amp;#039;&amp;#039; checkbox is checked, CloudCompare will generate 3 more scalar fields, on for each axis.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Better C2C distances ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;To compute more robust and signed C2C distances, consider using the [[M3C2 (plugin) | M3C2]] plugin.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Cloud-mesh distances =&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Cloud-mesh distances =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Daniel</name></author>
	</entry>
	<entry>
		<id>https://www.cloudcompare.org/doc/wiki/index.php?title=Distances_Computation&amp;diff=46621&amp;oldid=prev</id>
		<title>Daniel at 20:18, 17 February 2015</title>
		<link rel="alternate" type="text/html" href="https://www.cloudcompare.org/doc/wiki/index.php?title=Distances_Computation&amp;diff=46621&amp;oldid=prev"/>
		<updated>2015-02-17T20:18:52Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This section describes what kind of distances can be computed with CloudCompare and how these distances are computed.&lt;br /&gt;
&lt;br /&gt;
There&amp;#039;s mainly two kinds of distances described below:&lt;br /&gt;
* either the distances between two point clouds (&amp;#039;&amp;#039;cloud-cloud distances&amp;#039;&amp;#039;)&lt;br /&gt;
* or the distances between a point cloud and a mesh (&amp;#039;&amp;#039;cloud-mesh distances&amp;#039;&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
The third kind of distances that would naturally come to mind - the &amp;#039;mesh-mesh&amp;#039; distance - will be treated by CloudCompare as a &amp;#039;cloud-mesh&amp;#039; distance: one can either choose to use only the compared mesh vertices for computing distances (if they are regularly and densely sampled on the surface) or alternatively to sample points on the compared mesh surface. More information can be found in the [[How_to_compare_two_3D_models | How to compare two 3D models]] tutorial.&lt;br /&gt;
&lt;br /&gt;
= Cloud-cloud distances =&lt;br /&gt;
&lt;br /&gt;
Cloud-cloud distances can be computed by selecting two point clouds and then clicking on the [[Image:CloudCloudDistanceIcon.png]] icon.&lt;br /&gt;
&lt;br /&gt;
See the [[Cloud-to-Cloud Distance]] computation tool page for more information.&lt;br /&gt;
&lt;br /&gt;
The default way to compute distances between two point cloud is the &amp;#039;nearest neighbor distance&amp;#039;: for each point of the compared cloud, CloudCompare searches the nearest point in the reference cloud and computes their (euclidean) distance. This corresponds to the (default) case where local model is set to &amp;#039;NONE&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
[[Image:NNDistancePrinciple.jpg | center]]&lt;br /&gt;
&lt;br /&gt;
== Local modeling ==&lt;br /&gt;
&lt;br /&gt;
If the &amp;#039;&amp;#039;&amp;#039;reference&amp;#039;&amp;#039;&amp;#039; point cloud is dense enough, approximating the distance from the compared cloud to the underlying surface represented by the reference cloud is acceptable. But if the reference cloud is not dense enough, the nearest neighbor distance is sometimes not precise enough. Therefore, it can be necessary to get a better model of the surface. Of course, if one can obtain a global model of the surface easily, it&amp;#039;s much simpler and potentially more accurate to compute directly the distance from the compared cloud to this model (see the &amp;#039;Cloud-mesh distances&amp;#039; section below). But it&amp;#039;s generally not so easy to get a clean and proper global model. Therefore, CloudCompare provides an intermediate way to get a better approximation of the true distance to the reference surface. Not as precise as a true global model, but much easier to compute.&lt;br /&gt;
&lt;br /&gt;
[[Image:CloudCloudDistLocalModelParams.png | center]]&lt;br /&gt;
&lt;br /&gt;
When CloudCompare has determined the nearest point in the reference cloud, the idea is to locally model the reference cloud (underlying) surface by fitting a mathematical model on the &amp;#039;nearest&amp;#039; point and several of its neighbors. The distance from each point of the compared cloud to its nearest point in the reference cloud is replaced by the distance to this model. This is statistically more precise and less dependent on the cloud sampling (it can locally produce &amp;#039;&amp;#039;strange&amp;#039;&amp;#039; results - as the modelling phase is very limited - but it gives much better results on a global scale). &lt;br /&gt;
&lt;br /&gt;
[[image:NNLocalModelPrinciple.jpg|center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the latest version of CloudCompare, the user can fully setup the way the job is done by choosing:&lt;br /&gt;
* the mathematical model: either the least square best fitting plane, or a 2D1/2 Delaunay triangulation, or a quadratic &amp;#039;&amp;#039;height&amp;#039;&amp;#039; function (the latter being the more precise but also the longer to compute)&lt;br /&gt;
* the way the neighbors are extracted around each &amp;#039;nearest&amp;#039; point in the reference cloud (either by setting a fixed number of neighbors, or by providing the radius of a spherical neighborhood)&lt;br /&gt;
* and eventually one can choose to apply an approximation of this scheme by sharing the same local model with several points of the reference cloud instead of computing a new model for each. The process is much faster this way (especially for big neighborhoods) but also much noisier.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[image:NNLocalModelResult.jpg|center]]&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;Result without (left) and with local modeling (right). Note that the maximum distance doesn&amp;#039;t change while the lower part of the histogram is clearly shifted towards zero.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== General considerations ==&lt;br /&gt;
&lt;br /&gt;
When comparing two points clouds directly (especially without model), here are a few &amp;#039;guidelines&amp;#039;:&lt;br /&gt;
* make sure that the reference cloud extents are wider than the compared cloud ones (to avoid virtually high distances on the boundaries). More generally, try to make sure that the reference cloud always overlaps the compared one (that&amp;#039;s also true for cloud-mesh distances).&lt;br /&gt;
* always try to get the highest possible density for the reference cloud (as it will directly change the results accuracy)&lt;br /&gt;
* if the reference cloud is very noisy, consider using the least square best fitting plane model (which is more robust to noise). On the contrary, if the reference cloud is clean but with high curvature, consider using the quadratic height function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other options ==&lt;br /&gt;
&lt;br /&gt;
CloudCompare can split the computed distances along the 3 main dimensions (X, Y and Z). If the &amp;#039;&amp;#039;split X, Y and Z components&amp;#039;&amp;#039; checkbox is checked, CloudCompare will generate 3 more scalar fields, on for each axis.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Cloud-mesh distances =&lt;br /&gt;
&lt;br /&gt;
Cloud-mesh distances can be computed by selecting one point cloud and one mesh and then clicking on the [[Image:CloudMeshDistanceIcon.png]] icon.&lt;br /&gt;
&lt;br /&gt;
See the [[Cloud-to-Mesh Distance]] computation tool page for more information.&lt;br /&gt;
&lt;br /&gt;
[[image:CMDistanceExample.jpg|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this mode, for each point of the compared cloud CloudCompare will simply search the nearest triangle in the reference mesh. As meshes generally provide (indirectly) a &amp;#039;&amp;#039;side&amp;#039;&amp;#039; information (one can determine what is inside and outside of the mesh by looking at the normal of the triangle), cloud-mesh distances can be signed (this is the default behavior).&lt;br /&gt;
&lt;br /&gt;
The user can choose to either ignore the normal information (by unchecking the &amp;#039;signed distances&amp;#039; checkbox) or to invert it (&amp;#039;flip normals&amp;#039; checkbox).&lt;/div&gt;</summary>
		<author><name>Daniel</name></author>
	</entry>
</feed>