KiCad PCB EDA Suite
auxiliary.h File Reference
#include <stdlib.h>
#include "potracelib.h"

Go to the source code of this file.

Classes

struct  point_s
 

Macros

#define sign(x)   ( (x)>0 ? 1 : (x)<0 ? -1 : 0 )
 
#define abs(a)   ( (a)>0 ? (a) : -(a) )
 
#define min(a, b)   ( (a)<(b) ? (a) : (b) )
 
#define max(a, b)   ( (a)>(b) ? (a) : (b) )
 
#define sq(a)   ( (a) * (a) )
 
#define cu(a)   ( (a) * (a) * (a) )
 

Typedefs

typedef struct point_s point_t
 
typedef potrace_dpoint_t dpoint_t
 

Functions

static dpoint_t dpoint (point_t p)
 
static dpoint_t interval (double lambda, dpoint_t a, dpoint_t b)
 
static int mod (int a, int n)
 
static int floordiv (int a, int n)
 

Macro Definition Documentation

#define abs (   a)    ( (a)>0 ? (a) : -(a) )

Definition at line 84 of file auxiliary.h.

Referenced by mpScaleBase::AbsMaxValue(), PCB_EDIT_FRAME::Add45DegreeSegment(), C3D_RENDER_RAYTRACING::add_3D_models(), DXF2BRD_CONVERTER::addLWPolyline(), AddNewTrace(), DIMENSION::AdjustDimensionDetails(), GRID_HELPER::Align(), DIRECTION_45::Angle(), SEG::ApproxCollinear(), PNS::ApproximateSegmentAsRect(), SEG::ApproxParallel(), PNS::TOPOLOGY::AssembleDiffPair(), Autoroute_One_Track(), LIB_RECTANGLE::BeginEdit(), D_PAD::boundingRadius(), PCB_BASE_FRAME::build_ratsnest_module(), DIRECTION_45::BuildInitialTrace(), calc_lon(), MODULE::CalculateBoundingBox(), CWORK::CalculateCost(), CalculateSegmentEndPoint(), DRC::checkClearanceSegmToPad(), PNS::DP_GATEWAYS::checkDiagonalAlignment(), DRC::checkMarginToCircle(), Clamp_Text_PenSize(), close_ness(), Collect_TrackSegmentsToDrag(), CONNECTIONS::CollectItemsNearTo(), Collide(), SEG::Collinear(), compute_Ratsnest_PlaceModule(), ComputeBreakPoint(), CIMAGE::CopyFull(), PNS::coupledBypass(), PNS::DIFF_PAIR::CoupledLength(), PNS::DIFF_PAIR::CoupledSegmentPairs(), PCB_EDIT_FRAME::Create_MuWaveComponent(), CINFO3D_VISU::createNewPadWithClearance(), DRC::doTrackDrc(), KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::GAL::DrawGrid(), GBR_LAYOUT::DrawItemsDCodeID(), DrawSegmentQcq(), export_vrml_module(), fillArcPOLY(), FindLineSegmentIntersection(), PNS::MEANDER_SHAPE::Fit(), gen_arc(), PNS::MEANDER_SHAPE::genMeanderShape(), D_PAD::GetBoundingBox(), GetPointToLineDistance(), GetPointToLineSegmentDistance(), MIN_SPAN_TREE_PADS::GetWeight(), PNS::LINE::HasLoops(), LIB_CIRCLE::HitTest(), PCB_TARGET::HitTest(), SCH_NO_CONNECT::HitTest(), LIB_ARC::HitTest(), DRAWSEGMENT::HitTest(), D_PAD::HitTest(), WS_DRAW_ITEM_LINE::HitTestEndPoint(), CPolyLine::HitTestForCorner(), WS_DRAW_ITEM_LINE::HitTestStartPoint(), WS_DRAW_ITEM_POLYGON::HitTestStartPoint(), WS_DRAW_ITEM_RECT::HitTestStartPoint(), WS_DRAW_ITEM_TEXT::HitTestStartPoint(), WS_DRAW_ITEM_BITMAP::HitTestStartPoint(), SHAPE_POLY_SET::Inflate(), CURSOR::Inside(), SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::IsAdjacent(), COLLECTOR::IsSimilarPointAndTime(), SEG::LineDistance(), PNS::MEANDER_SHAPE::makeMiterShape(), DSN::SPECCTRA_DB::makePADSTACK(), EDA_DRAW_PANEL::OnMouseEvent(), DIALOG_PAD_PROPERTIES::OnPaintShowPanel(), KIGFX::WX_VIEW_CONTROLS::onWheel(), OrCell_Trace(), EAGLE_PLUGIN::orientModuleText(), DIALOG_PAD_PROPERTIES::padValuesOK(), PlacePad(), PS_PLOTTER::PlotImage(), SEG::PointCloserThan(), CTRIANGLE::pre_calc_const(), mpScaleX::recalculateTicks(), mpScaleY::recalculateTicks(), recursive_bezier(), render_lineto(), rescale(), SCH_COMPONENT::SetRef(), sort_by_distance(), PNS::MEANDER_SHAPE::spacing(), TestSegmentHit(), TraceArc(), TracePcbLine(), and DIALOG_CREATE_ARRAY::ARRAY_GRID_OPTIONS::TransformItem().

