0

I am playing with the square_border_parameterizer.cpp example from CGAL-4.14. I would like to not only choose the four corners but also to decide which is which. That is, I would like to specify, which corner will be assigned the parameter pair (0,0), which will become (0,1), which will become (1,0) and which will become (1,1). Is it possible?

I tried the Nefertiti example delivered with CGAL with several permutations of the selected corners.

corners1.selection.txt:

133 8 0 287

corners2.selection.txt:

8 0 287 133

corners 3.selection.txt:

287 0 8 133

However, result.off seems quite the same in all three cases when open in Meshlab.

I also had a look at the source code but I couldn't conclude yet how to achieve my goal. And as far as I can tell, the documentation only mentions that one can choose the four corners.

Dominik Mokriš
  • 1,118
  • 1
  • 8
  • 29

1 Answers1

1

What you should tweak is the boundary halfedge taken in argument by the parameterizer.

Internally (in particular, in the function compute_offsets() of Square_border_parameterizer), the corners are attributed their geometric uv position by walking the border, starting from the halfedge bhd that you have passed in input: the first corner met will be at uv(0,0), etc.

Thus, if you want to modify which vertex is at (0,0) and looking at the squared_border_example.cpp that you were playing with, you can simply add:

  while(source(bhd, sm) != vda[i])
    bhd = next(bhd, sm); // walk the border

before the call to SMP::paramterize() with i=0,...,3, and you will obtain any rotation of the parameterized space you might want.

Mael
  • 530
  • 3
  • 8
  • I followed your advice. From a few experiments it seems that `vda[0]` is then assigned the parameter value (0,0). However, the parameter values of the remaining points seem independent of their order; I suppose that they are determined from the orientation of the half-edges around `vda[0]`. Which is sufficient for my application. (-; – Dominik Mokriš Jun 11 '19 at 19:22
  • Since the input is supposed to be a topological disk, the vertices in the UV domain and on the input must appear in the same order, so, as you say, the other positions will be determined by walking the border. – Mael Jun 12 '19 at 05:54