Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
OpenVDB - create_levelset_volume (usage)
using GridT = openvdb::FloatGrid;
auto grid1 = openvdb::tools::createLevelSetSphere<GridT>(
512.0, openvdb::Vec3f(0, 0, 0), 1, 2);
Sphere s0{glm::vec4(-512,-512,512,1), 16};
LinearSphereSweptVolume volume0(s0, /*translation=*/glm::vec3(1024, 1024, 0));
auto grid2 = create_levelset_volume<GridT>(volume0, 1, 2);
openvdb::tools::csgDifference(*grid1, *grid2);
s0 = Sphere{glm::vec4(-512,512,1024,1), 16};
volume0 = LinearSphereSweptVolume(s0, /*translation=*/glm::vec3(1024,-1024, 0));
grid2 = create_levelset_volume<GridT>(volume0, 2, 4);
openvdb::tools::csgDifference(*grid1, *grid2);
AABB volume1{vec3(-20, -20, -600), vec3(20, 20, 600)};
grid2 = create_levelset_volume<GridT>(volume1, 1, 2);
openvdb::tools::csgDifference(*grid1, *grid2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.