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.
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.