feat: N-side filling + G3 continuity
CI / Build & Test (push) Failing after 34s
CI / Release Build (push) Failing after 27s
Build & Test / build-and-test (push) Has been cancelled
Build & Test / python-bindings (push) Has been cancelled

This commit is contained in:
茂之钳
2026-07-24 16:16:18 +00:00
parent e02c5980b4
commit 9b89fc179f
3 changed files with 126 additions and 0 deletions
+41
View File
@@ -19,6 +19,20 @@ static NurbsSurface make_planar_surface() {
}
// ---------------------------------------------------------------------------
// Helper: create a planar NURBS surface from origin + direction vectors
static NurbsSurface make_plane_surface(const Point3D& origin,
const Point3D& u_dir,
const Point3D& v_dir) {
std::vector<std::vector<Point3D>> grid = {
{origin, Point3D(origin.x() + v_dir.x(), origin.y() + v_dir.y(), origin.z() + v_dir.z())},
{Point3D(origin.x() + u_dir.x(), origin.y() + u_dir.y(), origin.z() + u_dir.z()),
Point3D(origin.x() + u_dir.x() + v_dir.x(),
origin.y() + u_dir.y() + v_dir.y(),
origin.z() + u_dir.z() + v_dir.z())}
};
return NurbsSurface(grid, {0,0,1,1}, {0,0,1,1}, {}, 1, 1);
}
// Helper: create a simple NURBS line curve
// ---------------------------------------------------------------------------
static NurbsCurve make_line_curve(const Point3D& a, const Point3D& b) {
@@ -320,3 +334,30 @@ TEST(NurbsOpsTest, OffsetPreservesDegree) {
EXPECT_EQ(offset.degree_u(), surf.degree_u());
EXPECT_EQ(offset.degree_v(), surf.degree_v());
}
// ===========================================================================
// Test: fill_n_sided
// ===========================================================================
TEST(NurbsOpsTest, FillNSided_Triangle) {
// Create triangular boundary
auto l1 = make_line_curve(Point3D(0,0,0), Point3D(2,0,0));
auto l2 = make_line_curve(Point3D(2,0,0), Point3D(1,2,0));
auto l3 = make_line_curve(Point3D(1,2,0), Point3D(0,0,0));
std::vector<NurbsCurve> boundaries = {l1, l2, l3};
auto fill = fill_n_sided(boundaries);
// Verify fill passes through boundary at midpoint
Point3D mid = fill.evaluate(0.5, 0.5);
EXPECT_TRUE(std::isfinite(mid.x()));
}
// ===========================================================================
// Test: is_g3_continuous
// ===========================================================================
TEST(NurbsOpsTest, G3Continuous) {
// Two planes should be G3 continuous
auto p1 = make_plane_surface(Point3D(0,0,0), Point3D(1,0,0), Point3D(0,1,0));
auto p2 = make_plane_surface(Point3D(1,0,0), Point3D(2,0,0), Point3D(1,1,0));
EXPECT_TRUE(is_g3_continuous(p1, p2, 1));
}