24 #include <boost/test/unit_test.hpp> 53 int aRadius,
int aError )
55 const auto diffA = aRadCentre - aSeg.A;
56 const auto diffB = aRadCentre - aSeg.B;
57 const auto diffC = aRadCentre - aSeg.Center();
60 BOOST_CHECK_PREDICATE(
61 KI_TEST::IsWithinAndBelow<int>, ( diffA.EuclideanNorm() )( aRadius )( 1 ) );
62 BOOST_CHECK_PREDICATE(
63 KI_TEST::IsWithinAndBelow<int>, ( diffB.EuclideanNorm() )( aRadius )( 1 ) );
66 BOOST_CHECK_PREDICATE(
67 KI_TEST::IsWithinAndBelow<int>, ( diffC.EuclideanNorm() )( aRadius )( aError + 1 ) );
70 const auto perpendularityMaxError = ( M_PI / 2 ) / 10;
71 BOOST_CHECK_PREDICATE( GEOM_TEST::ArePerpendicular<int>,
72 ( diffC )( aSeg.A - aSeg.B )( perpendularityMaxError ) );
94 const VECTOR2I radCentre { aSquareSize / 2 - aRadius,
95 aSquareSize / 2 - aRadius };
99 for( ; segIter; segIter++ )
151 const VECTOR2I radCentre { aSquareSize / 2 - aRadius,
152 aSquareSize / 2 + aRadius };
156 for( ; segIter; segIter++ )
210 BOOST_AUTO_TEST_SUITE_END()
void TestSquareFillet(int aSquareSize, int aRadius, int aError)
: Create a square, fillet it, and check a corner for correctness
int OutlineCount() const
Return the number of vertices in a given outline/hole.
SHAPE_POLY_SET FilletPolySet(SHAPE_POLY_SET &aPolySet, int aRadius, int aError)
Define a general 2D-vector/point.
void TestConcaveSquareFillet(int aSquareSize, int aRadius, int aError)
: Create a square concave corner, fillet and check correctness
BOOST_CHECK(v2.Cross(v1)==1)
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetClosed(bool aClosed)
Function SetClosed()
bool SegmentCompletelyWithinRadius(const SEG &aSeg, const VECTOR2I &aPt, const int aRadius)
Represent a set of closed polygons.
SHAPE_LINE_CHAIN MakeSquarePolyLine(int aSize, const VECTOR2I &aCentre)
construct a square polygon of given size width and centre
BOOST_AUTO_TEST_CASE(SquareFillet)
Tests the SHAPE_POLY_SET::FilletPolygon method against certain geometric constraints.
void TestFilletSegmentConstraints(const SEG &aSeg, VECTOR2I aRadCentre, int aRadius, int aError)
Declares the FilletFixture struct as the boost test fixture.
Utility functions for testing geometry functions.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
bool SegmentCompletelyInQuadrant(const SEG &aSeg, QUADRANT aQuadrant)
const std::vector< SquareFilletTestCase > squareFilletCases
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...