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 ) );
71 BOOST_CHECK_PREDICATE( GEOM_TEST::ArePerpendicular<int>,
72 ( diffC )( aSeg.A - aSeg.B )( perpendularityMaxError ) );
87 SHAPE_POLY_SET filleted = FilletPolySet(squarePolySet, aRadius, aError);
94 const VECTOR2I radCentre { aSquareSize / 2 - aRadius,
95 aSquareSize / 2 - aRadius };
99 for( ; segIter; segIter++ )
102 if ( SegmentCompletelyInQuadrant( *segIter, QUADRANT::Q1 ) )
144 SHAPE_POLY_SET filleted = FilletPolySet(polySet, aRadius, aError);
151 const VECTOR2I radCentre { aSquareSize / 2 - aRadius,
152 aSquareSize / 2 + aRadius };
156 for( ; segIter; segIter++ )
159 if ( SegmentCompletelyWithinRadius( *segIter, radCentre, aRadius + 1) )
210BOOST_AUTO_TEST_SUITE_END()
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
Utility functions for testing geometry functions.
BOOST_CHECK(box.ClosestPointTo(VECTOR2D(0, 0))==VECTOR2D(1, 2))
Test suite for KiCad math code.
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)
Declares the FilletFixture struct as the boost test fixture.
BOOST_AUTO_TEST_CASE(SquareFillet)
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