add triangle mesh affine transform

This commit is contained in:
AndreaRigoni
2026-03-19 13:11:49 +00:00
parent 4cb4560921
commit ca5f576b99
6 changed files with 96 additions and 21 deletions

View File

@@ -43,5 +43,20 @@ int main() {
mesh.PrintSelf(std::cout);
TEST1(mesh.Points().size() == 3);
TEST1(mesh.Triangles().size() == 1);
// Test transformation
mesh.Translate(Vector3f(10, 20, 30));
Vector3f p0 = mesh.GetPoint(0);
TEST1( (p0 - Vector3f(10, 20, 30)).norm() < 1e-6 );
// Test AddPoint during transformation
mesh.AddPoint(Vector3f(11, 21, 31)); // Should be stored as (1, 1, 1) locally
Id_t lastId = mesh.Points().size() - 1;
TEST1( (mesh.Points().at(lastId) - Vector3f(1, 1, 1)).norm() < 1e-5 );
mesh.PrintSelf(std::cout);
END_TESTING;
}