46 static const std::vector<ELLIPSE_TO_BEZIER_CASE> cases = {
50 { { { 100, 0 }, { 100, -55.22847498307934 }, { 55.228474983079344, -100 }, { 0, -100 } },
51 { { 0, -100 }, { -55.22847498307934, -100 }, { -100, -55.228474983079344 }, { -100, 0 } },
52 { { -100, 0 }, { -100, 55.22847498307934 }, { -55.228474983079344, 100 }, { 0, 100 } },
53 { { 0, 100 }, { 55.22847498307934, 100 }, { 100, 55.228474983079344 }, { 100, 0 } }
59 { { { -100, 0 }, { -100, 27.61423749153967 }, { -55.228474983079344, 50 }, { 0, 50 } },
60 { { 0, 50 }, { 55.22847498307934, 50 }, { 100, 27.614237491539672 }, { 100, 0 } },
61 { { 100, 0 }, { 100, -27.61423749153967 }, { 55.228474983079344, -50 }, { 0, -50 } },
62 { { 0, -50 }, { -55.22847498307934, -50 }, { -100, -27.614237491539672 }, { -100, 0 } }
68 { { { -100, 0 }, { -100, 27.61423749153967 }, { -55.228474983079344, 50 }, { 0, 50 } },
69 { { 0, 50 }, { 55.22847498307934, 50 }, { 100, 27.614237491539672 }, { 100, 0 } }
75 { { { -463.86, 336.27 }, { -389.81, 608.33 }, { -170.75, 818.49 }, { 99.52, 876.73 } },
76 { { 99.52, 876.73 }, { 369.80, 934.98 }, { 643.36, 831.0 }, { 803.07, 609.31 } }
82 { { { 886.98, -1609.17 }, { 608.61, -1333.45 }, { 110.16, -394.92 }, { -305.88, 636.89 } },
83 { { -305.88, 636.89 }, { -721.93, 1668.69 }, { -940.88, 2509.32 }, { -829.87, 2648.63 } },
84 { { -829.87, 2648.63 }, { -718.85, 2787.95 }, { -308.47, 2187.55 }, { 152.23, 1211.78 } },
85 { { 152.23, 1211.78 }, { 612.93, 236.01 }, { 996.95, -846.11 }, { 1071.24, -1377.92 } }
93 BOOST_TEST_CONTEXT( c.name )
95 std::vector<BEZIER<double>> out;
96 TransformEllipseToBeziers<double>( c.input, out );
98 BOOST_CHECK_EQUAL( c.expected.size(), out.size() );
103 BOOST_TEST_MESSAGE( fmt::format(
"{{ {{ {}, {} }}, {{ {}, {} }}, {{ {}, {} }}, {{ {}, {} }} }}",
104 b.Start.x, b.Start.y, b.C1.x, b.C1.y,
105 b.C2.x, b.C2.y, b.End.x, b.End.y ) );
109 for(
size_t i = 0; i < out.size(); i++ )
111 BOOST_CHECK_LE( ( c.expected[i].Start - out[i].Start ).EuclideanNorm(),
113 BOOST_CHECK_LE( ( c.expected[i].C1 - out[i].C1 ).EuclideanNorm(),
115 BOOST_CHECK_LE( ( c.expected[i].C2 - out[i].C2 ).EuclideanNorm(),
117 BOOST_CHECK_LE( ( c.expected[i].End - out[i].End ).EuclideanNorm(),
Generic cubic Bezier representation.
This class was created to handle importing ellipses from other file formats that support them nativel...
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE FULL_CIRCLE
static constexpr EDA_ANGLE ANGLE_180
std::vector< BEZIER< double > > expected
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
const double MAX_ERROR
Allows for rounding in the testcases.
BOOST_AUTO_TEST_CASE(EllipseToBezier)
BOOST_AUTO_TEST_SUITE_END()