1

I am working on a project which involves extracting center line from a closed object. I have to do following processing steps before implementing the center line extraction algorithm. I am new to openvdb thus some help is needed.

  1. Voxelize a mesh.
  2. Compute distance from boundary field for each voxel.
  3. Iterate over voxels.
  4. Access 26 neighbours of a voxel.

My attempt

  1. Step 1 and 2 - In order to complete step 1 and step2 I do the following. a) Read wavefront obj. I have written a custom function for this which populates vectors of Vec3s, Vec3I and Vec4I. b) Pass data to following function to compute distance from boundary field.

    GridType::Ptr meshToSignedDistanceField
    (   const openvdb::math::Transform &    xform,
    const std::vector< Vec3s > &    points,
    const std::vector< Vec3I > &    triangles,
    const std::vector< Vec4I > &    quads,
    float   exBandWidth,
    float   inBandWidth 
    )
    

Am I using the correct api function for computing distance from boundary field ?? If so I don't understad 5th (float exBandWidth) and 6th (float inBandWdth) arguments. Some pointers regarding these will be helpful.

  1. Now I have distance from boundary fields I iterate over the grid using value iterators as follows

    for (openvdb::FloatGrid::ValueAllCIter iter = grid->cbeginValueAll(); iter.test(); ++iter) {
            float dist = iter.getValue();
            if (dist > 0.0) {
                std::cout << "exterior voxel" << std::endl;
            } else {
                std::cout << "interior voxel" << std::endl;
            }
        }
    

My first question is am I doing this step right ?? If so I also want to access 26 neighbour for each voxel. How to do that ??

0 Answers0