24#include <boost/test/unit_test.hpp>
25#include <boost/test/data/test_case.hpp>
49 int aRadius,
int aError )
51 const auto diffA = aRadCentre - aSeg.A;
52 const auto diffB = aRadCentre - aSeg.B;
53 const auto diffC = aRadCentre - aSeg.Center();
57 KI_TEST::IsWithinAndBelow<int>, ( diffA.EuclideanNorm() )( aRadius )( 1 ) );
59 KI_TEST::IsWithinAndBelow<int>, ( diffB.EuclideanNorm() )( aRadius )( 1 ) );
63 KI_TEST::IsWithinAndBelow<int>, ( diffC.EuclideanNorm() )( aRadius )( aError + 1 ) );
68 ( diffC )( aSeg.A - aSeg.B )( perpendularityMaxError ) );
83 SHAPE_POLY_SET filleted = FilletPolySet( squarePolySet, aRadius, aError );
90 const VECTOR2I radCentre { aSquareSize / 2 - aRadius,
91 aSquareSize / 2 - aRadius };
95 for( ; segIter; segIter++ )
98 if ( SegmentCompletelyInQuadrant( *segIter, QUADRANT::Q1 ) )
106 BOOST_CHECK( checked > 0 );
140 SHAPE_POLY_SET filleted = FilletPolySet(polySet, aRadius, aError);
147 const VECTOR2I radCentre { aSquareSize / 2 - aRadius,
148 aSquareSize / 2 + aRadius };
152 for( ; segIter; segIter++ )
155 if ( SegmentCompletelyWithinRadius( *segIter, radCentre, aRadius + 1) )
163 BOOST_CHECK( checked > 0 );
175 return os <<
"Square size: " << testCase.
squareSize <<
", Radius: " << testCase.
radius
176 <<
", Error: " << testCase.
error;
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
Represent a set of closed polygons.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
SEGMENT_ITERATOR IterateSegments(int aFirst, int aLast, bool aIterateHoles=false)
Return an iterator object, for iterating between aFirst and aLast outline, with or without holes (def...
int OutlineCount() const
Return the number of outlines in the set.
static constexpr EDA_ANGLE ANGLE_90
Utilities for creating useful line chain idioms commonly founds in QA utilities and tests.
Utility functions for testing geometry functions.
SHAPE_LINE_CHAIN BuildSquareChain(int aSize, const VECTOR2I &aCentre)
Builds a square SHAPE_LINE_CHAIN of a certain size at a certain centre.
friend std::ostream & operator<<(std::ostream &os, const SquareFilletTestCase &testCase)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_CHECK_EQUAL(ret, c.m_exp_result)
const std::vector< SquareFilletTestCase > squareFilletCases
void TestConcaveSquareFillet(int aSquareSize, int aRadius, int aError)
: Create a square concave corner, fillet and check correctness
void TestFilletSegmentConstraints(const SEG &aSeg, VECTOR2I aRadCentre, int aRadius, int aError)
BOOST_DATA_TEST_CASE(SquareConcaveFillet, boost::unit_test::data::make(squareFilletCases), testCase)
Tests the SHAPE_POLY_SET::FilletPolygon method against certain geometric constraints.
void TestSquareFillet(int aSquareSize, int aRadius, int aError)
: Create a square, fillet it, and check a corner for correctness
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_PREDICATE(ArePolylineEndPointsNearCircle,(chain)(c.m_geom.m_center_point)(radius)(accuracy+epsilon))
VECTOR2< int32_t > VECTOR2I