#define max (   a,
 
)    ( (a)>(b) ? (a) : (b) )

Definition at line 86 of file auxiliary.h.

Referenced by mpScaleBase::AbsMaxValue(), SHAPE_INDEX< T >::Add(), PCB_EDIT_FRAME::Add45DegreeSegment(), PNS::SIZES_SETTINGS::AddLayerPair(), GRID_HELPER::AlignToSegment(), PNS::MEANDER_PLACER_BASE::AmplitudeStep(), CPOSTSHADER_SSAO::aoFF(), PNS::TOPOLOGY::AssembleDiffPair(), GRID_HELPER::BestDragOrigin(), LIB_VIEW_FRAME::BestZoom(), PL_EDITOR_FRAME::BestZoom(), PCB_BASE_FRAME::BestZoom(), GERBVIEW_FRAME::BestZoom(), LIB_EDIT_FRAME::BestZoom(), SCH_EDIT_FRAME::BestZoom(), bm_readbody_pnm(), D_PAD::boundingRadius(), ZONE_CONTAINER::buildFeatureHoleList(), HIERARCHY_NAVIG_DLG::BuildSheetsTree(), BuildUnconnectedThermalStubsPolygonList(), calcMaxArea(), calcMinArea(), calcRatio(), PNS::LINE::ChangedArea(), SCH_REFERENCE_LIST::CheckAnnotation(), PNS_PCBNEW_RULE_RESOLVER::Clearance(), PDF_PLOTTER::closePdfStream(), Collect_TrackSegmentsToDrag(), CMP_TREE_MODEL_ADAPTER::ColWidth(), EDA_RECT::Common(), BOX2< VECTOR2I >::Compute(), KIGFX::OPENGL_GAL::computeBitmapTextSize(), AUTOPLACER::ComputeFBoxSize(), mpScaleBase::computeLabelExtents(), mpScaleY::computeSlaveTicks(), KIGFX::STROKE_FONT::ComputeStringBoundaryLimits(), CreateKeepOutRectangle(), CreateThermalReliefPadPolygon(), ACTION_PLUGINS::deregister_object(), FOOTPRINT_WIZARDS::deregister_object(), DRC::doEdgeZoneDrc(), PCB_EDIT_FRAME::DoGenFootprintsPositionFile(), KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::GAL::DrawGrid(), KIGFX::CAIRO_GAL::DrawGroup(), DrawPageOnClipboard(), D_PAD::DrawShape(), EnsureGridRowTitleWidth(), mpScaleBase::ExtendDataRange(), DIALOG_DESIGN_RULES::FillListBoxWithNetNames(), ZONE_CONTAINER::FillZoneAreasWithSegments(), PNS::DIFF_PAIR_PLACER::findDpPrimitivePair(), FindSegmentIntersections(), PNS::MEANDER_SHAPE::Fit(), PNS::LINE_PLACER::FixRoute(), HPGL_PLOTTER::FlashPadRect(), HPGL_PLOTTER::FlashPadRoundRect(), DSN::PATH::Format(), formatSILabels(), SHAPE_POLY_SET::fractureSingle(), C3D_RENDER_OGL_LEGACY::generate_new_3DGrid(), ACTION_PLUGINS::GetAction(), ACTION_PLUGINS::GetActionByMenu(), LAYER_WIDGET::GetBestSize(), BOARD_DESIGN_SETTINGS::GetBiggestClearanceValue(), SCH_LINE::GetBoundingBox(), LIB_BEZIER::GetBoundingBox(), LIB_POLYLINE::GetBoundingBox(), LIB_ARC::GetBoundingBox(), TRACK::GetBoundingBox(), LIB_PIN::GetBoundingBox(), ZONE_CONTAINER::GetBoundingBox(), DRAWSEGMENT::GetBoundingBox(), DIMENSION::GetBoundingBox(), CPolyLine::GetBoundingBox(), SCH_SHEET::GetBoundingBox(), D_PAD::GetBoundingBox(), EDA_RECT::GetBoundingBoxRotated(), ZONE_CONTAINER::GetClearance(), BOARD_CONNECTED_ITEM::GetClearance(), D_PAD::GetClearance(), GetClearanceBetweenSegments(), RN_NET::GetClosestNode(), getLimits(), KIGFX::CAIRO_GAL::getNewGroupNumber(), KIGFX::OPENGL_GAL::getNewGroupNumber(), SCH_HIERLABEL::GetSchematicTextOffset(), EDA_TEXT::GetTextBox(), FOOTPRINT_WIZARDS::GetWizard(), gm_readbody_pnm(), RANGE< T >::Grow(), SELECTION_TOOL::guessSelectionCandidates(), TOOL_DISPATCHER::handleMouseButton(), HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG(), CPolyLine::HitTestForCorner(), DIALOG_NON_COPPER_ZONES_EDITOR::Init(), MARKER_BASE::init(), DIALOG_COPPER_ZONE::initDialog(), EDA_LIST_DIALOG::initDialog(), CINFO3D_VISU::InitSettings(), CBBOX2D::Intersect(), EDA_RECT::Intersects(), BOX2< VECTOR2I >::Intersects(), IsGRSPolyDrawable(), SCH_SCREEN::IsTerminalPoint(), Join(), FractureEdge::matches(), MaterialDiffuseToColorCAD(), EDA_RECT::Merge(), BOX2< VECTOR2I >::Merge(), Merge_SubNets_Connected_By_CopperAreas(), SCH_LINE::MergeOverlap(), PNS::DP_MEANDER_PLACER::Move(), MIN_SPAN_TREE::MSP_Init(), GRID_HELPER::nearestAnchor(), PNS::DP_MEANDER_PLACER::origPathLength(), PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE(), PARAM_CFG_INT::PARAM_CFG_INT(), GPCB_FPL_CACHE::parseMODULE(), PCB_PARSER::parseMODULE_unchecked(), GRID_TRICKS::paste_text(), FP_GRID_TRICKS::paste_text(), KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::performStep(), processEdge(), progress_subrange_start(), Project(), propagate(), SHAPE_INDEX< T >::Query(), DIALOG_ERC::ReBuildMatrixPanel(), mpScaleX::recalculateTicks(), mpScaleY::recalculateTicks(), GERBVIEW_FRAME::ReCreateAuxiliaryToolbar(), LIB_VIEW_FRAME::ReCreateHToolbar(), PL_EDITOR_FRAME::ReCreateHToolbar(), C3D_RENDER_OGL_LEGACY::Redraw(), Refract(), SHAPE_INDEX< T >::Reindex(), SHAPE_INDEX< T >::Remove(), render_curveto(), PCB_LAYER_BOX_SELECTOR::Resync(), C3D_RENDER_RAYTRACING::rt_render_post_process_blur_finish(), PNS::SHOVE::runOptimizer(), SHAPE_LINE_CHAIN::SegmentCount(), ZOOM_TOOL::selectRegion(), EDA_DRAW_PANEL::SetClipBox(), KIGFX::CAIRO_GAL::SetLineWidth(), BOX2< VECTOR2I >::SetMaximum(), INCREMENTAL_TEXT_CTRL::SetStep(), EDA_3D_CANVAS::SetView3D(), KIGFX::VIEW::SetViewport(), CBLINN_PHONG_MATERIAL::Shade(), C3D_RENDER_RAYTRACING::shadeHit(), PNS::LINE::snapDraggedCorner(), PNS::MEANDER_SHAPE::spacing(), PNS::MEANDER_PLACER_BASE::SpacingStep(), BOX2< VECTOR2I >::SquaredDistance(), PCB_BASE_FRAME::TestForActiveLinksInRatsnest(), TestOthersItems(), KIGFX::COLOR4D::ToHSV(), PNS::MEANDER_PLACER_BASE::tuneLineLength(), GERBVIEW_FRAME::updateDCodeSelectBox(), CMP_TREE_NODE_LIB::UpdateScore(), D_PAD::ViewBBox(), TEXTE_MODULE::ViewGetLOD(), D_PAD::ViewGetLOD(), MODULE::ViewGetLOD(), EDA_DRAW_FRAME::Window_Zoom(), WIZARD_3DSHAPE_LIBS_DOWNLOADER::WIZARD_3DSHAPE_LIBS_DOWNLOADER(), WIZARD_FPLIB_TABLE::WIZARD_FPLIB_TABLE(), WX_UNIT_TEXT::WX_UNIT_TEXT(), COMMON_TOOLS::ZoomFitScreen(), SELECTION_TOOL::zoomFitSelection(), and mpWindow::ZoomIn().

