KiCad PCB EDA Suite
|
#include <convert_basic_shapes_to_polygon.h>
#include <geometry/shape_arc.h>
#include <geometry/shape_line_chain.h>
#include <qa_utils/geometry/geometry.h>
#include <qa_utils/numeric.h>
#include <qa_utils/wx_utils/unit_test_utils.h>
#include "geom_test_utils.h"
Go to the source code of this file.
Classes | |
struct | ARC_PROPERTIES |
All properties of an arc (depending on how it's constructed, some of these might be the same as the constructor params) More... | |
struct | ARC_CENTRE_PT_ANGLE |
Info to set up an arc by centre, start point and angle. More... | |
struct | ARC_CPA_CASE |
struct | ARC_TAN_TAN_RADIUS |
Info to set up an arc by tangent to two segments and a radius. More... | |
struct | ARC_TTR_CASE |
struct | ARC_START_END_CENTER |
Info to set up an arc start, end and center. More... | |
struct | ARC_SEC_CASE |
struct | ARC_PT_COLLIDE_CASE |
struct | ARC_SEG_COLLIDE_CASE |
struct | ARC_DATA_MM |
struct | ARC_ARC_COLLIDE_CASE |
struct | ARC_TO_POLYLINE_CASE |
Functions | |
static void | CheckArcGeom (const SHAPE_ARC &aArc, const ARC_PROPERTIES &aProps, const int aSynErrIU=1) |
Check a SHAPE_ARC against a given set of geometric properties. | |
static void | CheckArc (const SHAPE_ARC &aArc, const ARC_PROPERTIES &aProps, const int aSynErrIU=1) |
Check an arcs geometry and other class functions. | |
BOOST_AUTO_TEST_CASE (NullCtor) | |
Check correct handling of filter strings (as used by WX) | |
BOOST_AUTO_TEST_CASE (BasicCPAGeom) | |
BOOST_AUTO_TEST_CASE (BasicTTRGeom) | |
BOOST_AUTO_TEST_CASE (BasicSECGeom) | |
BOOST_AUTO_TEST_CASE (CollidePt) | |
BOOST_AUTO_TEST_CASE (CollideSeg) | |
BOOST_AUTO_TEST_CASE (CollideArc) | |
BOOST_AUTO_TEST_CASE (CollideArcToShapeLineChain) | |
BOOST_AUTO_TEST_CASE (CollideArcToPolygonApproximation) | |
bool | ArePolylineEndPointsNearCircle (const SHAPE_LINE_CHAIN &aPolyline, const VECTOR2I &aCentre, int aRad, int aTolerance) |
Predicate for checking a polyline has all the points on (near) a circle of given centre and radius. | |
bool | ArePolylineMidPointsNearCircle (const SHAPE_LINE_CHAIN &aPolyline, const VECTOR2I &aCentre, int aRad, int aTolerance) |
Predicate for checking a polyline has all the segment mid points on (near) a circle of given centre and radius. | |
BOOST_AUTO_TEST_CASE (ArcToPolyline) | |
Variables | |
static const std::vector< ARC_CPA_CASE > | arc_cases |
static const std::vector< ARC_TTR_CASE > | arc_ttr_cases |
static const std::vector< ARC_SEC_CASE > | arc_sec_cases |
static const std::vector< ARC_PT_COLLIDE_CASE > | arc_pt_collide_cases |
static const std::vector< ARC_SEG_COLLIDE_CASE > | arc_seg_collide_cases |
static const std::vector< ARC_ARC_COLLIDE_CASE > | arc_arc_collide_cases |
bool ArePolylineEndPointsNearCircle | ( | const SHAPE_LINE_CHAIN & | aPolyline, |
const VECTOR2I & | aCentre, | ||
int | aRad, | ||
int | aTolerance | ||
) |
Predicate for checking a polyline has all the points on (near) a circle of given centre and radius.
aPolyline | the polyline to check |
aCentre | the circle centre |
aRad | the circle radius |
aTolerance | the tolerance for the endpoint-centre distance |
Definition at line 956 of file test_shape_arc.cpp.
References GEOM_TEST::ArePointsNearCircle(), SHAPE_LINE_CHAIN::CPoint(), and SHAPE_LINE_CHAIN::PointCount().
Referenced by BOOST_AUTO_TEST_CASE().
bool ArePolylineMidPointsNearCircle | ( | const SHAPE_LINE_CHAIN & | aPolyline, |
const VECTOR2I & | aCentre, | ||
int | aRad, | ||
int | aTolerance | ||
) |
Predicate for checking a polyline has all the segment mid points on (near) a circle of given centre and radius.
aPolyline | the polyline to check |
aCentre | the circle centre |
aRad | the circle radius |
aTolEnds | the tolerance for the midpoint-centre distance |
Definition at line 979 of file test_shape_arc.cpp.
References GEOM_TEST::ArePointsNearCircle(), SHAPE_LINE_CHAIN::CPoint(), and SHAPE_LINE_CHAIN::PointCount().
Referenced by BOOST_AUTO_TEST_CASE().
BOOST_AUTO_TEST_CASE | ( | ArcToPolyline | ) |
Definition at line 994 of file test_shape_arc.cpp.
References ArePolylineEndPointsNearCircle(), ArePolylineMidPointsNearCircle(), SHAPE_LINE_CHAIN::CPoint(), DEGREES_T, epsilon, and SHAPE_LINE_CHAIN::PointCount().
BOOST_AUTO_TEST_CASE | ( | BasicCPAGeom | ) |
Definition at line 329 of file test_shape_arc.cpp.
References arc_cases, CheckArc(), and DEGREES_T.
BOOST_AUTO_TEST_CASE | ( | BasicSECGeom | ) |
Definition at line 529 of file test_shape_arc.cpp.
References arc_sec_cases, SHAPE_ARC::ConstructFromStartEndCenter(), and SHAPE_ARC::GetArcMid().
BOOST_AUTO_TEST_CASE | ( | BasicTTRGeom | ) |
Definition at line 437 of file test_shape_arc.cpp.
References SEG::A, arc_ttr_cases, SEG::B, CheckArc(), ARC_PROPERTIES::m_center_angle, ARC_PROPERTIES::m_end_angle, ARC_PROPERTIES::m_end_point, ARC_PROPERTIES::m_start_angle, ARC_PROPERTIES::m_start_point, and SHAPE::MIN_PRECISION_IU.
BOOST_AUTO_TEST_CASE | ( | CollideArc | ) |
Definition at line 821 of file test_shape_arc.cpp.
References arc_arc_collide_cases, SHAPE::Collide(), SHAPE_ARC::GetWidth(), EDA_IU_SCALE::mmToIU(), pcbIUScale, and SHAPE_LINE_CHAIN::SetWidth().
BOOST_AUTO_TEST_CASE | ( | CollideArcToPolygonApproximation | ) |
Definition at line 897 of file test_shape_arc.cpp.
References SHAPE_POLY_SET::AddOutline(), SHAPE_ARC::BBox(), SHAPE_ARC::DefaultAccuracyForPCB(), DEGREES_T, epsilon, ERROR_OUTSIDE, SHAPE_ARC::GetArcMid(), BOX2< Vec >::GetEnd(), SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), BOX2< Vec >::GetPosition(), SHAPE_ARC::GetWidth(), BOX2< Vec >::GetWidth(), SHAPE_POLY_SET::HoleCount(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), and TransformArcToPolygon().
BOOST_AUTO_TEST_CASE | ( | CollideArcToShapeLineChain | ) |
Definition at line 872 of file test_shape_arc.cpp.
References SHAPE_ARC::Collide(), and SHAPE::Collide().
BOOST_AUTO_TEST_CASE | ( | CollidePt | ) |
Definition at line 615 of file test_shape_arc.cpp.
References arc_pt_collide_cases, SHAPE_ARC::Collide(), DEGREES_T, and SHAPE_ARC::SetWidth().
BOOST_AUTO_TEST_CASE | ( | CollideSeg | ) |
Definition at line 680 of file test_shape_arc.cpp.
References arc_seg_collide_cases, SHAPE_ARC::Collide(), DEGREES_T, and SHAPE_ARC::SetWidth().
BOOST_AUTO_TEST_CASE | ( | NullCtor | ) |
Check correct handling of filter strings (as used by WX)
Definition at line 135 of file test_shape_arc.cpp.
References CheckArc().
|
static |
Check an arcs geometry and other class functions.
aArc | Arc to test |
aProps | Properties to test against |
aSynErrIU | Permitted error for synthetic points and dimensions (currently radius and center) |
Should have identical geom props
Definition at line 114 of file test_shape_arc.cpp.
References CheckArcGeom(), SHAPE_ARC::Clone(), and SH_ARC.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Check a SHAPE_ARC against a given set of geometric properties.
aArc | Arc to test |
aProps | Properties to test against |
aSynErrIU | Permitted error for synthetic points and dimensions (currently radius and center) |
Check the chord agrees
All arcs are solid
Collisions will be checked elsewhere.
Definition at line 59 of file test_shape_arc.cpp.
References EDA_ANGLE::AsDegrees(), SHAPE_ARC::BBox(), SHAPE_ARC::GetCenter(), SHAPE_ARC::GetCentralAngle(), SHAPE_ARC::GetChord(), SHAPE_ARC::GetEndAngle(), SHAPE_ARC::GetP1(), SHAPE_ARC::GetRadius(), SHAPE_ARC::GetStartAngle(), SHAPE_ARC::IsSolid(), ARC_PROPERTIES::m_bbox, ARC_PROPERTIES::m_center_angle, ARC_PROPERTIES::m_center_point, ARC_PROPERTIES::m_end_angle, ARC_PROPERTIES::m_end_point, ARC_PROPERTIES::m_radius, ARC_PROPERTIES::m_start_angle, and ARC_PROPERTIES::m_start_point.
Referenced by CheckArc().
|
static |
Definition at line 747 of file test_shape_arc.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 184 of file test_shape_arc.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 560 of file test_shape_arc.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 519 of file test_shape_arc.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 664 of file test_shape_arc.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Definition at line 374 of file test_shape_arc.cpp.
Referenced by BOOST_AUTO_TEST_CASE().