fix mesh reconstruction
This commit is contained in:
parent
908114858d
commit
fc4bd15ba6
@ -1,6 +1,7 @@
|
||||
#include "MeshReconstruction.h"
|
||||
#include "Cube.h"
|
||||
#include "Triangulation.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace MeshReconstruction;
|
||||
using namespace std;
|
||||
@ -44,8 +45,9 @@ Mesh MeshReconstruction::MarchCube(
|
||||
auto const NumY = static_cast<int>(ceil(domain.size.y / cubeSize.y));
|
||||
auto const NumZ = static_cast<int>(ceil(domain.size.z / cubeSize.z));
|
||||
|
||||
auto const HalfCubeDiag = cubeSize.Norm() / 2.0;
|
||||
auto const HalfCubeSize = cubeSize * 0.5;
|
||||
auto const CubeDiag = cubeSize.Norm();
|
||||
// auto const HalfCubeDiag = cubeSize.Norm() * 0.5;
|
||||
// auto const HalfCubeSize = cubeSize * 0.5;
|
||||
|
||||
Mesh mesh;
|
||||
|
||||
@ -61,9 +63,10 @@ Mesh MeshReconstruction::MarchCube(
|
||||
Vec3 min{ x, y, z };
|
||||
|
||||
// Process only if cube lies within narrow band around surface.
|
||||
auto cubeCenter = min + HalfCubeSize;
|
||||
double dist = std::fabs(sdf(cubeCenter) - isoLevel);
|
||||
if (dist > HalfCubeDiag) continue;
|
||||
// auto cubeCenter = min + HalfCubeSize;
|
||||
// double dist = std::abs(sdf(cubeCenter) - isoLevel);
|
||||
double dist = std::abs(sdf(min) - isoLevel);
|
||||
// if (dist > CubeDiag) continue;
|
||||
|
||||
Cube cube({ min, cubeSize }, sdf);
|
||||
auto intersect = cube.Intersect(isoLevel);
|
||||
|
Loading…
Reference in New Issue
Block a user