Skip to content

Commit

Permalink
test swept surface: failing
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayu2019 committed May 20, 2024
1 parent d2cf08b commit 4258de5
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion tests/T_CommonSurfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,33 @@ TEST(Test_CommonSurfaces, CreateRevolvedSurface)
EXPECT_TRUE(result);
XYZ C0 = NurbsSurface::GetPointOnSurface(surface, UV(0.5, 0.5));
EXPECT_TRUE(C0.IsAlmostEqualTo(XYZ(sqrt(2) / 4.0, sqrt(2) / 4.0, 0.5)));
}
}

TEST(Test_CommonSurfaces, CreateTranslationalSweepSurface)
{
// Make circular profile.
XYZ center(0, 0, 0);
XYZ xAxis(1, 0, 0);
XYZ yAxis(0, 1, 0);
double startRad = 0;
double endRad = Constants::Pi * 2;
double radius = 5;
LN_NurbsCurve profile;
NurbsCurve::CreateArc(center, xAxis, yAxis, startRad, endRad, radius, radius, profile);

// Make linear trajectory.
LN_NurbsCurve trajectory;
XYZ start(0, 0, 0);
double height = 7;
XYZ end(0, 0, height);
NurbsCurve::CreateLine(start, end, trajectory);

// Make translational swept surface.
LN_NurbsSurface surface;
NurbsSurface::CreateTranslationalSweepSurface(profile, trajectory, surface);

// Verify area.
double expectedArea = (endRad - startRad) * radius * height;
double area = NurbsSurface::ApproximateArea(surface);
EXPECT_NEAR(area, expectedArea, 1e-4);
}

0 comments on commit 4258de5

Please sign in to comment.