![]() |
KiCad PCB EDA Suite
|
Go to the source code of this file.
Functions | |
bool | IsPointOnSegment (const wxPoint &aSegStart, const wxPoint &aSegEnd, const wxPoint &aTestPoint) |
Test if aTestPoint is on line defined by aSegStart and aSegEnd. More... | |
bool | SegmentIntersectsSegment (const wxPoint &a_p1_l1, const wxPoint &a_p2_l1, const wxPoint &a_p1_l2, const wxPoint &a_p2_l2, wxPoint *aIntersectionPoint=nullptr) |
Test if two lines intersect. More... | |
void | RotatePoint (int *pX, int *pY, double angle) |
void | RotatePoint (int *pX, int *pY, int cx, int cy, double angle) |
void | RotatePoint (wxPoint *point, double angle) |
void | RotatePoint (VECTOR2I &point, double angle) |
void | RotatePoint (VECTOR2I &point, const VECTOR2I ¢re, double angle) |
void | RotatePoint (wxPoint *point, const wxPoint ¢re, double angle) |
void | RotatePoint (double *pX, double *pY, double angle) |
void | RotatePoint (double *pX, double *pY, double cx, double cy, double angle) |
const VECTOR2I | CalcArcCenter (const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd) |
Determine the center of an arc or circle given three points on its circumference. More... | |
const VECTOR2D | CalcArcCenter (const VECTOR2D &aStart, const VECTOR2D &aMid, const VECTOR2D &aEnd) |
const wxPoint | CalcArcCenter (const wxPoint &aStart, const wxPoint &aMid, const wxPoint &aEnd) |
const VECTOR2D | CalcArcCenter (const VECTOR2D &aStart, const VECTOR2D &aEnd, double aAngle) |
double | CalcArcAngle (const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd) |
Return the subtended angle for a given arc. More... | |
const VECTOR2I | CalcArcMid (const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, bool aMinArcAngle=true) |
Return the middle point of an arc, half-way between aStart and aEnd. More... | |
double | ArcTangente (int dy, int dx) |
double | EuclideanNorm (const wxPoint &vector) |
Euclidean norm of a 2D vector. More... | |
double | EuclideanNorm (const wxSize &vector) |
double | DistanceLinePoint (const wxPoint &linePointA, const wxPoint &linePointB, const wxPoint &referencePoint) |
Compute the distance between a line and a reference point Reference: http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html. More... | |
bool | HitTestPoints (const wxPoint &pointA, const wxPoint &pointB, double threshold) |
Test, if two points are near each other. More... | |
double | CrossProduct (const wxPoint &vectorA, const wxPoint &vectorB) |
Determine the cross product. More... | |
bool | TestSegmentHit (const wxPoint &aRefPoint, const wxPoint &aStart, const wxPoint &aEnd, int aDist) |
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd. More... | |
double | GetLineLength (const wxPoint &aPointA, const wxPoint &aPointB) |
Return the length of a line segment defined by aPointA and aPointB. More... | |
double | DEG2RAD (double deg) |
double | RAD2DEG (double rad) |
double | DECIDEG2RAD (double deg) |
double | RAD2DECIDEG (double rad) |
template<class T > | |
T | NormalizeAngle360Max (T Angle) |
Normalize angle to be >=-360.0 and <= 360.0 Angle can be equal to -360 or +360. More... | |
template<class T > | |
T | NormalizeAngle360Min (T Angle) |
Normalize angle to be > -360.0 and < 360.0 Angle equal to -360 or +360 are set to 0. More... | |
template<class T > | |
T | NormalizeAngleNeg (T Angle) |
Normalize angle to be in the 0.0 .. -360.0 range: angle is in 1/10 degrees. More... | |
template<class T > | |
T | NormalizeAnglePos (T Angle) |
Normalize angle to be in the 0.0 .. 360.0 range: angle is in 1/10 degrees. More... | |
template<class T > | |
void | NORMALIZE_ANGLE_POS (T &Angle) |
double | NormalizeAngleDegreesPos (double Angle) |
Normalize angle to be in the 0.0 .. 360.0 range: angle is in degrees. More... | |
void | NORMALIZE_ANGLE_DEGREES_POS (double &Angle) |
double | NormalizeAngleRadiansPos (double Angle) |
double | NormalizeAngleDegrees (double Angle, double aMin, double aMax) |
Normalize angle to be aMin < angle <= aMax angle is in degrees. More... | |
template<class T , class T2 > | |
T | AddAngles (T a1, T2 a2) |
Add two angles (keeping the result normalized). T2 is here. More... | |
template<class T > | |
T | NegateAndNormalizeAnglePos (T Angle) |
template<class T > | |
void | NEGATE_AND_NORMALIZE_ANGLE_POS (T &Angle) |
template<class T > | |
T | NormalizeAngle90 (T Angle) |
Normalize angle to be in the -90.0 .. 90.0 range. More... | |
template<class T > | |
void | NORMALIZE_ANGLE_90 (T &Angle) |
template<class T > | |
T | NormalizeAngle180 (T Angle) |
Normalize angle to be in the -180.0 .. 180.0 range. More... | |
template<class T > | |
void | NORMALIZE_ANGLE_180 (T &Angle) |
bool | InterceptsPositiveX (double aStartAngle, double aEndAngle) |
Test if an arc from aStartAngle to aEndAngle crosses the positive X axis (0 degrees). More... | |
bool | InterceptsNegativeX (double aStartAngle, double aEndAngle) |
Test if an arc from aStartAngle to aEndAngle crosses the negative X axis (180 degrees). More... | |
double | sindecideg (double r, double a) |
Circle generation utility: computes r * sin(a) Where a is in decidegrees, not in radians. More... | |
double | cosdecideg (double r, double a) |
Circle generation utility: computes r * cos(a) Where a is in decidegrees, not in radians. More... | |
|
inline |
Add two angles (keeping the result normalized). T2 is here.
Definition at line 341 of file trigo.h.
References NORMALIZE_ANGLE_POS().
Referenced by PSLIKE_PLOTTER::FlashPadOval(), HPGL_PLOTTER::FlashPadOval(), DXF_PLOTTER::FlashPadOval(), and PLOTTER::sketchOval().
double ArcTangente | ( | int | dy, |
int | dx | ||
) |
Definition at line 183 of file trigo.cpp.
References RAD2DECIDEG().
Referenced by BuildCornersList_S_Shape(), LIB_SHAPE::CalcArcAngles(), CalcArcMid(), EDA_SHAPE::calcEdit(), EDA_SHAPE::computeArcBBox(), AM_PRIMITIVE::ConvertShapeToPolygon(), AR_MATRIX::drawSegmentQcq(), fillArcPOLY(), PCB_ARC::GetAngle(), SCH_LINE::GetAngleFrom(), PCB_ARC::GetArcAngleEnd(), PCB_ARC::GetArcAngleStart(), SHAPE_ARC::GetCentralAngle(), CADSTAR_SCH_ARCHIVE_LOADER::getPolarAngle(), CADSTAR_PCB_ARCHIVE_LOADER::getPolarAngle(), SCH_LINE::GetReverseAngleFrom(), GRCSegm(), PCB_ARC::HitTest(), DSN::SPECCTRA_DB::makeIMAGE(), PCAD2KICAD::PCB_ARC::Parse(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotPcbShape(), PLOTTER::segmentAsOval(), SHAPE_ARC::SHAPE_ARC(), and AR_MATRIX::traceArc().
Return the subtended angle for a given arc.
Definition at line 567 of file trigo.cpp.
References PNS::angle(), VECTOR2< T >::Angle(), CalcArcCenter(), RAD2DECIDEG(), RotatePoint(), v2, VECTOR2< T >::x, and VECTOR2< T >::y.
const VECTOR2I CalcArcCenter | ( | const VECTOR2I & | aStart, |
const VECTOR2I & | aMid, | ||
const VECTOR2I & | aEnd | ||
) |
Determine the center of an arc or circle given three points on its circumference.
aStart | The starting point of the circle (equivalent to aEnd) |
aMid | The point on the arc, half-way between aStart and aEnd |
aEnd | The ending point of the circle (equivalent to aStart) |
Definition at line 525 of file trigo.cpp.
References CalcArcCenter(), KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by SHAPE_ARC::ConstructFromStartEndAngle(), SHAPE_ARC::GetCenter(), PCB_ARC::GetPosition(), PCB_ARC::GetRadius(), CONVERT_TOOL::SegmentToArc(), EDA_SHAPE::SetArcGeometry(), FP_SHAPE::SetArcGeometry0(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate().
const VECTOR2D CalcArcCenter | ( | const VECTOR2D & | aStart, |
const VECTOR2D & | aMid, | ||
const VECTOR2D & | aEnd | ||
) |
Definition at line 390 of file trigo.cpp.
References VECTOR2< T >::EuclideanNorm(), VECTOR2< T >::x, and VECTOR2< T >::y.
const wxPoint CalcArcCenter | ( | const wxPoint & | aStart, |
const wxPoint & | aMid, | ||
const wxPoint & | aEnd | ||
) |
Definition at line 546 of file trigo.cpp.
References CalcArcCenter(), KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.
Definition at line 362 of file trigo.cpp.
References EuclideanNorm(), r, VECTOR2< T >::Resize(), and VECTOR2< T >::Rotate().
Referenced by CalcArcAngle(), and CalcArcCenter().
const VECTOR2I CalcArcMid | ( | const VECTOR2I & | aStart, |
const VECTOR2I & | aEnd, | ||
const VECTOR2I & | aCenter, | ||
bool | aMinArcAngle = true |
||
) |
Return the middle point of an arc, half-way between aStart and aEnd.
There are two possible solutions which can be found by toggling aMinArcAngle. The behaviour is undefined for semicircles (i.e. 180 degree arcs).
aStart | The starting point of the arc (for calculating the radius) |
aEnd | The end point of the arc (for determining the arc angle) |
aCenter | The center point of the arc |
aMinArcAngle | If true, returns the point that results in the smallest arc angle. |
Definition at line 163 of file trigo.cpp.
References ArcTangente(), NormalizeAngle180(), RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by CIRCLE::ConstructFromTanTanPt(), EDIT_TOOL::DragArcTrack(), and SCH_EAGLE_PLUGIN::loadSymbolWire().
|
inline |
Circle generation utility: computes r * cos(a) Where a is in decidegrees, not in radians.
Definition at line 452 of file trigo.h.
References DECIDEG2RAD(), and r.
Referenced by HPGL_PLOTTER::Arc(), PLOTTER::Arc(), PDF_PLOTTER::Arc(), PCAD2KICAD::PCB_ARC::Parse(), GERBER_PLOTTER::plotArc(), GERBER_PLOTTER::plotRoundRectAsRegion(), AR_MATRIX::traceArc(), and AR_MATRIX::traceCircle().
|
inline |
|
inline |
Definition at line 233 of file trigo.h.
Referenced by SVG_PLOTTER::Arc(), PAD::BuildEffectiveShapes(), ZONE_FILLER::buildThermalSpokes(), PSLIKE_PLOTTER::computeTextParameters(), cosdecideg(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), GERBER_DRAW_ITEM::GetTextD_CodePrms(), EDA_SHAPE::hitTest(), EDA_SHAPE::MakeEffectiveShapes(), TRANSFORM::MapAngles(), EDA_SHAPE::rotate(), ZONE::Rotate(), RotatePoint(), FOOTPRINT::SetOrientation(), SHAPE_ARC::SHAPE_ARC(), sindecideg(), TransformRoundChamferedRectToPolygon(), PAD::TransformShapeWithClearanceToPolygon(), and TransformTrapezoidToPolygon().
|
inline |
Definition at line 229 of file trigo.h.
Referenced by GRAPHICS_IMPORTER_PCBNEW::AddArc(), PNS_LOG_VIEWER_OVERLAY::Arc(), PCB_GRID_HELPER::computeAnchors(), ConvertArcCenter(), KIGFX::PCB_PAINTER::draw(), ROUTER_PREVIEW_ITEM::drawLineChain(), ROUTER_PREVIEW_ITEM::drawShape(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), DIALOG_POSITION_RELATIVE::GetTranslationInIU(), DIALOG_MOVE_EXACT::GetTranslationInIU(), HelperShapeLineChainFromAltiumVertices(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), EAGLE_PLUGIN::loadPolygon(), EAGLE_PLUGIN::loadSignals(), DIALOG_POSITION_RELATIVE::OnPolarChanged(), DIALOG_MOVE_EXACT::OnPolarChanged(), EAGLE_PLUGIN::packagePolygon(), ALTIUM_PCB::ParseArcs6Data(), PCB_DIM_ALIGNED::PCB_DIM_ALIGNED(), PCB_DIM_ORTHOGONAL::PCB_DIM_ORTHOGONAL(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testShapeLineChain(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), PCB_DIM_CENTER::updateGeometry(), and PCB_DIM_ALIGNED::updateText().
|
inline |
Compute the distance between a line and a reference point Reference: http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html.
linePointA | Point on line |
linePointB | Point on line |
referencePoint | Reference point |
Definition at line 163 of file trigo.h.
References EuclideanNorm().
Referenced by EE_POINT_EDITOR::addCorner(), and EE_SELECTION_TOOL::GuessSelectionCandidates().
|
inline |
Euclidean norm of a 2D vector.
vector | Two-dimensional vector |
Definition at line 146 of file trigo.h.
Referenced by PCB_GRID_HELPER::AlignToArc(), PCB_GRID_HELPER::AlignToSegment(), EE_GRID_HELPER::BestSnapAnchor(), BOOST_AUTO_TEST_CASE(), BuildCornersList_S_Shape(), PNS::DP_GATEWAYS::buildDpContinuation(), PAD::BuildEffectivePolygon(), PNS::DP_GATEWAYS::BuildFromPrimitivePair(), PNS::DP_GATEWAYS::BuildGeneric(), PNS::DP_GATEWAYS::BuildOrthoProjections(), CalcArcCenter(), PNS::DRAGGER::checkVirtualVia(), EE_SELECTION_TOOL::CollectHits(), SHAPE_ARC::Collide(), collideArc2Arc(), PCB_GRID_HELPER::computeAnchors(), CIRCLE::ConstructFromTanTanPt(), CIRCLE::Contains(), AM_PRIMITIVE::ConvertShapeToPolygon(), MICROWAVE_TOOL::createMicrowaveInductor(), PNS::cursorDistMinimum(), PNS::DP_PRIMITIVE_PAIR::CursorOrientation(), CN_ANCHOR::Dist(), DistanceLinePoint(), EDIT_TOOL::DragArcTrack(), KIGFX::CAIRO_GAL_BASE::DrawSegment(), DRAWING_TOOL::DrawVia(), PCB_POINT_EDITOR::editArcMidKeepEndpoints(), PAD_TOOL::EnumeratePads(), extractDiffPairCoupledItems(), PNS::findCoupledVertices(), PNS::DIFF_PAIR_PLACER::FindDpPrimitivePair(), gen_arc(), PAD::GetBestAnchorPosition(), EE_SELECTION_TOOL::GetNode(), DS_DRAW_ITEM_LINE::GetSelectMenuText(), SCH_LINE::GetSelectMenuText(), BOARD::GetTrackLength(), EE_SELECTION_TOOL::GuessSelectionCandidates(), ALTIUM_PCB::HelperParseDimensions6Leader(), ALTIUM_PCB::HelperParseDimensions6Linear(), SCH_LINE::HitTest(), PCB_ARC::HitTest(), EDA_SHAPE::hitTest(), SHAPE_LINE_CHAIN::Intersect(), CIRCLE::IntersectLine(), GEOM_TEST::IsPointAtDistance(), PNS::makeGapVector(), PNS::MEANDERED_LINE::MeanderSegment(), LABEL_MANAGER::nearestBoxCorner(), PNS::TOPOLOGY::NearestUnconnectedItem(), VECTOR3< double >::Normalize(), SHAPE_LINE_CHAIN::compareOriginDistance::operator()(), compareOriginDistance::operator()(), GPCB_FPL_CACHE::parseFOOTPRINT(), SHAPE_LINE_CHAIN::PathLength(), pushoutForce(), PNS::DIFF_PAIR_PLACER::routeHead(), PLOTTER::segmentAsOval(), PNS::LINE::snapDraggedCorner(), PNS::DRAGGER::startDragSegment(), DRC_TEST_PROVIDER_HOLE_TO_HOLE::testHoleAgainstHole(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testShapeLineChain(), TransformOvalToPolygon(), PCB_POINT_EDITOR::updateItem(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate().
|
inline |
|
inline |
Return the length of a line segment defined by aPointA and aPointB.
See also EuclideanNorm and Distance for the single vector or four scalar versions.
Definition at line 222 of file trigo.h.
Referenced by EDA_SHAPE::calcEdit(), EDIT_TOOL::DragArcTrack(), KIGFX::GERBVIEW_PAINTER::draw(), FootprintWriteShape(), GERBER_DRAW_ITEM::GetBoundingBox(), PCB_TRACK::GetLength(), SCH_LINE::GetLength(), EDA_SHAPE::GetLength(), getMinDist(), EDA_SHAPE::GetRadius(), PCB_ARC::GetRadius(), HelperShapeLineChainFromAltiumVertices(), GERBER_DRAW_ITEM::HitTest(), PCB_TRACK::IsPointOnEnds(), EAGLE_PLUGIN::loadPlain(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), GERBER_DRAW_ITEM::Print(), EDA_SHAPE::ShapeGetMsgPanelInfo(), and GERBER_DRAW_ITEM::ViewGetLOD().
|
inline |
Test, if two points are near each other.
pointA | First point |
pointB | Second point |
threshold | The maximum distance |
Definition at line 184 of file trigo.h.
Referenced by GERBER_DRAW_ITEM::HitTest(), and EE_SELECTION_TOOL::narrowSelection().
|
inline |
Test if an arc from aStartAngle to aEndAngle crosses the negative X axis (180 degrees).
Testing is performed in the quadrant 1 to quadrant 4 direction (counter-clockwise).
aStartAngle | The arc start angle in degrees. |
aEndAngle | The arc end angle in degrees. |
Definition at line 429 of file trigo.h.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Test if an arc from aStartAngle to aEndAngle crosses the positive X axis (0 degrees).
Testing is performed in the quadrant 1 to quadrant 4 direction (counter-clockwise).
aStartAngle | The arc start angle in degrees. |
aEndAngle | The arc end angle in degrees. |
Definition at line 411 of file trigo.h.
Referenced by BOOST_AUTO_TEST_CASE().
bool IsPointOnSegment | ( | const wxPoint & | aSegStart, |
const wxPoint & | aSegEnd, | ||
const wxPoint & | aTestPoint | ||
) |
Test if aTestPoint is on line defined by aSegStart and aSegEnd.
This function is faster than TestSegmentHit() because aTestPoint should be exactly on the line. This works fine only for H, V and 45 degree line segments.
aSegStart | The first point of the line segment. |
aSegEnd | The second point of the line segment. |
aTestPoint | The point to test. |
Definition at line 42 of file trigo.cpp.
Referenced by SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), SCH_EDIT_FRAME::BreakSegments(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires(), SCH_EDIT_FRAME::TrimWire(), SCH_BUS_WIRE_ENTRY::UpdateDanglingState(), and SCH_BUS_BUS_ENTRY::UpdateDanglingState().
|
inline |
Definition at line 362 of file trigo.h.
References NegateAndNormalizeAnglePos().
Referenced by CreateComponentsSection().
|
inline |
|
inline |
Definition at line 398 of file trigo.h.
References NormalizeAngle180().
Referenced by HPGL_PLOTTER::Arc(), FOOTPRINT::Flip(), CADSTAR_PCB_ARCHIVE_LOADER::loadComponents(), and FOOTPRINT::SetOrientation().
|
inline |
Definition at line 380 of file trigo.h.
References NormalizeAngle90().
Referenced by GERBER_DRAW_ITEM::GetTextD_CodePrms().
|
inline |
Definition at line 309 of file trigo.h.
References NormalizeAngleDegreesPos().
Referenced by DSN::SPECCTRA_DB::FromBOARD(), and DSN::SPECCTRA_DB::makeIMAGE().
|
inline |
Definition at line 290 of file trigo.h.
References NormalizeAnglePos().
Referenced by AddAngles(), LIB_SHAPE::CalcArcAngles(), EDA_SHAPE::calcEdit(), CreateShapesSection(), FP_TEXT::GetDrawRotation(), PCB_ARC::HitTest(), FP_TEXT::KeepUpright(), SCH_LEGACY_PLUGIN_CACHE::loadArc(), DSN::SPECCTRA_DB::makeIMAGE(), TRANSFORM::MapAngles(), PCAD2KICAD::PCB_ARC::Parse(), SCH_SEXPR_PARSER::parseArc(), RotatePoint(), PAD::SetOrientation(), AR_MATRIX::traceArc(), and PCB_DIM_ALIGNED::updateText().
|
inline |
Normalize angle to be in the -180.0 .. 180.0 range.
Definition at line 387 of file trigo.h.
Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), SEG::AngleDegrees(), CalcArcMid(), CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins(), PCB_ARC::GetAngle(), SHAPE_ARC::GetCentralAngle(), CADSTAR_SCH_ARCHIVE_LOADER::getComponentOrientation(), CADSTAR_SCH_ARCHIVE_LOADER::getSpinStyleDeciDeg(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(), NORMALIZE_ANGLE_180(), LIB_SHAPE::print(), and SHAPE_ARC::SHAPE_ARC().
|
inline |
Normalize angle to be >=-360.0 and <= 360.0 Angle can be equal to -360 or +360.
Definition at line 241 of file trigo.h.
Referenced by EDA_SHAPE::SetArcAngleAndEnd(), and FP_SHAPE::SetArcAngleAndEnd0().
|
inline |
Normalize angle to be > -360.0 and < 360.0 Angle equal to -360 or +360 are set to 0.
Definition at line 254 of file trigo.h.
Referenced by PCB_PLUGIN::format(), PAD::Rotate(), PCB_TEXT::SetTextAngle(), FP_TEXT::SetTextAngle(), and DS_DRAW_ITEM_TEXT::SetTextAngle().
|
inline |
Normalize angle to be in the -90.0 .. 90.0 range.
Definition at line 369 of file trigo.h.
Referenced by NORMALIZE_ANGLE_90().
|
inline |
Normalize angle to be aMin < angle <= aMax angle is in degrees.
Definition at line 327 of file trigo.h.
Referenced by EDA_SHAPE::CalcArcAngles(), EDA_SHAPE::computeArcBBox(), SHAPE_ARC::GetEndAngle(), PAD::GetMsgPanelInfo(), SHAPE_ARC::GetStartAngle(), EDA_SHAPE::hitTest(), and ALTIUM_PCB::ParseComponentsBodies6Data().
|
inline |
Normalize angle to be in the 0.0 .. 360.0 range: angle is in degrees.
Definition at line 297 of file trigo.h.
Referenced by SHAPE_ARC::Collide(), HelperShapeLineChainFromAltiumVertices(), NORMALIZE_ANGLE_DEGREES_POS(), ALTIUM_PCB::ParseArcs6Data(), and ALTIUM_PCB::ParsePads6Data().
|
inline |
Normalize angle to be in the 0.0 .. -360.0 range: angle is in 1/10 degrees.
Definition at line 268 of file trigo.h.
Referenced by SHAPE_ARC::ConstructFromStartEndCenter(), CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex(), and CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices().
|
inline |
Normalize angle to be in the 0.0 .. 360.0 range: angle is in 1/10 degrees.
Definition at line 281 of file trigo.h.
Referenced by CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), EDA_SHAPE::computeArcBBox(), SHAPE_ARC::ConstructFromStartEndCenter(), PCB_PLUGIN::format(), PCB_ARC::GetArcAngleEnd(), PCB_ARC::GetArcAngleStart(), CADSTAR_SCH_ARCHIVE_LOADER::getPolarAngle(), CADSTAR_PCB_ARCHIVE_LOADER::getPolarAngle(), CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex(), FP_TEXT_GRID_TABLE::GetValue(), CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices(), NORMALIZE_ANGLE_POS(), and FABMASTER::processArc().
|
inline |
|
inline |
Definition at line 234 of file trigo.h.
Referenced by SEG::AngleDegrees(), ArcTangente(), KIGFX::SCH_PAINTER::boxText(), CalcArcAngle(), EDA_SHAPE::computeArcBBox(), SHAPE_ARC::ConstructFromStartEndCenter(), AM_PRIMITIVE::ConvertShapeToPolygon(), CornerListToPolygon(), drawCursorStrings(), GBR_TO_PCB_EXPORTER::export_segarc_copper_item(), getNormDeciDegFromRad(), GERBER_DRAW_ITEM::GetTextD_CodePrms(), TRANSFORM::MapAngles(), GPCB_FPL_CACHE::parseFOOTPRINT(), FABMASTER::processArc(), and PCB_DIM_ALIGNED::updateText().
|
inline |
Definition at line 230 of file trigo.h.
Referenced by SHAPE_ARC::Collide(), GBR_TO_PCB_EXPORTER::export_non_copper_item(), CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins(), DXF_IMPORT_PLUGIN::insertArc(), EDA_SHAPE::ShapeGetMsgPanelInfo(), DIALOG_POSITION_RELATIVE::ToPolarDeg(), DIALOG_MOVE_EXACT::ToPolarDeg(), GERBVIEW_FRAME::UpdateStatusBar(), and PCB_BASE_FRAME::UpdateStatusBar().
void RotatePoint | ( | int * | pX, |
int * | pY, | ||
double | angle | ||
) |
Definition at line 229 of file trigo.cpp.
References PNS::angle(), DECIDEG2RAD(), KiROUND(), and NORMALIZE_ANGLE_POS().
Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToFootprint(), CADSTAR_SCH_ARCHIVE_LOADER::applyTransform(), SVG_PLOTTER::Arc(), BuildConvexHull(), BuildCornersList_S_Shape(), PAD::BuildEffectiveShapes(), CalcArcAngle(), CalcArcMid(), EDA_SHAPE::calcEdit(), PSLIKE_PLOTTER::computeTextParameters(), SHAPE_ARC::ConstructFromStartEndAngle(), SHAPE_ARC::ConstructFromStartEndCenter(), ConvertOutlineToPolygon(), AM_PRIMITIVE::ConvertShapeToPolygon(), D_CODE::ConvertShapeToPolygon(), CornerListToPolygon(), PCAD2KICAD::CorrectTextPosition(), EXCELLON_WRITER::createDrillFile(), MICROWAVE_TOOL::createFootprint(), SCH_GLOBALLABEL::CreateGraphicShape(), AM_PRIMITIVE::DrawBasicShape(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DrawHalfOpenCylinder(), AR_MATRIX::drawSegmentQcq(), GBR_TO_PCB_EXPORTER::export_segarc_copper_item(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), fillArcPOLY(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), GERBER_PLOTTER::FlashPadChamferRoundRect(), GERBER_PLOTTER::FlashPadCustom(), PSLIKE_PLOTTER::FlashPadOval(), HPGL_PLOTTER::FlashPadOval(), PSLIKE_PLOTTER::FlashPadRect(), HPGL_PLOTTER::FlashPadRect(), DXF_PLOTTER::FlashPadRect(), PSLIKE_PLOTTER::FlashPadTrapez(), GERBER_PLOTTER::FlashPadTrapez(), HPGL_PLOTTER::FlashPadTrapez(), DXF_PLOTTER::FlashPadTrapez(), GERBER_PLOTTER::FlashRegularPolygon(), geom_transf(), GERBER_DRAW_ITEM::GetABPosition(), CN_ITEM::GetAnchor(), EDA_SHAPE::GetArcMid(), FP_SHAPE::GetArcMid0(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), LIB_PIN::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), EDA_SHAPE::getBoundingBox(), SCH_LABEL::GetBoundingBox(), EDA_RECT::GetBoundingBoxRotated(), DS_DATA_ITEM_POLYGONS::GetCornerPosition(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad(), EDA_TEXT::GetLinePositions(), CADSTAR_SCH_ARCHIVE_LOADER::getLocationOfNetElement(), EDA_SHAPE::GetRectCorners(), ARRAY_CIRCULAR_OPTIONS::GetTransform(), GERBER_DRAW_ITEM::GetXYPosition(), GRArc(), GRCSegm(), ALTIUM_PCB::HelperParseDimensions6Center(), ALTIUM_PCB::HelperParseDimensions6Leader(), idf_export_footprint(), RENDER_3D_RAYTRACE::insertHole(), EDA_RECT::Intersects(), SCH_LEGACY_PLUGIN_CACHE::loadArc(), LEGACY_PLUGIN::loadPAD(), EAGLE_PLUGIN::loadPlain(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_EAGLE_PLUGIN::loadSymbolRectangle(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), FOOTPRINT::MoveAnchorPosition(), EAGLE_PLUGIN::packageCircle(), SCH_ALTIUM_PLUGIN::ParseArc(), ALTIUM_PCB::ParseComponentsBodies6Data(), GPCB_FPL_CACHE::parseFOOTPRINT(), PCB_PARSER::parseFOOTPRINT_unchecked(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), GERBER_PLOTTER::plotRoundRectAsRegion(), FABMASTER::processArc(), PCB_TARGET::Rotate(), SCH_JUNCTION::Rotate(), SCH_NO_CONNECT::Rotate(), PCB_TRACK::Rotate(), PCB_TEXT::Rotate(), LIB_TEXT::Rotate(), SCH_BUS_ENTRY_BASE::Rotate(), FP_TEXT::Rotate(), SCH_BITMAP::Rotate(), LIB_FIELD::Rotate(), SCH_FIELD::Rotate(), SCH_SHEET_PIN::Rotate(), SCH_LINE::Rotate(), SCH_TEXT::Rotate(), LIB_PIN::Rotate(), PCB_DIMENSION_BASE::Rotate(), FOOTPRINT::Rotate(), PCB_ARC::Rotate(), EDA_SHAPE::rotate(), SCH_SHEET::Rotate(), SCH_GLOBALLABEL::Rotate(), ZONE::Rotate(), SCH_SYMBOL::Rotate(), PAD::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_LINE::RotateEnd(), RotatePoint(), SCH_LINE::RotateStart(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run(), EDA_SHAPE::SetArcAngleAndEnd(), FP_SHAPE::SetArcAngleAndEnd0(), DS_DATA_ITEM_POLYGONS::SetBoundingBox(), FP_SHAPE::SetDrawCoord(), FP_TEXT::SetDrawCoord(), PAD::SetDrawCoord(), FP_SHAPE::SetLocalCoord(), FP_TEXT::SetLocalCoord(), PAD::SetLocalCoord(), SHAPE_ARC::SHAPE_ARC(), PAD::ShapePos(), PLOTTER::sketchOval(), PNS_KICAD_IFACE_BASE::syncPad(), FP_TEXT::TextHitTest(), EDA_TEXT::TextHitTest(), AR_MATRIX::TraceFilledRectangle(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), EAGLE_PLUGIN::transferPad(), BOARD_ADAPTER::transformArcToSegments(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), TransformCircleToPolygon(), TransformOvalToPolygon(), EDA_SHAPE::TransformShapeWithClearanceToPolygon(), PAD::TransformShapeWithClearanceToPolygon(), PCB_POINT_EDITOR::updateItem(), and GERBER_PLOTTER::writeApertureList().
void RotatePoint | ( | int * | pX, |
int * | pY, | ||
int | cx, | ||
int | cy, | ||
double | angle | ||
) |
Definition at line 269 of file trigo.cpp.
References PNS::angle(), and RotatePoint().
|
inline |
Definition at line 80 of file trigo.h.
References PNS::angle(), and RotatePoint().
|
inline |
Definition at line 85 of file trigo.h.
References PNS::angle(), RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.
Definition at line 295 of file trigo.cpp.
References PNS::angle(), RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.
void RotatePoint | ( | wxPoint * | point, |
const wxPoint & | centre, | ||
double | angle | ||
) |
Definition at line 283 of file trigo.cpp.
References PNS::angle(), and RotatePoint().
void RotatePoint | ( | double * | pX, |
double * | pY, | ||
double | angle | ||
) |
Definition at line 321 of file trigo.cpp.
References PNS::angle(), DECIDEG2RAD(), and NORMALIZE_ANGLE_POS().
void RotatePoint | ( | double * | pX, |
double * | pY, | ||
double | cx, | ||
double | cy, | ||
double | angle | ||
) |
Definition at line 307 of file trigo.cpp.
References PNS::angle(), and RotatePoint().
bool SegmentIntersectsSegment | ( | const wxPoint & | a_p1_l1, |
const wxPoint & | a_p2_l1, | ||
const wxPoint & | a_p1_l2, | ||
const wxPoint & | a_p2_l2, | ||
wxPoint * | aIntersectionPoint = nullptr |
||
) |
Test if two lines intersect.
a_p1_l1 | The first point of the first line. |
a_p2_l1 | The second point of the first line. |
a_p1_l2 | The first point of the second line. |
a_p2_l2 | The second point of the second line. |
aIntersectionPoint | is filled with the intersection point if it exists |
Definition at line 61 of file trigo.cpp.
References KiROUND().
Referenced by EDA_RECT::Intersects().
|
inline |
Circle generation utility: computes r * sin(a) Where a is in decidegrees, not in radians.
Definition at line 443 of file trigo.h.
References DECIDEG2RAD(), and r.
Referenced by HPGL_PLOTTER::Arc(), PLOTTER::Arc(), PDF_PLOTTER::Arc(), PCAD2KICAD::PCB_ARC::Parse(), GERBER_PLOTTER::plotArc(), GERBER_PLOTTER::plotRoundRectAsRegion(), and AR_MATRIX::traceCircle().
bool TestSegmentHit | ( | const wxPoint & | aRefPoint, |
const wxPoint & | aStart, | ||
const wxPoint & | aEnd, | ||
int | aDist | ||
) |
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
aRefPoint | = reference point to test |
aStart | is the first end-point of the line segment |
aEnd | is the second end-point of the line segment |
aDist | = maximum distance for hit |
Definition at line 129 of file trigo.cpp.
References delta, SEG::Square(), and SEG::SquaredDistance().
Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), EE_GRID_HELPER::computeAnchors(), DRAWING_TOOL::DrawVia(), SCH_BUS_ENTRY_BASE::HitTest(), DS_DRAW_ITEM_LINE::HitTest(), PCB_TRACK::HitTest(), GERBER_DRAW_ITEM::HitTest(), DS_DRAW_ITEM_RECT::HitTest(), SCH_LINE::HitTest(), EDA_SHAPE::hitTest(), SCH_EAGLE_PLUGIN::moveLabels(), and SCH_TEXT::UpdateDanglingState().