#include #include "autoopt/quadric.hpp" #include using namespace autoopt; TEST(QuadricTest, ParabolaRotation) { quadric q(1.0, 0.0, 0.0, 0.0, -1.0, 0.0); // y = x^2 EXPECT_DOUBLE_EQ(q.at(-1.0), 1.0); // At x=1, y=1 EXPECT_DOUBLE_EQ(q.at(0.0), 0.0); // At x=0, y=0 EXPECT_DOUBLE_EQ(q.at(1.0), 1.0); // At x=1, y=1 double angle = M_PI / 4; // 45 degrees quadric q_rotated = q.rotated_by(angle); EXPECT_NEAR(q_rotated.at(-1.0), -0.11729096183611623, 1e-9); EXPECT_NEAR(q_rotated.at(0.0), 0.0, 1e-9); EXPECT_TRUE(std::isnan(q_rotated.at(1.0))); // Expect NaN due to no real solution }