Skip to content

Commit

Permalink
[Volumetric tests] fixing some tests, but requiers api mehtod to quer…
Browse files Browse the repository at this point in the history
…y BoundaryShapeObjects
  • Loading branch information
3dJan committed Apr 2, 2024
1 parent c19f983 commit 7a724ae
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
7 changes: 0 additions & 7 deletions Tests/CPP_Bindings/Source/UnitTest_Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,6 @@ namespace Lib3MF
void CompareVolumeData(Lib3MF::PModel modelA, Lib3MF::PVolumeData A,
Lib3MF::PModel modelB, Lib3MF::PVolumeData B)
{
ASSERT_EQ(A->GetBoundary() == nullptr, B->GetBoundary() == nullptr);
if(A->GetBoundary())
{
CompareFunctionReferences(modelA, A->GetBoundary(), modelB,
B->GetBoundary());
}

ASSERT_EQ(A->GetColor() == nullptr, B->GetColor() == nullptr);
if(A->GetColor())
{
Expand Down
39 changes: 24 additions & 15 deletions Tests/CPP_Bindings/Source/Volumetric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,10 @@ namespace Lib3MF
newFunction->AddLink(subNodeOutputResult, output);

auto theMesh = GetMesh();
auto volumeData = theMesh->VolumeData();
auto theBoundary = volumeData->CreateNewBoundary(newFunction.get());
// auto volumeData = theMesh->VolumeData();
// auto theBoundary = volumeData->CreateNewBoundary(newFunction.get());
auto theBoundary = model->AddBoundaryShape();
theBoundary->SetMesh(theMesh);

// Write to file
writer3MF->WriteToFile(Volumetric::OutFolder +
Expand Down Expand Up @@ -473,8 +475,8 @@ namespace Lib3MF
output->SetReference("distance_2.result");

auto theMesh = GetMesh();
auto volumeData = theMesh->VolumeData();
auto theBoundary = volumeData->CreateNewBoundary(newFunction.get());
auto theBoundary = model->AddBoundaryShape();
theBoundary->SetMesh(theMesh);
theBoundary->SetFallBackValue(-1.2345);

// Write to file
Expand All @@ -501,7 +503,7 @@ namespace Lib3MF
meshesFromWrittenFile->GetCurrentMeshObject();

// Check the fallback value
auto volumeDataFromWrittenFile = meshFromWrittenFile->VolumeData();
auto volumeDataFromWrittenFile = meshFromWrittenFile->GetVolumeData();
auto boundaryFromWrittenFile = volumeDataFromWrittenFile->GetBoundary();
EXPECT_EQ(boundaryFromWrittenFile->GetFallBackValue(), -1.2345);

Expand All @@ -515,8 +517,8 @@ namespace Lib3MF
PImplicitFunction newFunction = helper::createGyroidFunction(*model);

auto theMesh = GetMesh();
auto volumeData = theMesh->VolumeData();
auto theBoundary = volumeData->CreateNewBoundary(newFunction.get());
auto theBoundary = model->AddBoundaryShape();
theBoundary->SetMesh(theMesh);

// write to file
writer3MF->WriteToFile(Volumetric::OutFolder + "ImplicitGyroid.3mf");
Expand Down Expand Up @@ -595,8 +597,9 @@ namespace Lib3MF
output->SetReference("subtraction.result");

auto theMesh = GetMesh();
auto volumeData = theMesh->VolumeData();
auto theBoundary = volumeData->CreateNewBoundary(newFunction.get());
auto theBoundary = model->AddBoundaryShape();
theBoundary->SetMesh(theMesh);

theBoundary->SetMinFeatureSize(0.1);
theBoundary->SetChannelName("shape");

Expand Down Expand Up @@ -737,8 +740,8 @@ namespace Lib3MF

// Add a boundary to the volume data
auto theMesh = GetMesh();
auto volumeData = theMesh->VolumeData();
auto theBoundary = volumeData->CreateNewBoundary(newFunction.get());
auto theBoundary = model->AddBoundaryShape();
theBoundary->SetMesh(theMesh);
theBoundary->SetMinFeatureSize(0.1);
theBoundary->SetChannelName("shape");

Expand Down Expand Up @@ -844,8 +847,9 @@ namespace Lib3MF
implicitFunction->AddLinkByNames("functionCall.color", "outputs.color");

auto theMesh = GetMesh();
auto volumeData = theMesh->VolumeData();
auto volumeData = model->AddVolumeData();
auto theColor = volumeData->CreateNewColor(implicitFunction.get());
theMesh->SetVolumeData(volumeData);

// Set transformation
auto transformation =
Expand Down Expand Up @@ -910,10 +914,14 @@ namespace Lib3MF

// add volume data
auto theMesh = GetMesh();
auto volumeData = theMesh->VolumeData();
auto volumeData = model->AddVolumeData();


// Add boundary
auto boundary = volumeData->CreateNewBoundary(funcFromImage3d.get());
auto boundary = model->AddBoundaryShape();
boundary->SetMesh(theMesh);
boundary->SetFunction(funcFromImage3d.get());

boundary->SetTransform(
helper::ComputeTransformFromMeshCoordinatesToUVW(theMesh));
boundary->SetChannelName("red");
Expand Down Expand Up @@ -989,7 +997,8 @@ namespace Lib3MF

// add volume data
auto theMesh = GetMesh();
auto volumeData = theMesh->VolumeData();
auto volumeData = model->AddVolumeData();
theMesh->SetVolumeData(volumeData);

// Add property
auto property =
Expand Down

0 comments on commit 7a724ae

Please sign in to comment.