26 lines
645 B
C++
26 lines
645 B
C++
#include <gtest/gtest.h>
|
|
#include "vde/mesh/halfedge_mesh.h"
|
|
|
|
using namespace vde::mesh;
|
|
|
|
TEST(HalfedgeTest, SingleTriangle) {
|
|
HalfedgeMesh mesh;
|
|
mesh.build_from_triangles(
|
|
{Point3D(0,0,0), Point3D(1,0,0), Point3D(0,1,0)},
|
|
{{0,1,2}}
|
|
);
|
|
EXPECT_EQ(mesh.num_vertices(), 3u);
|
|
EXPECT_EQ(mesh.num_faces(), 1u);
|
|
}
|
|
|
|
TEST(HalfedgeTest, Bounds_ComputeCorrectly) {
|
|
HalfedgeMesh mesh;
|
|
mesh.build_from_triangles(
|
|
{Point3D(0,0,0), Point3D(2,0,0), Point3D(1,3,0)},
|
|
{{0,1,2}}
|
|
);
|
|
auto b = mesh.bounds();
|
|
EXPECT_NEAR(b.extent().x(), 2.0, 1e-6);
|
|
EXPECT_NEAR(b.extent().y(), 3.0, 1e-6);
|
|
}
|