KiCad PCB EDA Suite
Loading...
Searching...
No Matches
distribute.h File Reference
#include <utility>
#include <vector>

Go to the source code of this file.

Functions

std::vector< int > GetDeltasForDistributeByGaps (const std::vector< std::pair< int, int > > &aItemExtents)
 Given a list of 'n' item spans (e.g.
 
std::vector< int > GetDeltasForDistributeByPoints (const std::vector< int > &aItemPositions)
 

Function Documentation

◆ GetDeltasForDistributeByGaps()

std::vector< int > GetDeltasForDistributeByGaps ( const std::vector< std::pair< int, int > > &  aItemExtents)

Given a list of 'n' item spans (e.g.

left-right edge positions), return the deltas for each item to produce even gaps between each item.

The first and last items will not be moved.

Parameters
aItemExtentsa list of 'n' item spans, each a pair of integers representing the extents of an item. This should be sorted in a meaningful way to the caller, for example, left-right based on the item's left edge or by anchor.
Returns
a vector of n deltas, the first and last will be 0.

Definition at line 25 of file distribute.cpp.

References delta, and KiROUND().

Referenced by ALIGN_DISTRIBUTE_TOOL::doDistributeGaps(), and DoDistributeGapsTestChecks().

◆ GetDeltasForDistributeByPoints()

std::vector< int > GetDeltasForDistributeByPoints ( const std::vector< int > &  aItemPositions)

Definition at line 67 of file distribute.cpp.

References delta, and KiROUND().

Referenced by ALIGN_DISTRIBUTE_TOOL::doDistributeCenters(), and DoDistributePointsTestChecks().