From: Paul K. <pki...@us...> - 2003-12-18 01:07:49
|
On Dec 17, 2003, at 7:00 PM, Rafael Laboissiere wrote: > * Pedro Tarrafeta <pt...@te...> [2003-12-17 14:52]: > >> - Output. The only output the command gives right now is limited and >> biased: >> >> - Biased: Since the output matrix is limited to dimension "dim",=20 >> extra >> vertices for non simplicial facets get discarded. My knowledge of=20= >> C is >> very little, but.. =BFis it possible to increase the dimension of=20= >> the >> returning matrix (maybe filling it with zeros) in the case of=20 >> finding a >> non-simplicial facet?. It would be something in line 97 like = that: >> >> if (j > dim) { >> dim =3D dim + 1 >> redim idx(n, dim) >> for k =3D 1 to i-1 { >> idx (k, dim) =3D 0 >> } >> idx(i,j++) =3D 1 + qh_pointid(vertex->point) >> } > > Instead of doing that, we might return a cell array instead of a=20 > matrix when > non simplicial facets are found. For instance, the following result: > > $ cat cube > 3 > 7 > 0 0 0 > 0 0 1 > 0 1 0 > 0 1 1 > 1 0 0 > 1 0 1 > 1 1 0 > $ cat cube | qhull o > 3 > 7 7 12 > 0 0 0 > 0 0 1 > 0 1 0 > 0 1 1 > 1 0 0 > 1 0 1 > 1 1 0 > 4 2 3 1 0 > 3 6 3 2 > 4 4 6 2 0 > 3 3 5 1 > 3 5 6 4 > 3 6 5 3 > 4 5 4 0 1 > > would be represented in Octave like this: > > A =3D {[3 4 2 1], > [7 4 3], > [5 7 3 1], > [4 6 2], > [6 7 5], > [7 6 4], > [6 5 1 2]} > > > (Notice that vertex indices in Octave start at 1 instead of zero.) > > I do not know how backward incompatible would be such a change. I think the most convenient would be to return a cell-array of=20 matrices, one for each dimension of returned facet. I think it would also be convenient if the default were to arbitrarily=20= split those facets that are non-simplicial so that those who just want=20 triangles don't have to deal with the occasional square. I'm guessing that this=20= is what matlab does --- convhulln returns this for the cube: >> convhulln(cube) ans =3D 3 4 1 4 2 1 2 4 6 2 5 1 5 2 6 7 5 6 4 7 6 7 4 3 7 3 1 5 7 1 So long as the default all-simplicial case is returned as a matrix,=20 backward compatibility doesn't matter. The user will need special code to=20 handle the non-simplicial facets anyway. Are these two cases different enough that we need different functions? > >> - Limited: Parsing a string to qhull allows to obtain some other info=20= >> on >> the hull. Some info that is specially interesting for me is the=20 >> normals >> to each facet (option n). Since qhull can return various output=20 >> sets is >> it possible that it returns an octave struct with the different=20 >> results?. >> (I have tried to parse to qhull the "TO file" string so that I=20 >> could get >> the normals from the file created but it does not work. This could=20= >> also >> be a solution, in fact THE solution in the case of OFF output to=20 >> feed >> Geomview). > > To avoid backward incompatible changes, what about having extra output > arguments, one for the facet normals, other for the OFF string result,=20= > and > so on? I think you are going to need an interface layer above the QHull options so that users can ask for them nicely: [X,Y,Z] =3D convhulln(cube,'output',{'simplicial','ideal','geomview'}) This says that X will contain the simplicial output (as a full matrix), Y will contain a cell array of facet sizes, and Z will contain a string used to control geomview. The default for output must be 'simplicial' for compatibility. That means you will need other options for controlling the QHull=20 algorithm, such as 'qhull','QJ' to feed a raw option string, or if you are feeling creative, meaningful names for all the options. Paul Kienzle pki...@us... |