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