Searching...
No Matches
GEOM_TEST Namespace Reference

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 >

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_LINE_CHAIN MakeSquarePolyLine (int aSize, const VECTOR2I &aCentre)
construct a square polygon of given size width and centre

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.

## Detailed Description

Utility functions for testing geometry functions.

## Enumeration Type Documentation

strong

```^ y
|
```

Q2 | Q1 ----—> x Q3 | Q4

Enumerator
Q1
Q2
Q3
Q4

Definition at line 51 of file geom_test_utils.h.

## ◆ ArePerpendicular()

template<typename T >
 bool GEOM_TEST::ArePerpendicular ( const VECTOR2< T > & a, const VECTOR2< T > & b, const EDA_ANGLE & aTolerance )

## ◆ ArePointsNearCircle()

template<typename T >
 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.

Parameters
 aPoints the points to check aCentre the circle centre aRad the circle radius aTolEnds the tolerance for the endpoint-centre distance
Returns
true if predicate met

Definition at line 144 of file geom_test_utils.h.

References BOOST_TEST_INFO, and IsPointAtDistance().

Referenced by ArePolylineEndPointsNearCircle(), and ArePolylineMidPointsNearCircle().

## ◆ FilletPolySet()

 SHAPE_POLY_SET GEOM_TEST::FilletPolySet ( SHAPE_POLY_SET & aPolySet, int aRadius, int aError )
inline

Definition at line 208 of file geom_test_utils.h.

template<typename T >

Definition at line 59 of file geom_test_utils.h.

References Q1, Q2, Q3, Q4, VECTOR2< T >::x, and VECTOR2< T >::y.

## ◆ IsOutlineValid()

 bool GEOM_TEST::IsOutlineValid ( const SHAPE_LINE_CHAIN & aChain )
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)

Parameters
 aChain to test
Returns
true if outline is valid

Definition at line 230 of file geom_test_utils.h.

Referenced by BOOST_AUTO_TEST_CASE(), and IsPolySetValid().

## ◆ IsPointAtDistance()

template<typename T >
 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.

Template Parameters
 T the dimension type
Parameters
 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, and KI_TEST::IsWithin().

Referenced by ArePointsNearCircle().

## ◆ IsPolySetValid()

 bool GEOM_TEST::IsPolySetValid ( const SHAPE_POLY_SET & aSet )
inline

Verify that a SHAPE_POLY_SET has been assembled correctly by verifying each of the outlines and holes contained within.

Parameters
 aSet to test
Returns
true if the poly set is valid

Definition at line 320 of file geom_test_utils.h.

Referenced by BOOST_AUTO_TEST_CASE().

## ◆ MakeSquarePolyLine()

 SHAPE_LINE_CHAIN GEOM_TEST::MakeSquarePolyLine ( int aSize, const VECTOR2I & aCentre )
inline

construct a square polygon of given size width and centre

Parameters
 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.

inline

Definition at line 85 of file geom_test_utils.h.

 bool GEOM_TEST::SegmentCompletelyWithinRadius ( const SEG & aSeg, const VECTOR2I & aPt, const int aRadius )
inline

Definition at line 103 of file geom_test_utils.h.

References SEG::A, and SEG::B.

inline

Definition at line 94 of file geom_test_utils.h.

## ◆ SegmentsHaveSameEndPoints()

 bool GEOM_TEST::SegmentsHaveSameEndPoints ( const SEG & aSeg1, const SEG & aSeg2 )
inline

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 342 of file geom_test_utils.h.

References SEG::A, and SEG::B.

Referenced by DoChamferTestChecks().