24#include <boost/test/unit_test.hpp>
54 int aRadius,
int aError )
56 const auto diffA = aRadCentre - aSeg.A;
57 const auto diffB = aRadCentre - aSeg.B;
58 const auto diffC = aRadCentre - aSeg.Center();
61 BOOST_CHECK_PREDICATE(
62 KI_TEST::IsWithinAndBelow<int>, ( diffA.EuclideanNorm() )( aRadius )( 1 ) );
63 BOOST_CHECK_PREDICATE(
64 KI_TEST::IsWithinAndBelow<int>, ( diffB.EuclideanNorm() )( aRadius )( 1 ) );
67 BOOST_CHECK_PREDICATE(
68 KI_TEST::IsWithinAndBelow<int>, ( diffC.EuclideanNorm() )( aRadius )( aError + 1 ) );
72 BOOST_CHECK_PREDICATE( GEOM_TEST::ArePerpendicular<int>,
73 ( diffC )( aSeg.A - aSeg.B )( perpendularityMaxError ) );
88 SHAPE_POLY_SET filleted = FilletPolySet( squarePolySet, aRadius, aError );
95 const VECTOR2I radCentre { aSquareSize / 2 - aRadius,
96 aSquareSize / 2 - aRadius };
100 for( ; segIter; segIter++ )
103 if ( SegmentCompletelyInQuadrant( *segIter, QUADRANT::Q1 ) )
111 BOOST_CHECK( checked > 0 );
145 SHAPE_POLY_SET filleted = FilletPolySet(polySet, aRadius, aError);
152 const VECTOR2I radCentre { aSquareSize / 2 - aRadius,
153 aSquareSize / 2 + aRadius };
157 for( ; segIter; segIter++ )
160 if ( SegmentCompletelyWithinRadius( *segIter, radCentre, aRadius + 1) )
168 BOOST_CHECK( checked > 0 );
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.
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
BOOST_AUTO_TEST_SUITE_END()
VECTOR2< int32_t > VECTOR2I