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. | |
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. | |
template<typename T > | |
bool | ArePerpendicular (const VECTOR2< T > &a, const VECTOR2< T > &b, const EDA_ANGLE &aTolerance) |
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) | |
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. | |
bool | SegmentsHaveSameEndPoints (const SEG &aSeg1, const SEG &aSeg2) |
Check that two SEGs have the same end points, in either order. | |
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 52 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 173 of file geom_test_utils.h.
References std::abs(), 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 145 of file geom_test_utils.h.
References IsPointAtDistance().
Referenced by ArePolylineEndPointsNearCircle(), and ArePolylineMidPointsNearCircle().
|
inline |
Definition at line 187 of file geom_test_utils.h.
References SHAPE_POLY_SET::AddOutline(), SHAPE_POLY_SET::FilletPolygon(), and SHAPE_POLY_SET::OutlineCount().
bool GEOM_TEST::IsInQuadrant | ( | const VECTOR2< T > & | aPoint, |
QUADRANT | aQuadrant | ||
) |
Definition at line 60 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 209 of file geom_test_utils.h.
References SHAPE_LINE_CHAIN::Arc(), SHAPE_LINE_CHAIN::ArcIndex(), SHAPE_ARC::Collide(), SHAPE_LINE_CHAIN::CPoint(), SHAPE_LINE_CHAIN::CShapes(), SHAPE_ARC::DefaultAccuracyForPCB(), SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), SHAPE_LINE_CHAIN::IsClosed(), 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 121 of file geom_test_utils.h.
References 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().
Definition at line 86 of file geom_test_utils.h.
References SEG::A, SEG::B, and IsInQuadrant().
|
inline |
Definition at line 104 of file geom_test_utils.h.
Definition at line 95 of file geom_test_utils.h.
References SEG::A, SEG::B, and IsInQuadrant().
Check that two SEGs have the same end points, in either order.
That is to say SEG(A, B) == SEG(A, B), but also SEG(A, B) == SEG(B, A)
Definition at line 321 of file geom_test_utils.h.
References SEG::A, and SEG::B.
Referenced by BOOST_AUTO_TEST_CASE(), DoChamferTestChecks(), and DoDogboneTestChecks().