Page 1 of 1

Quadric curve fitting Root mean square

Posted: Mon May 17, 2021 9:45 am
by visalprabhakaran
Hi Daniel
I am a researcher trying to do Machine learning with the help of your amazing software.I am using your Geometric feature extraction feature to extract the gaussain curvature and Mean curvature for further machine learning.To further improve my understanding ,I wish to know how you use root mean square method to fit a curve on quadric surfaces z = a + b.x + c.y + d.x2 + e.xy + f.y2. Do you have any documentation that you reffered for that?
Can you share it here? Thank you in advance

Re: Quadric curve fitting Root mean square

Posted: Mon May 17, 2021 10:27 am
by daniel
Hi,

For reference, the code can be seen here: https://github.com/CloudCompare/CCCoreL ... d.cpp#L300

If I remember well, we minimize the (squared) error between the 'height' of the points (z) with respect to the height of the quadric surface at the same (x, y) position. It's a least squared approach. And to be more precise we use the Conjugate Gradient method to solve an 'tA.A.x=tA.b' equation (where tA is the transposed version of A).

Re: Quadric curve fitting Root mean square

Posted: Mon May 17, 2021 1:31 pm
by visalprabhakaran
Thank you for the explanation.Sorry,I understood the explanation partially.I went to through the concept of Conjugate Gradient method.
I didnt understand What is A ?Is it the coordinates (X,Y) and what is b ?Is it the Z co ordinate?
I suppose x is the coefficients of a,b,c,d,e,and f of z = a + b.x + c.y + d.x2 + e.xy + f.y2.Am I right ?
Also in the documentation it was refered you used root mean square fitting to to determine the coefficients of the quadric equation.Why is written like that in the documentation ?

Re: Quadric curve fitting Root mean square

Posted: Mon May 17, 2021 2:10 pm
by daniel
Well, it's more a 'trick' on how to represent this equation and the equality 'z = a + b.x + c.y + d.x2 + e.xy + f.y2' for all points as linear matrices.

A has 6 columns and as many rows as points in the cloud (let say N). On each row, you have: '1 x y x2 xy y2' (for each point).

Then the X matrix is the coefficients of the quadric (what we are looking for). So a simple vector of 6 values: 'a b c d e f'.

And you look for the X vector that minimises 'AX=b', where b is the 'z' coordinates of each point (a vector of N values).

But to actually solve the system, it's better / more efficient to have a square matrix, hence solving 'tA.A.X=tA.b' (where tA.A is square and only 6x6).