44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
|
|
#include <gtest/gtest.h>
|
||
|
|
#include "vde/curves/parallel_intersection.h"
|
||
|
|
#include <cmath>
|
||
|
|
|
||
|
|
using namespace vde::curves;
|
||
|
|
using namespace vde::core;
|
||
|
|
|
||
|
|
// Helper: create a simple NURBS line from (0,0) to (1,0)
|
||
|
|
static NurbsCurve make_line_curve() {
|
||
|
|
std::vector<Point3D> cp = {{0,0,0}, {1,0,0}};
|
||
|
|
std::vector<double> knots = {0, 0, 1, 1};
|
||
|
|
std::vector<double> weights = {1, 1};
|
||
|
|
return NurbsCurve(cp, knots, weights, 1);
|
||
|
|
}
|
||
|
|
|
||
|
|
TEST(ParallelIntersectionTest, CurveIntersection_Empty) {
|
||
|
|
auto results = parallel_curve_intersections({}, {}, {});
|
||
|
|
EXPECT_EQ(results.size(), 0u);
|
||
|
|
}
|
||
|
|
|
||
|
|
TEST(ParallelIntersectionTest, CurveIntersection_SinglePair) {
|
||
|
|
auto c1 = make_line_curve();
|
||
|
|
auto c2 = make_line_curve();
|
||
|
|
std::vector<std::pair<int,int>> pairs = {{0, 0}};
|
||
|
|
|
||
|
|
auto results = parallel_curve_intersections(pairs,
|
||
|
|
std::vector<NurbsCurve>{c1},
|
||
|
|
std::vector<NurbsCurve>{c2});
|
||
|
|
EXPECT_EQ(results.size(), 1u);
|
||
|
|
}
|
||
|
|
|
||
|
|
TEST(ParallelIntersectionTest, SurfaceIntersection_Empty) {
|
||
|
|
// Create two planes
|
||
|
|
NurbsSurface a, b;
|
||
|
|
auto results = parallel_surface_intersection(a, b);
|
||
|
|
EXPECT_EQ(results.size(), 0u);
|
||
|
|
}
|
||
|
|
|
||
|
|
TEST(ParallelIntersectionTest, SurfaceIntersection_Batch) {
|
||
|
|
std::vector<std::pair<int,int>> pairs;
|
||
|
|
auto results = parallel_surface_intersections(pairs, {}, {});
|
||
|
|
EXPECT_EQ(results.size(), 0u);
|
||
|
|
}
|