![]() |
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 | GetArcCenter (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 | GetArcCenter (const VECTOR2D &aStart, const VECTOR2D &aMid, const VECTOR2D &aEnd) |
const wxPoint | GetArcCenter (const wxPoint &aStart, const wxPoint &aMid, const wxPoint &aEnd) |
const wxPoint | GetArcCenter (VECTOR2I aStart, VECTOR2I aEnd, double aAngle) |
double | GetArcAngle (const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd) |
Returns the subtended angle for a given arc. More... | |
const VECTOR2I | GetArcMid (const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, bool aMinArcAngle=true) |
Returns 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, wxPoint aStart, 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 . More... | |
template<class T > | |
T | NormalizeAnglePos (T Angle) |
Normalize angle to be in the 0.0 . More... | |
template<class T > | |
void | NORMALIZE_ANGLE_POS (T &Angle) |
double | NormalizeAngleDegreesPos (double Angle) |
Normalize angle to be in the 0.0 . 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 335 of file trigo.h.
References NORMALIZE_ANGLE_POS().
Referenced by PSLIKE_PLOTTER::FlashPadOval(), DXF_PLOTTER::FlashPadOval(), HPGL_PLOTTER::FlashPadOval(), and PLOTTER::sketchOval().
double ArcTangente | ( | int | dy, |
int | dx | ||
) |
Definition at line 182 of file trigo.cpp.
References RAD2DECIDEG().
Referenced by BuildCornersList_S_Shape(), LIB_ARC::CalcEdit(), LIB_ARC::CalcRadiusAngles(), AM_PRIMITIVE::ConvertShapeToPolygon(), AR_MATRIX::drawSegmentQcq(), fillArcPOLY(), ARC::GetAngle(), SCH_LINE::GetAngleFrom(), PCB_SHAPE::GetArcAngleEnd(), ARC::GetArcAngleEnd(), PCB_SHAPE::GetArcAngleStart(), ARC::GetArcAngleStart(), GetArcMid(), SHAPE_ARC::GetCentralAngle(), CADSTAR_SCH_ARCHIVE_LOADER::getPolarAngle(), CADSTAR_PCB_ARCHIVE_LOADER::getPolarAngle(), SCH_LINE::GetReverseAngleFrom(), GRCSegm(), PCB_SHAPE::HitTest(), ARC::HitTest(), PCAD2KICAD::PCB_ARC::Parse(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotPcbShape(), PLOTTER::segmentAsOval(), SHAPE_ARC::SHAPE_ARC(), and AR_MATRIX::traceArc().
|
inline |
Circle generation utility: computes r * cos(a) Where a is in decidegrees, not in radians.
Definition at line 439 of file trigo.h.
References DECIDEG2RAD().
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 |
Determine the cross product.
vectorA | Two-dimensional vector |
vectorB | Two-dimensional vector |
Definition at line 200 of file trigo.h.
Referenced by LIB_ARC::HitTest().
|
inline |
Definition at line 235 of file trigo.h.
Referenced by SVG_PLOTTER::Arc(), PAD::BuildEffectiveShapes(), ZONE_FILLER::buildThermalSpokes(), PSLIKE_PLOTTER::computeTextParameters(), cosdecideg(), KIGFX::PCB_PAINTER::draw(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), GERBER_DRAW_ITEM::GetTextD_CodePrms(), TRANSFORM::MapAngles(), PCB_SHAPE::Rotate(), ZONE::Rotate(), RotatePoint(), FOOTPRINT::SetOrientation(), SHAPE_ARC::SHAPE_ARC(), sindecideg(), TransformRoundChamferedRectToPolygon(), and PAD::TransformShapeWithClearanceToPolygon().
|
inline |
Definition at line 231 of file trigo.h.
Referenced by ALIGNED_DIMENSION::ALIGNED_DIMENSION(), BOOST_AUTO_TEST_CASE(), LIB_ARC::CalcMidPoint(), PCB_GRID_HELPER::computeAnchors(), ConvertArcCenter(), ROUTER_PREVIEW_ITEM::drawLineChain(), ROUTER_PREVIEW_ITEM::drawShape(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), DIALOG_POSITION_RELATIVE::GetTranslationInIU(), DIALOG_MOVE_EXACT::GetTranslationInIU(), ALTIUM_PCB::HelperCreateBoardOutline(), HelperShapeLineChainFromAltiumVertices(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), EAGLE_PLUGIN::loadPolygon(), EAGLE_PLUGIN::loadSignals(), DIALOG_POSITION_RELATIVE::OnPolarChanged(), DIALOG_MOVE_EXACT::OnPolarChanged(), ORTHOGONAL_DIMENSION::ORTHOGONAL_DIMENSION(), EAGLE_PLUGIN::packagePolygon(), ALTIUM_PCB::ParseArcs6Data(), ALIGNED_DIMENSION::updateGeometry(), ORTHOGONAL_DIMENSION::updateGeometry(), LEADER::updateGeometry(), CENTER_DIMENSION::updateGeometry(), and ALIGNED_DIMENSION::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 165 of file trigo.h.
References EuclideanNorm().
Referenced by LIB_POLYLINE::AddCorner().
|
inline |
Euclidean norm of a 2D vector.
vector | Two-dimensional vector |
Definition at line 148 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(), LIB_ARC::CalcRadiusAngles(), SHAPE_ARC::Collide(), PCB_GRID_HELPER::computeAnchors(), CIRCLE::ConstructFromTanTanPt(), AM_PRIMITIVE::ConvertShapeToPolygon(), MICROWAVE_TOOL::createMicrowaveInductor(), 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(), GetArcCenter(), PAD::GetBestAnchorPosition(), DS_DRAW_ITEM_LINE::GetSelectMenuText(), SCH_LINE::GetSelectMenuText(), BOARD::GetTrackLength(), EE_SELECTION_TOOL::GuessSelectionCandidates(), ALTIUM_PCB::HelperParseDimensions6Leader(), ALTIUM_PCB::HelperParseDimensions6Linear(), PCB_SHAPE::HitTest(), ARC::HitTest(), CIRCLE::IntersectLine(), GEOM_TEST::IsPointAtDistance(), PNS::makeGapVector(), PNS::MEANDERED_LINE::MeanderSegment(), 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_CLEARANCE::testHoleAgainstHole(), TransformOvalToPolygon(), and PCB_POINT_EDITOR::updateItem().
|
inline |
Returns the subtended angle for a given arc.
Definition at line 492 of file trigo.cpp.
References PNS::angle(), VECTOR2< T >::Angle(), GetArcCenter(), RAD2DECIDEG(), RotatePoint(), v2, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by CONVERT_TOOL::SegmentToArc().
const VECTOR2I GetArcCenter | ( | 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 450 of file trigo.cpp.
References GetArcCenter(), KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by SHAPE_ARC::ConstructFromStartEndAngle(), SHAPE_ARC::GetCenter(), ARC::GetPosition(), ARC::GetRadius(), SCH_SEXPR_PARSER::parseArc(), CONVERT_TOOL::SegmentToArc(), PCB_SHAPE::SetArcGeometry(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow().
const VECTOR2D GetArcCenter | ( | const VECTOR2D & | aStart, |
const VECTOR2D & | aMid, | ||
const VECTOR2D & | aEnd | ||
) |
const wxPoint GetArcCenter | ( | const wxPoint & | aStart, |
const wxPoint & | aMid, | ||
const wxPoint & | aEnd | ||
) |
Definition at line 471 of file trigo.cpp.
References GetArcCenter(), KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.
Definition at line 361 of file trigo.cpp.
References EuclideanNorm(), VECTOR2< T >::Resize(), and VECTOR2< T >::Rotate().
Referenced by GetArcAngle(), and GetArcCenter().
const VECTOR2I GetArcMid | ( | const VECTOR2I & | aStart, |
const VECTOR2I & | aEnd, | ||
const VECTOR2I & | aCenter, | ||
bool | aMinArcAngle = true |
||
) |
Returns 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 162 of file trigo.cpp.
References ArcTangente(), NormalizeAngle180(), RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by CIRCLE::ConstructFromTanTanPt(), and EDIT_TOOL::DragArcTrack().
|
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 223 of file trigo.h.
Referenced by LIB_ARC::CalcEdit(), EDIT_TOOL::DragArcTrack(), KIGFX::GERBVIEW_PAINTER::draw(), FootprintWriteShape(), GERBER_DRAW_ITEM::GetBoundingBox(), TRACK::GetLength(), SCH_LINE::GetLength(), PCB_SHAPE::GetLength(), PCB_SHAPE::GetMsgPanelInfo(), LIB_CIRCLE::GetRadius(), PCB_SHAPE::GetRadius(), ARC::GetRadius(), ALTIUM_PCB::HelperCreateBoardOutline(), HelperShapeLineChainFromAltiumVertices(), LIB_CIRCLE::HitTest(), LIB_ARC::HitTest(), GERBER_DRAW_ITEM::HitTest(), TRACK::IsPointOnEnds(), DSN::SPECCTRA_DB::makeIMAGE(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotPcbShape(), GERBER_DRAW_ITEM::Print(), 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 186 of file trigo.h.
Referenced by LIB_ARC::HitTest(), 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 416 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 398 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_EDIT_FRAME::TrimWire(), SCH_BUS_WIRE_ENTRY::UpdateDanglingState(), and SCH_BUS_BUS_ENTRY::UpdateDanglingState().
|
inline |
Definition at line 353 of file trigo.h.
References NegateAndNormalizeAnglePos().
Referenced by CreateComponentsSection().
|
inline |
|
inline |
Definition at line 385 of file trigo.h.
References NormalizeAngle180().
Referenced by HPGL_PLOTTER::Arc(), FOOTPRINT::Flip(), DIALOG_PAD_PROPERTIES::initValues(), CADSTAR_PCB_ARCHIVE_LOADER::loadComponents(), and FOOTPRINT::SetOrientation().
|
inline |
Definition at line 369 of file trigo.h.
References NormalizeAngle90().
Referenced by GERBER_DRAW_ITEM::GetTextD_CodePrms().
|
inline |
Definition at line 306 of file trigo.h.
References NormalizeAngleDegreesPos().
Referenced by DSN::SPECCTRA_DB::FromBOARD(), and DSN::SPECCTRA_DB::makeIMAGE().
|
inline |
Definition at line 288 of file trigo.h.
References NormalizeAnglePos().
Referenced by AddAngles(), LIB_ARC::CalcEdit(), LIB_ARC::CalcRadiusAngles(), CreateShapesSection(), PCB_SHAPE::GetArcAngleEnd(), PCB_SHAPE::GetArcAngleStart(), FP_TEXT::GetDrawRotation(), PCB_SHAPE::HitTest(), 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 ALIGNED_DIMENSION::updateText().
|
inline |
Normalize angle to be in the -180.0 .. 180.0 range.
Definition at line 376 of file trigo.h.
Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), SEG::AngleDegrees(), ARC::GetAngle(), GetArcMid(), SHAPE_ARC::GetCentralAngle(), CADSTAR_SCH_ARCHIVE_LOADER::getComponentOrientation(), CADSTAR_SCH_ARCHIVE_LOADER::getSpinStyleDeciDeg(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), NORMALIZE_ANGLE_180(), 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 243 of file trigo.h.
Referenced by PCB_SHAPE::SetAngle().
|
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_IO::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 360 of file trigo.h.
Referenced by NORMALIZE_ANGLE_90().
|
inline |
Normalize angle to be aMin < angle <= aMax angle is in degrees.
Definition at line 323 of file trigo.h.
Referenced by SHAPE_ARC::GetEndAngle(), PAD::GetMsgPanelInfo(), SHAPE_ARC::GetStartAngle(), and ALTIUM_PCB::ParseComponentsBodies6Data().
|
inline |
Normalize angle to be in the 0.0 .
. 360.0 range: angle is in degrees
Definition at line 296 of file trigo.h.
Referenced by SHAPE_ARC::Collide(), ALTIUM_PCB::HelperCreateBoardOutline(), 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 267 of file trigo.h.
Referenced by CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex(), 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 279 of file trigo.h.
Referenced by CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), PCB_IO::format(), ARC::GetArcAngleEnd(), ARC::GetArcAngleStart(), CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex(), CADSTAR_SCH_ARCHIVE_LOADER::getPolarAngle(), CADSTAR_PCB_ARCHIVE_LOADER::getPolarAngle(), FP_TEXT_GRID_TABLE::GetValue(), CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute(), NORMALIZE_ANGLE_POS(), and FABMASTER::processArc().
|
inline |
|
inline |
Definition at line 236 of file trigo.h.
Referenced by SEG::AngleDegrees(), ArcTangente(), AM_PRIMITIVE::ConvertShapeToPolygon(), drawCursorStrings(), PCB_POINT_EDITOR::editArcEndpointKeepCenter(), PCB_POINT_EDITOR::editArcEndpointKeepTangent(), GBR_TO_PCB_EXPORTER::export_segarc_copper_item(), GetArcAngle(), getNormDeciDegFromRad(), GERBER_DRAW_ITEM::GetTextD_CodePrms(), TRANSFORM::MapAngles(), GPCB_FPL_CACHE::parseFOOTPRINT(), FABMASTER::processArc(), PCB_SHAPE::SetArcGeometry(), updateArcFromConstructionMgr(), and ALIGNED_DIMENSION::updateText().
|
inline |
Definition at line 232 of file trigo.h.
Referenced by SHAPE_ARC::Collide(), GBR_TO_PCB_EXPORTER::export_non_copper_item(), PCB_SHAPE::GetMsgPanelInfo(), DXF_IMPORT_PLUGIN::insertArc(), 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 228 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(), LIB_ARC::CalcEdit(), PCB_SHAPE::computeArcBBox(), PSLIKE_PLOTTER::computeTextParameters(), SHAPE_ARC::ConstructFromStartEndAngle(), ConvertOutlineToPolygon(), AM_PRIMITIVE::ConvertShapeToPolygon(), D_CODE::ConvertShapeToPolygon(), 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(), DXF_PLOTTER::FlashPadRect(), HPGL_PLOTTER::FlashPadRect(), PSLIKE_PLOTTER::FlashPadTrapez(), DXF_PLOTTER::FlashPadTrapez(), HPGL_PLOTTER::FlashPadTrapez(), GERBER_PLOTTER::FlashPadTrapez(), GERBER_PLOTTER::FlashRegularPolygon(), FootprintWriteShape(), geom_transf(), GERBER_DRAW_ITEM::GetABPosition(), CN_ITEM::GetAnchor(), GetArcAngle(), GetArcMid(), PCB_SHAPE::GetArcMid(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), LIB_FIELD::GetBoundingBox(), LIB_PIN::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), PCB_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(), PCB_SHAPE::GetRectCorners(), ARRAY_CIRCULAR_OPTIONS::GetTransform(), GERBER_DRAW_ITEM::GetXYPosition(), GRArc(), GRCSegm(), GRFilledArc(), 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(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary(), FOOTPRINT::MoveAnchorPosition(), EAGLE_PLUGIN::packageCircle(), ALTIUM_PCB::ParseComponentsBodies6Data(), GPCB_FPL_CACHE::parseFOOTPRINT(), PCB_PARSER::parseFOOTPRINT_unchecked(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), GERBER_PLOTTER::plotRoundRectAsRegion(), FABMASTER::processArc(), SCH_JUNCTION::Rotate(), LIB_RECTANGLE::Rotate(), LIB_ARC::Rotate(), LIB_CIRCLE::Rotate(), LIB_BEZIER::Rotate(), PCB_TARGET::Rotate(), SCH_NO_CONNECT::Rotate(), PCB_TEXT::Rotate(), LIB_POLYLINE::Rotate(), SCH_BUS_ENTRY_BASE::Rotate(), LIB_TEXT::Rotate(), TRACK::Rotate(), FP_TEXT::Rotate(), SCH_BITMAP::Rotate(), SCH_FIELD::Rotate(), SCH_SHEET_PIN::Rotate(), SCH_LINE::Rotate(), LIB_FIELD::Rotate(), LIB_PIN::Rotate(), DIMENSION_BASE::Rotate(), FOOTPRINT::Rotate(), SCH_TEXT::Rotate(), ARC::Rotate(), PCB_SHAPE::Rotate(), SCH_SHEET::Rotate(), SCH_GLOBALLABEL::Rotate(), ZONE::Rotate(), SCH_COMPONENT::Rotate(), PAD::Rotate(), SCH_GLOBALLABEL::Rotate90(), SCH_LINE::RotateEnd(), RotatePoint(), SCH_LINE::RotateStart(), FP_SHAPE::SetAngle(), PCB_SHAPE::SetAngle(), 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(), TransformRoundRectToPolygon(), PCB_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 268 of file trigo.cpp.
References PNS::angle(), and RotatePoint().
|
inline |
Definition at line 81 of file trigo.h.
References PNS::angle(), and RotatePoint().
|
inline |
Definition at line 86 of file trigo.h.
References PNS::angle(), RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.
Definition at line 294 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 282 of file trigo.cpp.
References PNS::angle(), and RotatePoint().
void RotatePoint | ( | double * | pX, |
double * | pY, | ||
double | angle | ||
) |
Definition at line 320 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 306 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 430 of file trigo.h.
References DECIDEG2RAD().
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, |
wxPoint | aStart, | ||
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 SEG::Square(), and SEG::SquaredDistance().
Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), EE_GRID_HELPER::computeAnchors(), DRAWING_TOOL::DrawVia(), LIB_RECTANGLE::HitTest(), LIB_BEZIER::HitTest(), SCH_BUS_ENTRY_BASE::HitTest(), DS_DRAW_ITEM_LINE::HitTest(), TRACK::HitTest(), GERBER_DRAW_ITEM::HitTest(), SCH_LINE::HitTest(), DS_DRAW_ITEM_RECT::HitTest(), PCB_SHAPE::HitTest(), SCH_EAGLE_PLUGIN::moveLabels(), and SCH_TEXT::UpdateDanglingState().