KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_utils.h File Reference

Collection of reusable/testable functions for footprint manipulation. More...

#include <geometry/eda_angle.h>
#include <math/vector2d.h>

Go to the source code of this file.

Functions

bool ComputeFootprintShift (const FOOTPRINT &aExisting, const FOOTPRINT &aNew, VECTOR2I &aShift, EDA_ANGLE &aAngleShift)
 Compute position and angle shift between two footprints.
 

Detailed Description

Collection of reusable/testable functions for footprint manipulation.

Definition in file footprint_utils.h.

Function Documentation

◆ ComputeFootprintShift()

bool ComputeFootprintShift ( const FOOTPRINT & aExisting,
const FOOTPRINT & aNew,
VECTOR2I & aShift,
EDA_ANGLE & aAngleShift )

Compute position and angle shift between two footprints.

This will only happen when the new footprint has a different origin or has been rotated compared to the existing footprint. Most of the time, this returns a null shift.

The shift is computed based on pad positions and assumes that there are at least two non-coincident pads with unique numbers that are the same in both footprints.

Definition at line 29 of file footprint_utils.cpp.

References ANGLE_0, FOOTPRINT::GetOrientation(), GetRotated(), ORTHO_ITEM_REALIGNER::GetTransform(), pad, and result.

Referenced by PCB_EDIT_FRAME::ExchangeFootprint(), and FP_REALIGNMENT_TEST_FIXTURE::ExecuteTestCase().