Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds methods to display surfels/quad with normal vectors #802

Merged
merged 46 commits into from
May 13, 2014

Conversation

dcoeurjo
Copy link
Member

  • Ok for both Viewer3D and Board3D.

  • usage should be similar to

     Display3DFactory<>::drawSurfelWithNormal(viewer,
                                           surfel,
                                           normalVector);
    
  • surfel being a Khalimsky cell (signed or not) and normalVector a unitary normal vector.

Illustration with a 100^3 digital sphere surface with "exact" normal vectors:

snapshot

TODO:

  • assert that the kcell/cell is a 2-cell

BE CAREFUL : with QGLVIEWER, you need to press "D" to enable double-face rendering

@kerautret
Copy link
Member

Nice! I look it ;)!

@kerautret
Copy link
Member

By checking the Board3D I don't see the normal both with blender or Meshlab you use another viewer ?

@JacquesOlivierLachaud
Copy link
Member

There are two versions of Display3DFactory::drawSurfelWithNormals, one for Cell, one for SCell. In fact, both types could be identical (CellularGridSpaceND implementation dependent). Hence I suggest to rename the methods

  • for oriented n-1-cell (SCell), we can leave drawSurfelWithNormals since a surfel is an oriented element.
  • for unoriented n-1-cell (Cell), we could name it drawCellWithNormals or drawUnorientedSurfelWithNormal.

It would also disambiguate the boolean (double side) for normals. A Cell is double sided, a SCell no.
What do you think ?

// used to display surfels located at a same position.
// double factorVolSurfel=1.0;

DGtal::Z3i::RealPoint rp = display.embedK( k );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently embedK exists only for Cell and not for SCell.
The function is thus not instantiable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree.. there is a embedSK(k) for that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oups it's embedKS(k). Fixed

@dcoeurjo
Copy link
Member Author

wouldn't drawCellWithNormals be confusing with the fact that it does not consider any cell but only (n-1)-one ?
What about drawOrientedSurfelWith... and drawUnorientedSurfelWith... ? (a bit long btw)

@JacquesOlivierLachaud
Copy link
Member

Go for drawOrientedSurfelWith... and drawUnorientedSurfelWith
It is fine with me.

@JacquesOlivierLachaud
Copy link
Member

I still have some displaying issue when the estimated normal has a negative scalar product with the trivial normal. I must check a little bit more (are you "correcting" the normal at display time ?).

@JacquesOlivierLachaud
Copy link
Member

Ok. I looked in DGtal::Display3D< Space ,KSpace >::addQuadWithNormal and normals are reversed if the scalar product is negative. I am not sure this is always desirable. Look at the example below. The estimated normal is close to the z-axis, so for some surfels (containing the z-axis) they appear black.
A hack is projecting the normal onto the surfel to limit this problem.
A cleaner method is to let the normals as is (with some drawbacks when normals are not correctly oriented).

heart

@JacquesOlivierLachaud
Copy link
Member

heart2

@dcoeurjo
Copy link
Member Author

In your example, do you use the "double-quad" feature ?

@JacquesOlivierLachaud
Copy link
Member

No. When I enable it (key d), it is much worse (see image below). I suspect this is due to a too small epsilon for the precision of the depth buffer in my graphics card.

heart3

@dcoeurjo
Copy link
Member Author

@JacquesOlivierLachaud I've changed couple of things (function renaming, reorientation disabled for signed cell, ...)

@JacquesOlivierLachaud
Copy link
Member

I've got still (more) trouble when displaying surfels with drawOrientedSurfelWithNormal.
heart-quadnormal
The result is identical with or without enableDoubleFace. Only surfels with trivial normals aligned with Y are correct.

…OrientedSurfelWithNormal. Update examples and tests.
@JacquesOlivierLachaud
Copy link
Member

I have corrected a few things and modified Display3D. I think it is fine now. Merging.

JacquesOlivierLachaud added a commit that referenced this pull request May 13, 2014
Adds methods to display surfels/quad with normal vectors
@JacquesOlivierLachaud JacquesOlivierLachaud merged commit 0bbbbc7 into DGtal-team:master May 13, 2014
@dcoeurjo dcoeurjo deleted the QuadNormal branch November 14, 2014 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants