From 62422e9329931419c8b524a8d01b90ccb7c6a4e0 Mon Sep 17 00:00:00 2001 From: Vijai Kumar S Date: Mon, 16 Dec 2024 14:50:23 +0100 Subject: [PATCH] Only retain the FillMeshWithGyroid.cpp example --- .../Cpp/Source/VolumeCombineFunctions.cpp | 28 ---------- .../Cpp/Source/VolumeCreateCylinder.cpp | 23 -------- .../Cpp/Source/VolumeCreateSphere.cpp | 30 ----------- SDK/Examples/Cpp/Source/VolumeCreateTorus.cpp | 30 ----------- SDK/Examples/Cpp/Source/VolumeGyroid.cpp | 28 ---------- SDK/Examples/Cpp/Source/VolumeImageStack.cpp | 54 ------------------- 6 files changed, 193 deletions(-) delete mode 100644 SDK/Examples/Cpp/Source/VolumeCombineFunctions.cpp delete mode 100644 SDK/Examples/Cpp/Source/VolumeCreateCylinder.cpp delete mode 100644 SDK/Examples/Cpp/Source/VolumeCreateSphere.cpp delete mode 100644 SDK/Examples/Cpp/Source/VolumeCreateTorus.cpp delete mode 100644 SDK/Examples/Cpp/Source/VolumeGyroid.cpp delete mode 100644 SDK/Examples/Cpp/Source/VolumeImageStack.cpp diff --git a/SDK/Examples/Cpp/Source/VolumeCombineFunctions.cpp b/SDK/Examples/Cpp/Source/VolumeCombineFunctions.cpp deleted file mode 100644 index 7cd5dd36..00000000 --- a/SDK/Examples/Cpp/Source/VolumeCombineFunctions.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "lib3mf_implicit.hpp" -#include - -int main() { - Lib3MF::PWrapper wrapper = Lib3MF::CWrapper::loadLibrary(); - auto model = wrapper->CreateModel(); - - auto funcA = model->AddImplicitFunction(); - auto funcB = model->AddImplicitFunction(); - funcA->SetDisplayName("FunctionA"); - funcB->SetDisplayName("FunctionB"); - - auto inputA = funcA->AddInput("x", "Position X", Lib3MF::eImplicitPortType::Scalar); - auto sinNode = funcA->AddSinNode("sinA", Lib3MF::eImplicitNodeConfiguration::ScalarToScalar, "Sine Node", "group"); - funcA->AddLink(inputA, sinNode->GetInputA()); - funcA->AddOutput("outputA", "Output A", Lib3MF::eImplicitPortType::Scalar); - - auto inputB = funcB->AddInput("y", "Position Y", Lib3MF::eImplicitPortType::Scalar); - auto cosNode = funcB->AddCosNode("cosB", Lib3MF::eImplicitNodeConfiguration::ScalarToScalar, "Cosine Node", "group"); - funcB->AddLink(inputB, cosNode->GetInputA()); - funcB->AddOutput("outputB", "Output B", Lib3MF::eImplicitPortType::Scalar); - - auto writer = model->QueryWriter("3mf"); - writer->WriteToFile("CombinedFunctions.3mf"); - - std::cout << "Saved CombinedFunctions.3mf" << std::endl; - return 0; -} \ No newline at end of file diff --git a/SDK/Examples/Cpp/Source/VolumeCreateCylinder.cpp b/SDK/Examples/Cpp/Source/VolumeCreateCylinder.cpp deleted file mode 100644 index 0cb972e9..00000000 --- a/SDK/Examples/Cpp/Source/VolumeCreateCylinder.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "lib3mf_implicit.hpp" -#include - -int main() { - Lib3MF::PWrapper wrapper = Lib3MF::CWrapper::loadLibrary(); - auto model = wrapper->CreateModel(); - - auto newFunction = model->AddImplicitFunction(); - newFunction->SetDisplayName("Cylinder"); - - auto input = newFunction->AddInput("pos", "Position", Lib3MF::eImplicitPortType::Vector); - auto cylinderNode = newFunction->AddLengthNode("cylinderNode", "Length", "group"); - newFunction->AddLink(input, cylinderNode->GetInputA()); - - auto output = newFunction->AddOutput("shape", "Cylinder Shape", Lib3MF::eImplicitPortType::Scalar); - newFunction->AddLink(cylinderNode->GetOutputResult(), output); - - auto writer = model->QueryWriter("3mf"); - writer->WriteToFile("Cylinder.3mf"); - - std::cout << "Saved Cylinder.3mf" << std::endl; - return 0; -} \ No newline at end of file diff --git a/SDK/Examples/Cpp/Source/VolumeCreateSphere.cpp b/SDK/Examples/Cpp/Source/VolumeCreateSphere.cpp deleted file mode 100644 index a89160e6..00000000 --- a/SDK/Examples/Cpp/Source/VolumeCreateSphere.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "lib3mf_implicit.hpp" -#include - -int main() { - Lib3MF::PWrapper wrapper = Lib3MF::CWrapper::loadLibrary(); - auto model = wrapper->CreateModel(); - - auto newFunction = model->AddImplicitFunction(); - newFunction->SetDisplayName("Sphere"); - - auto input = newFunction->AddInput("pos", "position", Lib3MF::eImplicitPortType::Vector); - auto constantNode = newFunction->AddConstantNode("radius", "Sphere Radius", "group"); - constantNode->SetConstant(15.0); - - auto lengthNode = newFunction->AddLengthNode("distance", "Distance to sphere", "group"); - newFunction->AddLink(input, lengthNode->GetInputA()); - - auto subtractNode = newFunction->AddSubtractionNode("offset", Lib3MF::eImplicitNodeConfiguration::ScalarToScalar, "Offset Radius", "group"); - newFunction->AddLink(lengthNode->GetOutputResult(), subtractNode->GetInputA()); - newFunction->AddLink(constantNode->GetOutputValue(), subtractNode->GetInputB()); - - auto output = newFunction->AddOutput("shape", "Signed Distance Field", Lib3MF::eImplicitPortType::Scalar); - newFunction->AddLink(subtractNode->GetOutputResult(), output); - - auto writer = model->QueryWriter("3mf"); - writer->WriteToFile("ImplicitSphere.3mf"); - - std::cout << "Saved ImplicitSphere.3mf" << std::endl; - return 0; -} \ No newline at end of file diff --git a/SDK/Examples/Cpp/Source/VolumeCreateTorus.cpp b/SDK/Examples/Cpp/Source/VolumeCreateTorus.cpp deleted file mode 100644 index 1375a1d0..00000000 --- a/SDK/Examples/Cpp/Source/VolumeCreateTorus.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "lib3mf_implicit.hpp" -#include - -int main() { - Lib3MF::PWrapper wrapper = Lib3MF::CWrapper::loadLibrary(); - auto model = wrapper->CreateModel(); - - auto torusFunction = model->AddImplicitFunction(); - torusFunction->SetDisplayName("Torus"); - - auto input = torusFunction->AddInput("pos", "Position", Lib3MF::eImplicitPortType::Vector); - auto lengthNode = torusFunction->AddLengthNode("length", "Length", "group"); - torusFunction->AddLink(input, lengthNode->GetInputA()); - - auto radiusNode = torusFunction->AddConstantNode("radius", "Radius", "group"); - radiusNode->SetConstant(10.0); - - auto subtractNode = torusFunction->AddSubtractionNode("subtract", Lib3MF::eImplicitNodeConfiguration::ScalarToScalar, "Subtract Radius", "group"); - torusFunction->AddLink(lengthNode->GetOutputResult(), subtractNode->GetInputA()); - torusFunction->AddLink(radiusNode->GetOutputValue(), subtractNode->GetInputB()); - - auto output = torusFunction->AddOutput("shape", "Torus Shape", Lib3MF::eImplicitPortType::Scalar); - torusFunction->AddLink(subtractNode->GetOutputResult(), output); - - auto writer = model->QueryWriter("3mf"); - writer->WriteToFile("Torus.3mf"); - - std::cout << "Saved Torus.3mf" << std::endl; - return 0; -} \ No newline at end of file diff --git a/SDK/Examples/Cpp/Source/VolumeGyroid.cpp b/SDK/Examples/Cpp/Source/VolumeGyroid.cpp deleted file mode 100644 index 2aa4673c..00000000 --- a/SDK/Examples/Cpp/Source/VolumeGyroid.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "lib3mf_implicit.hpp" -#include - -int main() { - Lib3MF::PWrapper wrapper = Lib3MF::CWrapper::loadLibrary(); - auto model = wrapper->CreateModel(); - - auto gyroidFunction = model->AddImplicitFunction(); - gyroidFunction->SetDisplayName("Gyroid"); - - auto input = gyroidFunction->AddInput("pos", "position", Lib3MF::eImplicitPortType::Vector); - auto sinNode = gyroidFunction->AddSinNode("sin", Lib3MF::eImplicitNodeConfiguration::VectorToVector, "Sine of Position", "group"); - auto cosNode = gyroidFunction->AddCosNode("cos", Lib3MF::eImplicitNodeConfiguration::VectorToVector, "Cosine of Transformed Position", "group"); - - auto dotNode = gyroidFunction->AddDotNode("dot", "Dot Product", "group"); - gyroidFunction->AddLink(input, sinNode->GetInputA()); - gyroidFunction->AddLink(cosNode->GetOutputResult(), dotNode->GetInputB()); - gyroidFunction->AddLink(sinNode->GetOutputResult(), dotNode->GetInputA()); - - auto output = gyroidFunction->AddOutput("shape", "Signed Distance Field", Lib3MF::eImplicitPortType::Scalar); - gyroidFunction->AddLink(dotNode->GetOutputResult(), output); - - auto writer = model->QueryWriter("3mf"); - writer->WriteToFile("Gyroid.3mf"); - - std::cout << "Saved Gyroid.3mf" << std::endl; - return 0; -} \ No newline at end of file diff --git a/SDK/Examples/Cpp/Source/VolumeImageStack.cpp b/SDK/Examples/Cpp/Source/VolumeImageStack.cpp deleted file mode 100644 index 1624facc..00000000 --- a/SDK/Examples/Cpp/Source/VolumeImageStack.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "lib3mf_implicit.hpp" -#include -#include - -int main() { - Lib3MF::PWrapper wrapper = Lib3MF::CWrapper::loadLibrary(); - auto model = wrapper->CreateModel(); - - constexpr int layers = 11; - - auto pImageStack = model->AddImageStack(821, 819, layers); - - // Resolve the path to the volumetricImages folder relative to the source file - std::string sVolumeImagesFolder = VOLUME_IMAGES_PATH; - std::filesystem::path sourceDir(sVolumeImagesFolder); - sourceDir = std::filesystem::canonical(sourceDir); - - if (!std::filesystem::exists(sourceDir)) { - std::cerr << "Error: Base folder not found - " << sourceDir << "\n"; - return 1; - } - - for (int i = 0; i < layers; ++i) { - std::string sNumber = "_"; - if (i + 1 < 10) sNumber += "0"; - sNumber += std::to_string(i + 1); - - std::string internalPath = "/volume/layer" + sNumber + ".png"; - std::filesystem::path filePath = sourceDir / ("img" + sNumber + ".png"); - - if (!std::filesystem::exists(filePath)) { - std::cerr << "Error: File not found - " << filePath << "\n"; - return 1; - } - - pImageStack->CreateSheetFromFile(i, internalPath, filePath.string()); - } - - // Set up a function from the image stack - auto funcFromImageStack = model->AddFunctionFromImage3D(pImageStack.get()); - funcFromImageStack->SetDisplayName("Function from Image Stack"); - - // Example of setting tile styles (can be customized) - funcFromImageStack->SetTileStyles( - Lib3MF::eTextureTileStyle::Wrap, - Lib3MF::eTextureTileStyle::Clamp, - Lib3MF::eTextureTileStyle::Mirror); - - auto writer = model->QueryWriter("3mf"); - writer->WriteToFile("ImageStack.3mf"); - - std::cout << "Saved ImageStack.3mf\n"; - return 0; -} \ No newline at end of file