83 wxT(
"Cannot use FRONT_INNER_BACK with blind/buried vias!" ) );
95 if( !std::equal( myLayers.begin(), myLayers.end(), otherLayers.begin() ) )
98 for(
int i : myLayers )
110 int clearance = aNode->
GetClearance(
this, aOther,
false );
118 aForce = elementForce;
121 return ( aForce !=
VECTOR2I( 0, 0 ) );
126 int aCollisionMask,
int aMaxIterations )
133 PNS_DBG( dbg, AddPoint,
Pos(),
YELLOW, 100000, wxString::Format(
"via-force-init-pos, iter %d", aMaxIterations ) );
135 while( iter < aMaxIterations )
148 bool collFound = mv.
PushoutForce( aNode, obs->m_item, force );
158 PNS_DBG( dbg, Message, wxString::Format(
"no-coll %d", iter ) );
169 if( iter > aMaxIterations / 2 && forceMag > threshold )
180 PNS_DBG( dbg, AddShape, &ff,
YELLOW, 100000,
"via-force-lead" );
187 if( forceMag > threshold )
189 force.
Resize( threshold );
200 PNS_DBG( dbg, AddShape, &ff,
WHITE, 100000,
"via-force-coll" );
206 if( iter == aMaxIterations )
209 PNS_DBG( dbg, AddPoint, (
Pos() + totalForce ),
WHITE, 1000000,
"via-force-new" );
220 wxT(
"Warning: VIA::Hull called with invalid layer but viastack is complex" ) );
222 int cl = ( aClearance + aWalkaroundThickness / 2 );
231 cl, ( 2 * cl + width ) * ( 1.0 - M_SQRT1_2 ) );
247 for(
const auto& [layer, shape] :
m_shapes )
264 if( aOther->
Pos() !=
Pos() )
294 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, PNS_LAYER_RANGE aLayers)
Base class for PNS router board items.
void SetLayers(const PNS_LAYER_RANGE &aLayers)
virtual const std::string Format() const
virtual const SHAPE * Shape(int aLayer) const
Return the geometrical shape of the item.
const PNS_LAYER_RANGE & Layers() const
virtual NET_HANDLE Net() const
std::set< int > RelevantShapeLayers(const ITEM *aOther) const
Returns the set of layers on which either this or the other item can have a unique shape.
void SetNet(NET_HANDLE aNet)
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
ROUTER_IFACE * GetInterface() const
static ROUTER * GetInstance()
int Diameter(int aLayer) const
OPT_BOX2I ChangedArea(const VIA *aOther) const
std::vector< int > UniqueShapeLayers() const override
Return a list of layers that have unique (potentially different) shapes.
const VECTOR2I & Pos() const
virtual void SetHole(HOLE *aHole) override
std::map< int, int > m_diameters
May contain 1..n diameters depending on m_stackMode.
const VIA_HANDLE MakeHandle() const
const SHAPE * Shape(int aLayer) const override
Return the geometrical shape of the item.
virtual const std::string Format() const override
bool PushoutForce(NODE *aNode, const VECTOR2I &aDirection, VECTOR2I &aForce, int aCollisionMask=ITEM::ANY_T, int aMaxIterations=10)
std::map< int, SHAPE_CIRCLE > m_shapes
int EffectiveLayer(int aLayer) const
void SetPos(const VECTOR2I &aPos)
bool PadstackMatches(const VIA &aOther) const
const SHAPE_LINE_CHAIN Hull(int aClearance=0, int aWalkaroundThickness=0, int aLayer=-1) const override
static constexpr int ALL_LAYERS
static constexpr int INNER_LAYERS
void SetStackMode(STACK_MODE aStackMode)
VIA * Clone() const override
Return a deep copy of the item.
bool Overlaps(const PNS_LAYER_RANGE &aOther) const
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 std::string Format(bool aCplusPlus=true) const
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