lukasgartmair / 3Depict_Isosurfaces

GNU General Public License v3.0
0 stars 0 forks source link

Verifying of the Method in which the VDB-Grid is filled with values #1

Closed lukasgartmair closed 8 years ago

lukasgartmair commented 8 years ago

The problem here is that in order to obtain the concentration by the division of two openvdbgrids 0 divided by zero ends up in -Nan, which leads to nan-coordinates in the isosurface mesh.

Solution 1: Set the background to 0. Check for nans after the compdivision and set them to zero Problem 1: The function std::isnan() seems to show different behaviour with different environments. http://stackoverflow.com/questions/3596622/negative-nan-is-not-a-nan

Solution 2: Set the background to 1, After filling the grids, subtract the background value from the active i.e. filled voxels. Now do the division and former zero by zero is now one by one which is one. After that step set the background values to zero. Is here any logical pitfall? One thing about this is, the case that a voxel has the value 1 after the division (should be unlikely but depends on the specimen).

lukasgartmair commented 8 years ago

For this reason i made up a testsuite in this external repository: git@github.com:lukasgartmair/OpenVDB_TestSuite.git

lukasgartmair commented 8 years ago

For some reason the division in the test works fine, while the division in the filter produces simply a grid of ones as the main grid and the subgrid are filled in the same way?!

This is of course not desired and the reason for this strange behaviour has to be found!

eval min max grid = 1.6248e-06 , 2.59725 active voxel count grid = 20375 eval min max subgrid = 1.6248e-06 , 2.59725 active voxel count subgrid = 20375 eval min max subgrid after division = 1 , 1 active voxel count subgrid after division = 20375

lukasgartmair commented 8 years ago

that happens when asking if enabledIons[0][uj] == true.

with the initial workaround to choose only the copper ions if idIon == 1 it seems to work

eval min max grid = 1.01769e-06 , 12.3288 active voxel count grid = 101309 eval min max subgrid = 0 , 2.84591 active voxel count subgrid = 101309 eval min max subgrid after division = 0 , 1 active voxel count subgrid after division = 101309

which means that the enabledIons thing does not work as expected

lukasgartmair commented 8 years ago

First only Al checked, second only cu checked, third apply range in lukas analysis checked!

eval min max grid = 1.99242e-07 , 14.4692 active voxel count grid = 101135 eval min max subgrid = 0 , 0 active voxel count subgrid = 101135 eval min max divgrid after division = 0 , 0 active voxel count divgrid after division = 101135 points size = 14 triangles size = 7 active voxel count subgrid div = 101135 0 33536 eval min max grid = 1.50413e-08 , 2.76542 active voxel count grid = 20417 eval min max subgrid = 0 , 0 active voxel count subgrid = 20417 eval min max divgrid after division = 0 , 0 active voxel count divgrid after division = 20417 points size = 12 triangles size = 7 active voxel count subgrid div = 20417 points size = 12 triangles size = 7 active voxel count subgrid div = 20417 33536 0 eval min max grid = 1.50413e-08 , 2.76542 active voxel count grid = 20417 eval min max subgrid = 1.50413e-08 , 2.76542 active voxel count subgrid = 20417 eval min max divgrid after division = 1 , 1 active voxel count divgrid after division = 20417 points size = 37392 triangles size = 1513 active voxel count subgrid div = 20417

lukasgartmair commented 8 years ago

if copper is checked i just want to get the same result from it as ionid == 1 delivers!

lukasgartmair commented 8 years ago

ok seems like the setproperty default value missed compared with the original voxelization filter. that was the reason why no independent choice of the numerator was possible.

outputs now are: no numerator checked all denominators: eval min max denominator grid = 5.35376e-07 , 15.3677 active voxel count denominator grid = 101181 eval min max numerator grid = 0 , 0 active voxel count numerator grid = 101181 eval min max divgrid after division = 0 , 0 active voxel count divgrid after division = 101181

all numerators checked, all denominators checked: active voxel count subgrid div = 101181 eval min max denominator grid = 5.35376e-07 , 15.3677 active voxel count denominator grid = 101181 eval min max numerator grid = 5.35376e-07 , 15.3677 active voxel count numerator grid = 101181 eval min max divgrid after division = 0 , 1 active voxel count divgrid after division = 101181

and finally only copper as numerator checked and all denominators: active voxel count subgrid div = 101181 eval min max denominator grid = 5.35376e-07 , 15.3677 active voxel count denominator grid = 101181 eval min max numerator grid = 0 , 2.96746 active voxel count numerator grid = 101181 eval min max divgrid after division = 0 , 1 active voxel count divgrid after division = 101181