olivierdalang / VectorBender

VectorBender is a QGis plugin
GNU General Public License v3.0
37 stars 15 forks source link

Affine Transformation #9

Closed francescomarucci closed 4 years ago

francescomarucci commented 7 years ago

I added an affine transformation but then I saw that already exists a class calles AffineTransformer. than, I addedd AffineTransformerFRA class and I called instead of the bender tranformer in case of the pairs are more than two.

olivierdalang commented 7 years ago

Thanks a lot for the PR. Indeed, looking again at the code, there is already an affine transformer. I had forgotten about it, is it not available in the released version ?

I didn't test your changes yet, but looking at the code, it looks like you completely removed the ability to use bending transformations (which is the main purpose of the plugin). Is that so ?

I understand the interest of being able to compute affine transformations with more than 3 points, but this can't be done at the price of removing irregular transformations. I think some more changes are needed, including in the UI (the user would have to be able to choose between overdeterminated affine transform or irregular transform if there are more than 3 points).

francescomarucci commented 7 years ago

dear Olivier, you are totally rigth, I completely removed the bender transformation, but only because I don't understand it.

in the BenderTransformer class I see: def map(self, p):

    triangle = self.trifinder( p[0], p[1] )

    if triangle==-1:
        # No triangle found : don't change the point
        return QgsPoint(p[0], p[1])
    else:
        # Triangle found : adapt it from the old mesh to the new mesh
        a1 = self.pointsA[self.delaunay.triangles[triangle][0]]
        a2 = self.pointsA[self.delaunay.triangles[triangle][1]]
        a3 = self.pointsA[self.delaunay.triangles[triangle][2]]

        b1 = self.pointsB[self.delaunay.triangles[triangle][0]]
        b2 = self.pointsB[self.delaunay.triangles[triangle][1]]
        b3 = self.pointsB[self.delaunay.triangles[triangle][2]]

        mappedP = self.mapPointFromTriangleAtoTriangleB(p, a1, a2, a3,

b1, b2, b3)

        return mappedP

and in my case this "if triangle==-1" produces a polygon with a shape completely different from the original, some vertex is transformed some not, and for me this is not acceptable and very hard to explain to the users.

also for me is very important to provide a tool for georeference a vector layer where the user can also did not know wich algoritm is used, and he can reproduce the same transformation for different layers in different period (tipycally when the CAD file is updated).

just my2cents.

do you think that we can ask this question to the qGis plugin tester (Paolo Cavallini)? if it is better to have a complete plugin (leaving so the choice to the user) or to do a different plugin (as I have done).

thanks a lot.

regards, francesco

2017-05-31 17:03 GMT+02:00 olivierdalang notifications@github.com:

Thanks a lot for the PR. Indeed, looking again at the code, there is already an affine transformer. I had forgotten about it, is it not available in the released version ?

I didn't test your changes yet, but looking at the code, it looks like you completely removed the ability to use bending transformations (which is the main purpose of the plugin). Is that so ?

I understand the interest of being able to compute affine transformations with more than 3 points, but this can't be done at the price of removing irregular transformations. I think some more changes are needed, including in the UI (the user would have to be able to choose between overdeterminated affine transform or irregular transform if there are more than 3 points).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/olivierdalang/VectorBender/pull/9#issuecomment-305215458, or mute the thread https://github.com/notifications/unsubscribe-auth/ABf6F2tyUO7QlRaBF0gQdYMFcnckM2LCks5r_YFbgaJpZM4NgqpL .

ThePromenader commented 7 years ago

If I can add a note on this here: Perhaps Francesco didn't notice the 'affine' transformation (as I didn't) because it didn't make it to the Qgis repository; the version there doesn't have the AffineTransformer function.

francescomarucci commented 7 years ago

Yes, it is correct: I did not notice the affine transformation because in the plugin i installed from the qgis repository it was not present. for that reason I worked on it and I added that function in the plugin, beacuse for me the bender transformation is not working correctly.

in the attached image you can see what I have to do: georeferencing a polygon layer from not real world (cad drawing) coordinates system (first screenshot) to real world coordinates system (second screenshot), the result I obtained with the affine transformation. in the other hand, the two screenshots on the rigth of the image shows what I obtained with the bender tranformation: some polygon vertices is stretched, others not, changing the shapes of the polygons.[image: Immagine incorporata 1]

regards, francesco

transformations

2017-05-31 19:14 GMT+02:00 ThePromenader notifications@github.com:

If I can add a note on this here: Perhaps Francesco didn't notice the 'affine' transformation (as I didn't) because it didn't make it to the Qgis repository; the version there doesn't have the AffineTransformer function.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/olivierdalang/VectorBender/pull/9#issuecomment-305255304, or mute the thread https://github.com/notifications/unsubscribe-auth/ABf6F238raWvPkQuUdIrhLa0S_r7z3tbks5r_Z_-gaJpZM4NgqpL .