#define min (   a,
 
)    ( (a)<(b) ? (a) : (b) )

Definition at line 85 of file auxiliary.h.

Referenced by SHAPE_INDEX< T >::Add(), PNS::SIZES_SETTINGS::AddLayerPair(), adjust_vertices(), EDA_DRAW_FRAME::AdjustScrollBars(), AllAreModulesAndReturnSmallestIfSo(), PNS::ApproximateSegmentAsRect(), build_pad_testpoints(), BuildCornersList_S_Shape(), EXCELLON_WRITER::buildHolesList(), CINFO3D_VISU::buildPadShapeThickOutlineAsPolygon(), CINFO3D_VISU::buildPadShapeThickOutlineAsSegments(), MIN_SPAN_TREE::BuildTree(), BuildUnconnectedThermalStubsPolygonList(), WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), calc_lon(), KIGFX::OPENGL_GAL::calcAngleStep(), calcMinArea(), CalculateSegmentEndPoint(), PNS::LINE::ChangedArea(), Clamp_Text_PenSize(), EDA_RECT::Common(), BOX2< VECTOR2I >::Compute(), ComputeBreakPoint(), KIGFX::STROKE_FONT::ComputeStringBoundaryLimits(), EXCELLON_WRITER::createDrillFile(), CINFO3D_VISU::createLayers(), DIALOG_PLOT_SCHEMATIC::createPSFile(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), CreateThermalReliefPadPolygon(), DBG_SaveBuffer(), DBG_SaveNormalsBuffer(), SELECTION_TOOL::disambiguationMenu(), SHAPE_LINE_CHAIN::Distance(), KIGFX::PCB_PAINTER::draw(), DrawGraphicText(), KIGFX::CAIRO_GAL::DrawGroup(), GBR_LAYOUT::DrawItemsDCodeID(), D_PAD::DrawShape(), TRACK::DrawShortNetname(), EDA_DRAW_PANEL::EDA_DRAW_PANEL(), export_vrml_pad(), mpScaleBase::ExtendDataRange(), FindLineSegmentIntersection(), FindSegmentIntersections(), GERBER_PLOTTER::FlashPadCustom(), HPGL_PLOTTER::FlashPadRoundRect(), GERBER_PLOTTER::FlashPadRoundRect(), GERBER_PLOTTER::FlashPadTrapez(), EXCELLON_WRITER::GenDrillMapFile(), C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads(), PNS::MEANDER_SHAPE::genMeanderShape(), LIB_BEZIER::GetBoundingBox(), SCH_LINE::GetBoundingBox(), LIB_POLYLINE::GetBoundingBox(), LIB_ARC::GetBoundingBox(), TRACK::GetBoundingBox(), LIB_PIN::GetBoundingBox(), ZONE_CONTAINER::GetBoundingBox(), DRAWSEGMENT::GetBoundingBox(), DIMENSION::GetBoundingBox(), CPolyLine::GetBoundingBox(), D_PAD::GetBoundingBox(), EDA_RECT::GetBoundingBoxRotated(), GetClearanceBetweenSegments(), RN_NET::GetClosestNodes(), NGSPICE::GetImagPlot(), CPOSTSHADER::getIndex(), getLimits(), NGSPICE::GetMagPlot(), NGSPICE::GetPhasePlot(), NGSPICE::GetPlot(), GetPointToLineSegmentDistance(), NGSPICE::GetRealPlot(), AM_PRIMITIVE::GetShapeDim(), D_CODE::GetShapeDim(), BOARD_DESIGN_SETTINGS::GetSmallestClearanceValue(), D_PAD::GetSolderMaskMargin(), RANGE< T >::Grow(), SELECTION_TOOL::guessSelectionCandidates(), KIGFX::WX_VIEW_CONTROLS::handleAutoPanning(), GERBER_DRAW_ITEM::HitTest(), PNS::SIZES_SETTINGS::inheritTrackWidth(), MARKER_BASE::init(), initializePlotter(), CBBOX2D::Intersect(), EDA_RECT::Intersects(), BOX2< VECTOR2I >::Intersects(), IsGRSPolyDrawable(), Join(), LIB_PART::LoadDateAndTime(), FractureEdge::matches(), MaterialDiffuseToColorCAD(), EDA_RECT::Merge(), BOX2< VECTOR2I >::Merge(), SCH_LINE::MergeOverlap(), FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), DIALOG_GLOBAL_MODULES_FIELDS_EDITION::OnOKClick(), EDA_3D_CANVAS::OnPaint(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), DIALOG_PAD_PROPERTIES::OnPaintShowPanel(), KIGFX::WX_VIEW_CONTROLS::onTimer(), GERBVIEW_FRAME::OpenProjectFiles(), PNS::LINE_PLACER::optimizeTailHeadTransition(), MODULE::PadCoverageRatio(), PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE(), PARAM_CFG_INT::PARAM_CFG_INT(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), KIGFX::PREVIEW::MULTISTEP_GEOM_MANAGER::performStep(), SELECTION_TOOL::pickSmallestComponent(), BRDITEMS_PLOTTER::plotOneDrillMark(), Print_Module(), PCB_EDIT_FRAME::PrintPage(), PNS::SHOVE::processHullSet(), progress_subrange_start(), Project(), SHAPE_INDEX< T >::Query(), PNS::LINE::Rank(), PNS::OPTIMIZER::rectBreakouts(), C3D_RENDER_OGL_LEGACY::Redraw(), SHAPE_INDEX< T >::Reindex(), C3D_RENDER_RAYTRACING::reload(), SHAPE_INDEX< T >::Remove(), NETINFO_LIST::RemoveNet(), DIALOG_RESCUE_EACH::renderPreview(), DIALOG_CHOOSE_COMPONENT::RenderPreview(), C3D_RENDER_RAYTRACING::rt_render_post_process_blur_finish(), LIB_PART::SaveDateAndTime(), KIGFX::CAIRO_GAL::SetLineWidth(), BOX2< VECTOR2I >::SetMaximum(), D_PAD::SetRoundRectRadiusRatio(), INCREMENTAL_TEXT_CTRL::SetStep(), DIALOG_PLOT_SCHEMATIC::setupPlotPagePDF(), EDA_3D_CANVAS::SetView3D(), C3D_RENDER_RAYTRACING::shadeHit(), PNS::OPTIMIZER::smartPadsSingle(), PNS::LINE::snapDraggedCorner(), SEG::SquaredDistance(), PNS::DIFF_PAIR_PLACER::Start(), PNS_KICAD_IFACE::syncPad(), PLOTTER::Text(), KIGFX::COLOR4D::ToHSV(), WX_UNIT_TEXT::WX_UNIT_TEXT(), xor_path(), ZOOM_MENU::ZOOM_MENU(), and mpWindow::ZoomIn().

