KiCad PCB EDA Suite
|
Utility functions for testing geometry functions. More...
Enumerations | |
enum class | QUADRANT { Q1 , Q2 , Q3 , Q4 } |
Geometric quadrants, from top-right, anti-clockwise. More... | |
Functions | |
template<typename T > | |
bool | IsInQuadrant (const VECTOR2< T > &aPoint, QUADRANT aQuadrant) |
bool | SegmentCompletelyInQuadrant (const SEG &aSeg, QUADRANT aQuadrant) |
bool | SegmentEndsInQuadrant (const SEG &aSeg, QUADRANT aQuadrant) |
bool | SegmentCompletelyWithinRadius (const SEG &aSeg, const VECTOR2I &aPt, const int aRadius) |
template<typename T > | |
bool | IsPointAtDistance (const VECTOR2< T > &aPtA, const VECTOR2< T > &aPtB, T aExpDist, T aTol) |
Check that two points are the given distance apart, within the given tolerance. More... | |
template<typename T > | |
bool | ArePointsNearCircle (const std::vector< VECTOR2< T > > &aPoints, const VECTOR2< T > &aCentre, T aRad, T aTol) |
Predicate for checking a set of points is within a certain tolerance of a circle. More... | |
template<typename T > | |
bool | ArePerpendicular (const VECTOR2< T > &a, const VECTOR2< T > &b, const EDA_ANGLE &aTolerance) |
SHAPE_LINE_CHAIN | MakeSquarePolyLine (int aSize, const VECTOR2I &aCentre) |
construct a square polygon of given size width and centre More... | |
SHAPE_POLY_SET | FilletPolySet (SHAPE_POLY_SET &aPolySet, int aRadius, int aError) |
bool | IsOutlineValid (const SHAPE_LINE_CHAIN &aChain) |
Verify that a SHAPE_LINE_CHAIN has been assembled correctly by ensuring that the arc start and end points match points on the chain and that any points inside the arcs actually collide with the arc segments (with an error margin of 5000 IU) More... | |
bool | IsPolySetValid (const SHAPE_POLY_SET &aSet) |
Verify that a SHAPE_POLY_SET has been assembled correctly by verifying each of the outlines and holes contained within. More... | |
Utility functions for testing geometry functions.
|
strong |
Geometric quadrants, from top-right, anti-clockwise.
^ y |
Q2 | Q1 ----—> x Q3 | Q4
Enumerator | |
---|---|
Q1 | |
Q2 | |
Q3 | |
Q4 |
Definition at line 51 of file geom_test_utils.h.
bool GEOM_TEST::ArePerpendicular | ( | const VECTOR2< T > & | a, |
const VECTOR2< T > & | b, | ||
const EDA_ANGLE & | aTolerance | ||
) |
Definition at line 172 of file geom_test_utils.h.
References std::abs(), PNS::angle(), ANGLE_180, ANGLE_90, EDA_ANGLE::AsRadians(), and KI_TEST::IsWithin().
bool GEOM_TEST::ArePointsNearCircle | ( | const std::vector< VECTOR2< T > > & | aPoints, |
const VECTOR2< T > & | aCentre, | ||
T | aRad, | ||
T | aTol | ||
) |
Predicate for checking a set of points is within a certain tolerance of a circle.
aPoints | the points to check |
aCentre | the circle centre |
aRad | the circle radius |
aTolEnds | the tolerance for the endpoint-centre distance |
Definition at line 144 of file geom_test_utils.h.
References BOOST_TEST_INFO, and IsPointAtDistance().
Referenced by ArePolylineEndPointsNearCircle(), and ArePolylineMidPointsNearCircle().
|
inline |
Definition at line 208 of file geom_test_utils.h.
References SHAPE_POLY_SET::AddOutline(), SHAPE_POLY_SET::FilletPolygon(), and SHAPE_POLY_SET::OutlineCount().
Referenced by TestConcaveSquareFillet(), and TestSquareFillet().
bool GEOM_TEST::IsInQuadrant | ( | const VECTOR2< T > & | aPoint, |
QUADRANT | aQuadrant | ||
) |
Definition at line 59 of file geom_test_utils.h.
References Q1, Q2, Q3, Q4, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by SegmentCompletelyInQuadrant(), and SegmentEndsInQuadrant().
|
inline |
Verify that a SHAPE_LINE_CHAIN has been assembled correctly by ensuring that the arc start and end points match points on the chain and that any points inside the arcs actually collide with the arc segments (with an error margin of 5000 IU)
aChain | to test |
Definition at line 230 of file geom_test_utils.h.
References SHAPE_LINE_CHAIN::Arc(), SHAPE_LINE_CHAIN::ArcIndex(), SHAPE_ARC::Collide(), SHAPE_LINE_CHAIN::CPoint(), SHAPE_ARC::DefaultAccuracyForPCB(), SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), SHAPE_LINE_CHAIN::IsSharedPt(), and SHAPE_LINE_CHAIN::PointCount().
Referenced by BOOST_AUTO_TEST_CASE(), and IsPolySetValid().
bool GEOM_TEST::IsPointAtDistance | ( | const VECTOR2< T > & | aPtA, |
const VECTOR2< T > & | aPtB, | ||
T | aExpDist, | ||
T | aTol | ||
) |
Check that two points are the given distance apart, within the given tolerance.
T | the dimension type |
aPtA | the first point |
aPtB | the second point |
aExpDist | the expected distance |
aTol | the permitted tolerance |
Definition at line 120 of file geom_test_utils.h.
References BOOST_TEST_INFO, EuclideanNorm(), and KI_TEST::IsWithin().
Referenced by ArePointsNearCircle().
|
inline |
Verify that a SHAPE_POLY_SET has been assembled correctly by verifying each of the outlines and holes contained within.
aSet | to test |
Definition at line 299 of file geom_test_utils.h.
References SHAPE_POLY_SET::CHole(), SHAPE_POLY_SET::HoleCount(), IsOutlineValid(), SHAPE_POLY_SET::Outline(), and SHAPE_POLY_SET::OutlineCount().
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
construct a square polygon of given size width and centre
aSize | the side width (must be divisible by 2 if want to avoid rounding) |
aCentre | the centre of the square |
Definition at line 189 of file geom_test_utils.h.
References SHAPE_LINE_CHAIN::Append(), SHAPE_LINE_CHAIN::SetClosed(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by TestSquareFillet().
Definition at line 85 of file geom_test_utils.h.
References SEG::A, SEG::B, and IsInQuadrant().
Referenced by TestSquareFillet().
|
inline |
Definition at line 103 of file geom_test_utils.h.
References SEG::A, SEG::B, and EuclideanNorm().
Referenced by TestConcaveSquareFillet().
Definition at line 94 of file geom_test_utils.h.
References SEG::A, SEG::B, and IsInQuadrant().