Browse Source

test sdf of extrusion

gjj
Dtouch 2 months ago
parent
commit
3e212aaabc
  1. 4
      .gitignore
  2. 18
      .vscode/tasks.json
  3. 129
      application/main.cpp

4
.gitignore

@ -110,4 +110,6 @@ distribute/*
# Backup # Backup
backup/* backup/*
.cache/ .cache/
.vscode/*

18
.vscode/tasks.json

@ -6,7 +6,7 @@
"executable": "C:\\WINDOWS\\System32\\cmd.exe", "executable": "C:\\WINDOWS\\System32\\cmd.exe",
"args": [ "args": [
"/C", "/C",
"D:\\Intel\\oneAPI\\2024.2\\oneapi-vars.bat", "D:\\download\\IntelOneAPI\\2025.0\\oneapi-vars.bat",
"&&", "&&",
] ]
} }
@ -25,6 +25,20 @@
"command": "xmake config -p windows -m debug", "command": "xmake config -p windows -m debug",
"problemMatcher": [] "problemMatcher": []
}, },
{
"label": "build",
"type": "shell",
"command": "xmake",
"args": [
// "-v",
"-j8"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{ {
"label": "update compile_commands", "label": "update compile_commands",
"type": "shell", "type": "shell",
@ -36,6 +50,6 @@
"type": "shell", "type": "shell",
"command": "xmake run -d implicit_surface_integrator", "command": "xmake run -d implicit_surface_integrator",
"problemMatcher": [] "problemMatcher": []
} },
] ]
} }

129
application/main.cpp

@ -7,55 +7,94 @@
#include <construct_helper.hpp> #include <construct_helper.hpp>
#include "primitive_descriptor.h" #include "primitive_descriptor.h"
#include "internal_primitive_desc.hpp"
void testExtrudeSDF() {
printf("Testing extrude polyline SDF\n");
auto profilePoints = std::array{raw_vector3d_t{-1., 0., 0.}, raw_vector3d_t{1., 0., 0.}};
auto profileBulges = std::array{1.0, 1.0};
polyline_descriptor_t profile{
2,
profilePoints.data(),
2,
profileBulges.data(),
raw_vector3d_t{0., 0., 1.},
true
};
auto axisPoints = std::array{raw_vector3d_t{0., 0., 0.}, raw_vector3d_t{0., 0., 2.}};
auto axisBulges = std::array{0.0};
polyline_descriptor_t axis{
2,
axisPoints.data(),
1,
axisBulges.data(),
raw_vector3d_t{0., 1., 0.},
false
};
extrude_polyline_descriptor_t extrude{
1,
&profile,
axis
};
aabb_t<> aabb{};
internal::extrude_polyline extrude_polyline{extrude, aabb};
Eigen::Vector3d p{1., 2., 1.};
double res = extrude_polyline.evaluate_sdf(p);
printf("SDF at (%f, %f, %f) is %f\n", p.x(), p.y(), p.z(), res);
}
int main() int main()
{ {
std::cout << "Setting scene..." << std::endl; testExtrudeSDF();
sphere_descriptor_t sphere1{
{.0, .0, .0}, // std::cout << "Setting scene..." << std::endl;
0.5 // sphere_descriptor_t sphere1{
}; // {.0, .0, .0},
sphere_descriptor_t sphere2{ // 0.5
{.01, .0, .0}, // };
0.5 // sphere_descriptor_t sphere2{
}; // {.01, .0, .0},
box_descriptor_t box{ // 0.5
{0., 0., 0.}, // };
{1., 1., 1.} // box_descriptor_t box{
}; // {0., 0., 0.},
auto points = std::array{ // {1., 1., 1.}
raw_vector3d_t{-7200.0000000000282, -7479.9999999993715, 0.0}, // };
raw_vector3d_t{-4420.0000000000000, -7479.9999999993724, 0.0}, // auto points = std::array{
raw_vector3d_t{-4420.0000000000000, -7719.9999999993724, 0.0}, // raw_vector3d_t{-7200.0000000000282, -7479.9999999993715, 0.0},
raw_vector3d_t{-7200.0000000000282, -7719.9999999993715, 0.0} // raw_vector3d_t{-4420.0000000000000, -7479.9999999993724, 0.0},
}; // raw_vector3d_t{-4420.0000000000000, -7719.9999999993724, 0.0},
// auto buldges = std::array{0.0, 0.0, 0.0, 0.0}; // raw_vector3d_t{-7200.0000000000282, -7719.9999999993715, 0.0}
// extrude_descriptor_t extrude{
// static_cast<uint32_t>(buldges.size()),
// raw_vector3d_t{0.0, 0.0, 78.000000000251021},
// points.data(),
// buldges.data()
// }; // };
// auto tree_root = blobtree_new_node(&sphere1, PRIMITIVE_TYPE_SPHERE); // // auto buldges = std::array{0.0, 0.0, 0.0, 0.0};
// auto tree_root = blobtree_new_node(&box, PRIMITIVE_TYPE_BOX); // // extrude_descriptor_t extrude{
// auto tree_root = blobtree_new_node(&sphere1, PRIMITIVE_TYPE_SPHERE); // // static_cast<uint32_t>(buldges.size()),
// auto another_sphere_node = blobtree_new_node(&sphere2, PRIMITIVE_TYPE_SPHERE); // // raw_vector3d_t{0.0, 0.0, 78.000000000251021},
// virtual_node_boolean_union(&tree_root, &another_sphere_node); // // points.data(),
auto tree_root = make_primitive_node_by_move(box); // // buldges.data()
// auto tree_root = make_primitive_node_by_move(extrude); // // };
// // auto tree_root = blobtree_new_node(&sphere1, PRIMITIVE_TYPE_SPHERE);
std::cout << "Setting environments..." << std::endl; // // auto tree_root = blobtree_new_node(&box, PRIMITIVE_TYPE_BOX);
setting_descriptor setting_desc{21, 1e-5}; // // auto tree_root = blobtree_new_node(&sphere1, PRIMITIVE_TYPE_SPHERE);
update_setting(setting_desc); // // auto another_sphere_node = blobtree_new_node(&sphere2, PRIMITIVE_TYPE_SPHERE);
update_environment(&tree_root); // // virtual_node_boolean_union(&tree_root, &another_sphere_node);
// auto tree_root = make_primitive_node_by_move(box);
std::cout << "Executing solver..." << std::endl; // // auto tree_root = make_primitive_node_by_move(extrude);
auto result = execute_solver(&tree_root);
std::cout << "Surface integral result: " << result.surf_int_result << std::endl; // std::cout << "Setting environments..." << std::endl;
std::cout << "Volume integral result: " << result.vol_int_result << std::endl; // setting_descriptor setting_desc{21, 1e-5};
// update_setting(setting_desc);
std::cout << "Time statistics: " << std::endl; // update_environment(&tree_root);
print_statistics();
// std::cout << "Executing solver..." << std::endl;
// auto result = execute_solver(&tree_root);
// std::cout << "Surface integral result: " << result.surf_int_result << std::endl;
// std::cout << "Volume integral result: " << result.vol_int_result << std::endl;
// std::cout << "Time statistics: " << std::endl;
// print_statistics();
return 0; return 0;
} }
Loading…
Cancel
Save