Vertical distance

Feel free to ask any question here
Post Reply
hammad008
Posts: 3
Joined: Mon Nov 07, 2011 6:51 pm

Vertical distance

Post by hammad008 »

Hello,

I am a grad student here at the Western Michigan University and I am using CloudCompare for my research.

I am trying to find out the underclearance of the bridge but there are two questions I would like to ask.

1. I have managed to fit a plane and calculate the distance from the girder to the plane using the ccComparisonDlg classes (which uses the hausdroffdistance I believe) to calculate the distance between the plane and the cloud. Can you please tell me if it is a completely vertical distance.

2. When the distance is calculated the scalar fields are on the cloud but the desirable result required is to make it appear over the plane, any suggestions how could I do it ?

Looking forward to your reply.

Thanks in advance.
Hammad
daniel
Site Admin
Posts: 7332
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Vertical distance

Post by daniel »

Hi

1. Haussdorff distance as computed by CloudCompare is simply the distance from each point to its nearest point/triangle in the other entity.So in the general case, it is absolutely not a vertical distance, but in your case it could be equivalent to a vertical distance if and only if the plane is the least-square best fitting plane.
2. CloudCompare can't do this right now (i.e. projecting scalar values onto another entity). At most you could flatten your cloud (by saving it into ASCII format, then loading it again and ignoring the Z component). Then you could triangulate the resulting 2D cloud to get a flat mesh with the right scalar field (but it may not be so nice)

Otherwise, here is a trick that may do what you want (but it depends on your input cloud):
[*]There's a special tool for vertically projecting a cloud ('Tools > Projection > Heigh grid generation). This tool 'rasterizes' the cloud by projecting it into a planar grid (int the XY plane). All the points that fall in a cell are then replaced by a single value (you have the choice: either the elevation of the highest point, the average elevation or the elevation of the lowest). On output you can get a (2D) cloud with the selected values as scalar field, and/or a colored image (tiff) and/or an ASCII grid file.
[*]There's another feature in the last release version that should help: when calling "Tool > Other > Plane orientation", you get a matrix in the console that can then be applied to the cloud (with Edit > Apply transformation) in order to make the best fitting plane parallel to the XY plane.

So if you want to compare your cloud to its best fitting plane, you can make that plane coincide with the (XY) plane, in which case the distance to that plane is equal to the points height (+ a constant). Moreover, you'll get the result as an image or a regular gid. And if your problem doesn't exactly fit to the above workflow --> it shouldn't be too hard to modify the code to make this work?
Daniel, CloudCompare admin
hammad008
Posts: 3
Joined: Mon Nov 07, 2011 6:51 pm

Re: Vertical distance

Post by hammad008 »

Hello,

Thank you so much for your help.

I have managed to accomplish what I was intending to do.

I had been reading the forum and came to know that the CLOUDCLOUD_DIST fits the local plane to get the distances using the nearest neighbor approach. I am assuming in my case this would result in the vertical distances only ?

I have attached a screen shots of my processed data, if you look at it, there are two point clouds (one for the bridge girders and the second one for the sub structure).
Screenshot attached
Screenshot attached
Screenshot.png (131.23 KiB) Viewed 6462 times
For the sub structure on the sides you can see that distances are more (scalar fields greens and red) as when compared to the cloud directly below the sub structure, so is this calculating the shortest distance ?

Also, I was wondering if you could tell me which hidden parameter controls the boundary of the nearest neighbor ?

Again thanks in advance for your help.

Hammad
daniel
Site Admin
Posts: 7332
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Vertical distance

Post by daniel »

The Cloud/Cloud distance with a local (plane) model takes a very small amount of neighbors in order to be fast. I believe it's 6 for the moment but it may even be less. But we should definitely add a parameter in the GUI as this is rather sensitive. However this approach is very sensible to noise and its interest is only to reduce sampling influence on the global result (locally the results can be quite strange sometimes as the nearest neighbors can be far or very noisy).
Daniel, CloudCompare admin
hammad008
Posts: 3
Joined: Mon Nov 07, 2011 6:51 pm

Re: Vertical distance

Post by hammad008 »

Ok, I see what you mean.

Is there a way we could make these local plane results only report vertical distance (z-axis results). Also, I had been trying to put ccTimer in the DistanceComputationTools.cpp to get the timings out of it, but it didn't display the output on the ccConsole, can you please tell me as to why this is happening (I included the header files and made sure the code is working properly).

Looking forward to your reply.

Thanks
Hammad
daniel
Site Admin
Posts: 7332
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Vertical distance

Post by daniel »

You don't have access to the Console "inside" the CClib library. If i'm not mistaken, ccTimer is a qCC_db class so you shouldn't use it in CCLib either.
You can only use them in the qCC project (MainWindow.cpp or the dialogs). For debug purpose you should use the system console (printf or std::cout) or a log file.

Otherwise, we could display/output distances as 3 separate scalar fields (one per axis). This has already been asked by geologists by the way. We need to modify the HausdorffDistance computation methods. The CClib generic interfaces don't allow handling 3 separate
Scalr fields at the same time yet however.
Daniel, CloudCompare admin
dandan
Posts: 2
Joined: Fri May 18, 2018 9:00 pm

Re: Vertical distance

Post by dandan »

Hi Daniel, I'm one of the geologists you mentioned wanting vertical cloud-to-plane distance measurements :) Can you please tell me whether you have added any way to do this since this question was originally posted? I am trying to detrend elevation data to calculate the vertical component of the roughness parameter and haven't been able to find any good approaches. Thank you!
daniel
Site Admin
Posts: 7332
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Vertical distance

Post by daniel »

There are now two options to compute vertical distances between clouds:
- use the M3C2 plugin (with purely 'VERTICAL' normals)
- use the 2.5D Volume computation tool (you can output the rasterized cloud with the 'height difference' scalar field

If you have meshes, you'll need first to convert them to (dense) clouds fist (with 'Edit > Mesh > Sample points').
Daniel, CloudCompare admin
Post Reply