35 int clearance = aNode->
GetClearance(
this, aOther,
false );
41 for(
size_t i = 0; i < nf; i++ )
44 force = elementForces[i];
49 return ( force !=
VECTOR2I( 0, 0 ) );
53 int aCollisionMask,
int aMaxIterations )
60 PNS_DBG( dbg, AddPoint,
Pos(),
YELLOW, 100000, wxString::Format(
"via-force-init-pos, iter %d", aMaxIterations ) );
62 while( iter < aMaxIterations )
75 bool collFound = mv.
PushoutForce( aNode, obs->m_item, force );
85 PNS_DBG( dbg, Message, wxString::Format(
"no-coll %d", iter ) );
89 const int threshold =
Diameter() / 4;
95 if( iter > aMaxIterations / 2 && forceMag > threshold )
106 PNS_DBG( dbg, AddShape, &ff,
YELLOW, 100000,
"via-force-lead" );
113 if( forceMag > threshold )
115 force.
Resize( threshold );
126 PNS_DBG( dbg, AddShape, &ff,
WHITE, 100000,
"via-force-coll" );
132 if( iter == aMaxIterations )
135 PNS_DBG( dbg, AddPoint, (
Pos() + totalForce ),
WHITE, 1000000,
"via-force-new" );
145 int cl = ( aClearance + aWalkaroundThickness / 2 );
154 cl, ( 2 * cl + width ) * ( 1.0 - M_SQRT1_2 ) );
182 if( aOther->
Pos() !=
Pos() )
206 std::stringstream ss;
std::optional< BOX2I > OPT_BOX2I
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
static HOLE * MakeCircularHole(const VECTOR2I &pos, int radius)
Base class for PNS router board items.
void SetLayers(const PNS_LAYER_RANGE &aLayers)
virtual const std::string Format() const
const PNS_LAYER_RANGE & Layers() const
virtual NET_HANDLE Net() const
void SetNet(NET_HANDLE aNet)
virtual const SHAPE * Shape() const
Return the geometrical shape of the item.
Keep the router "world" - i.e.
int GetClearance(const ITEM *aA, const ITEM *aB, bool aUseClearanceEpsilon=true) const
Return the pre-set worst case clearance between any pair of items.
OPT_OBSTACLE CheckColliding(const ITEM *aItem, int aKindMask=ITEM::ANY_T)
Check if the item collides with anything else in the world, and if found, returns the obstacle.
std::optional< OBSTACLE > OPT_OBSTACLE
virtual DEBUG_DECORATOR * GetDebugDecorator()=0
virtual bool IsFlashedOnLayer(const PNS::ITEM *aItem, int aLayer) const =0
ROUTER_IFACE * GetInterface() const
static ROUTER * GetInstance()
OPT_BOX2I ChangedArea(const VIA *aOther) const
const VECTOR2I & Pos() const
const SHAPE * Shape() const override
Return the geometrical shape of the item.
virtual void SetHole(HOLE *aHole) override
const VIA_HANDLE MakeHandle() const
virtual const std::string Format() const override
bool PushoutForce(NODE *aNode, const VECTOR2I &aDirection, VECTOR2I &aForce, int aCollisionMask=ITEM::ANY_T, int aMaxIterations=10)
void SetPos(const VECTOR2I &aPos)
const SHAPE_LINE_CHAIN Hull(int aClearance=0, int aWalkaroundThickness=0, int aLayer=-1) const override
VIA * Clone() const override
Return a deep copy of the item.
virtual const std::string Format(bool aCplusPlus=true) const override
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const
Check if the boundary of shape (this) lies closer to the point aP than aClearance,...
virtual const BOX2I BBox(int aClearance=0) const =0
Compute a bounding box of the shape, with a margin of aClearance a collision.
constexpr extended_type SquaredEuclideanNorm() const
Compute the squared euclidean norm of the vector, which is defined as (x ** 2 + y ** 2).
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
Push and Shove diff pair dimensions (gap) settings dialog.
const SHAPE_LINE_CHAIN OctagonalHull(const VECTOR2I &aP0, const VECTOR2I &aSize, int aClearance, int aChamfer)
#define PNS_DBG(dbg, method,...)
bool m_useClearanceEpsilon
VECTOR2< int32_t > VECTOR2I