|
|
@ -165,10 +165,68 @@ void testPolylineSDF() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void testHex() |
|
|
|
{ |
|
|
|
std::vector<raw_vector3d_t> points; |
|
|
|
std::vector<double> bulges; |
|
|
|
points.push_back({-10800.000000000031, -7479.9999999988240, 0.0000000000000000}); |
|
|
|
points.push_back({-7200.0000000000291, -7479.9999999988240, 0.0000000000000000}); |
|
|
|
points.push_back({-7200.0000000000291, -7719.9999999988240, 0.0000000000000000}); |
|
|
|
points.push_back({-10800.000000000031, -7719.9999999988240, 0.0000000000000000}); |
|
|
|
bulges.push_back(0.0000000000000000); |
|
|
|
bulges.push_back(0.0000000000000000); |
|
|
|
bulges.push_back(0.0000000000000000); |
|
|
|
bulges.push_back(0.0000000000000000); |
|
|
|
polyline_descriptor_t profile{ |
|
|
|
4, |
|
|
|
points.data(), |
|
|
|
4, |
|
|
|
bulges.data(), |
|
|
|
raw_vector3d_t{0., 0., 1.}, |
|
|
|
true |
|
|
|
}; |
|
|
|
auto axisEnd = points[0]; |
|
|
|
axisEnd.z = 78.000000000471118; |
|
|
|
auto axisPoints = std::array{points[0], axisEnd}; |
|
|
|
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}; |
|
|
|
|
|
|
|
std::vector<Eigen::Vector3d> queryPoints = { |
|
|
|
{0., 0., 0. }, |
|
|
|
{-8000, 0, 10 }, |
|
|
|
{-8000, 0, -10}, |
|
|
|
{-8000, -7500, 10 }, |
|
|
|
{-8000, -7481, 10 }, |
|
|
|
{-7202, -7500, 10 } |
|
|
|
}; |
|
|
|
for (const auto &queryPoint : queryPoints) { |
|
|
|
double res = extrude_polyline.evaluate_sdf(queryPoint); |
|
|
|
Eigen::Vector3d closest_point = extrude_polyline.evaluate_cpm(queryPoint); |
|
|
|
printf("SDF at (%f, %f, %f) is %f, closest point: (%f, %f, %f)\n", |
|
|
|
queryPoint.x(), |
|
|
|
queryPoint.y(), |
|
|
|
queryPoint.z(), |
|
|
|
res, |
|
|
|
closest_point.x(), |
|
|
|
closest_point.y(), |
|
|
|
closest_point.z()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int main() |
|
|
|
{ |
|
|
|
// testExtrudeSDFZoX();
|
|
|
|
testExtrudeSDFXoY(); |
|
|
|
testHex(); |
|
|
|
// testPolylineSDF();
|
|
|
|
|
|
|
|
// std::cout << "Setting scene..." << std::endl;
|
|
|
|