#define sign (   x)    ( (x)>0 ? 1 : (x)<0 ? -1 : 0 )

Definition at line 83 of file auxiliary.h.

#define sq (   a)    ( (a) * (a) )

Definition at line 87 of file auxiliary.h.

Referenced by adjust_vertices(), ddist(), opti_penalty(), and render_curveto().

Typedef Documentation

Definition at line 29 of file auxiliary.h.

typedef struct point_s point_t

Definition at line 27 of file auxiliary.h.

Function Documentation

static dpoint_t dpoint ( point_t  p)
inlinestatic

Definition at line 32 of file auxiliary.h.

References point_s::x, potrace_dpoint_s::x, point_s::y, and potrace_dpoint_s::y.

33 {
34  dpoint_t res;
35 
36  res.x = p.x;
37  res.y = p.y;
38  return res;
39 }
long y
Definition: auxiliary.h:25
long x
Definition: auxiliary.h:24
static int floordiv ( int  a,
int  n 
)
inlinestatic

Definition at line 70 of file auxiliary.h.

Referenced by calc_lon().

71 {
72  return a>=0 ? a / n : -1 - (-1 - a) / n;
73 }
static dpoint_t interval ( double  lambda,
dpoint_t  a,
dpoint_t  b 
)
inlinestatic

Definition at line 43 of file auxiliary.h.

References potrace_dpoint_s::x, and potrace_dpoint_s::y.

Referenced by opti_penalty(), opticurve(), and smooth().

44 {
45  dpoint_t res;
46 
47  res.x = a.x + lambda * (b.x - a.x);
48  res.y = a.y + lambda * (b.y - a.y);
49  return res;
50 }
static int mod ( int  a,
int  n 
)
inlinestatic

Definition at line 64 of file auxiliary.h.

65 {
66  return a>=n ? a % n : a>=0 ? a : n - 1 - (-1 - a) % n;
67 }