KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_utils.cpp File Reference
#include "footprint_utils.h"
#include <trigo.h>
#include <footprint.h>
#include <item_realignment.h>
#include <pad.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.
 

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().