KiCad PCB EDA Suite
|
Go to the source code of this file.
Functions | |
bool | IsPointOnSegment (const VECTOR2I &aSegStart, const VECTOR2I &aSegEnd, const VECTOR2I &aTestPoint) |
Test if aTestPoint is on line defined by aSegStart and aSegEnd. More... | |
bool | SegmentIntersectsSegment (const VECTOR2I &a_p1_l1, const VECTOR2I &a_p2_l1, const VECTOR2I &a_p1_l2, const VECTOR2I &a_p2_l2, VECTOR2I *aIntersectionPoint=nullptr) |
Test if two lines intersect. More... | |
void | RotatePoint (int *pX, int *pY, const EDA_ANGLE &aAngle) |
void | RotatePoint (VECTOR2I &point, const EDA_ANGLE &aAngle) |
void | RotatePoint (int *pX, int *pY, int cx, int cy, const EDA_ANGLE &aAngle) |
void | RotatePoint (VECTOR2I &point, const VECTOR2I ¢re, const EDA_ANGLE &aAngle) |
void | RotatePoint (double *pX, double *pY, const EDA_ANGLE &aAngle) |
void | RotatePoint (VECTOR2D &point, const EDA_ANGLE &aAngle) |
void | RotatePoint (double *pX, double *pY, double cx, double cy, const EDA_ANGLE &aAngle) |
void | RotatePoint (VECTOR2D &point, const VECTOR2D &aCenter, const EDA_ANGLE &aAngle) |
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 VECTOR2D | CalcArcCenter (const VECTOR2D &aStart, const VECTOR2D &aEnd, const EDA_ANGLE &aAngle) |
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 | EuclideanNorm (const VECTOR2I &vector) |
double | DistanceLinePoint (const VECTOR2I &linePointA, const VECTOR2I &linePointB, const VECTOR2I &referencePoint) |
Compute the distance between a line and a reference point Reference: http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html. More... | |
bool | HitTestPoints (const VECTOR2I &pointA, const VECTOR2I &pointB, double threshold) |
Test, if two points are near each other. More... | |
bool | TestSegmentHit (const VECTOR2I &aRefPoint, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aDist) |
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd. More... | |
double | GetLineLength (const VECTOR2I &aPointA, const VECTOR2I &aPointB) |
Return the length of a line segment defined by aPointA and aPointB. More... | |
double | DEG2RAD (double deg) |
double | RAD2DEG (double rad) |
double | RAD2DECIDEG (double rad) |
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) |
template<class T > | |
T | NormalizeAngle180 (T Angle) |
Normalize angle to be in the -180.0 .. 180.0 range. More... | |
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... | |
const VECTOR2D CalcArcCenter | ( | const VECTOR2D & | aStart, |
const VECTOR2D & | aEnd, | ||
const EDA_ANGLE & | aAngle | ||
) |
Definition at line 287 of file trigo.cpp.
References ANGLE_0, ANGLE_180, ANGLE_360, ANGLE_90, EuclideanNorm(), and RotatePoint().
Referenced by CalcArcCenter().
const VECTOR2D CalcArcCenter | ( | const VECTOR2D & | aStart, |
const VECTOR2D & | aMid, | ||
const VECTOR2D & | aEnd | ||
) |
Definition at line 323 of file trigo.cpp.
References std::abs(), VECTOR2< T >::EuclideanNorm(), 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 458 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(), SCH_LEGACY_PLUGIN_CACHE::loadArc(), SCH_SEXPR_PARSER::parseArc(), EDA_SHAPE::SetArcGeometry(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate().
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 ANGLE_180, and RotatePoint().
Referenced by CIRCLE::ConstructFromTanTanPt(), and EDIT_TOOL::DragArcTrack().
|
inline |
Definition at line 195 of file trigo.h.
Referenced by ConvertArcCenter(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), HelperShapeLineChainFromAltiumVertices(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), EAGLE_PLUGIN::loadPolygon(), EAGLE_PLUGIN::loadSignals(), EAGLE_PLUGIN::packagePolygon(), DRC_TEST_PROVIDER_SLIVER_CHECKER::Run(), and DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testShapeLineChain().
|
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 140 of file trigo.h.
References EuclideanNorm(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by EE_POINT_EDITOR::addCorner(), and EE_SELECTION_TOOL::GuessSelectionCandidates().
|
inline |
Definition at line 129 of file trigo.h.
References VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PLOTTER::Arc(), HPGL_PLOTTER::Arc(), PS_PLOTTER::Arc(), PDF_PLOTTER::Arc(), EE_GRID_HELPER::BestSnapAnchor(), BOOST_AUTO_TEST_CASE(), BuildCornersList_S_Shape(), 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::LINE_PLACER::cursorDistMinimum(), DistanceLinePoint(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), KIGFX::CAIRO_GAL_BASE::DrawSegment(), DRAWING_TOOL::DrawVia(), PCB_POINT_EDITOR::editArcMidKeepCenter(), PCB_POINT_EDITOR::editArcMidKeepEndpoints(), PAD_TOOL::EnumeratePads(), extractDiffPairCoupledItems(), TEARDROP_MANAGER::findAnchorPointsOnTrack(), PNS::findCoupledVertices(), PNS::DIFF_PAIR_PLACER::FindDpPrimitivePair(), gen_arc(), PAD::GetBestAnchorPosition(), SCH_LINE::GetItemDescription(), DS_DRAW_ITEM_LINE::GetItemDescription(), EE_SELECTION_TOOL::GetNode(), PCB_TEXTBOX::GetShownText(), BOARD::GetTrackLength(), EE_SELECTION_TOOL::GuessSelectionCandidates(), ALTIUM_PCB::HelperParseDimensions6Leader(), ALTIUM_PCB::HelperParseDimensions6Linear(), EDA_SHAPE::hitTest(), PCB_ARC::HitTest(), CIRCLE::IntersectLine(), GEOM_TEST::IsPointAtDistance(), PNS::makeGapVector(), PNS::MEANDERED_LINE::MeanderSegment(), LABEL_MANAGER::nearestBoxCorner(), AR_AUTOPLACER::nearestPad(), PNS::TOPOLOGY::NearestUnconnectedItem(), VECTOR3< T >::Normalize(), SHAPE_LINE_CHAIN::compareOriginDistance::operator()(), compareOriginDistance::operator()(), RN_NET::OptimizeRNEdges(), GPCB_FPL_CACHE::parseFOOTPRINT(), SCH_EDITOR_CONTROL::Paste(), SHAPE_LINE_CHAIN::PathLength(), pushoutForce(), EDA_SHAPE::RebuildBezierToSegmentsPointsList(), PNS::LINE_PLACER::rhMarkObstacles(), PNS::LINE_PLACER::rhWalkBase(), PNS::DIFF_PAIR_PLACER::routeHead(), DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run(), PLOTTER::segmentAsOval(), GEOM_TEST::SegmentCompletelyWithinRadius(), PNS::LINE::snapDraggedCorner(), PNS::DRAGGER::startDragSegment(), DRC_TEST_PROVIDER_HOLE_TO_HOLE::testHoleAgainstHole(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testShapeLineChain(), PLOTTER::ThickArc(), GERBER_PLOTTER::ThickArc(), TransformOvalToPolygon(), PCB_POINT_EDITOR::updateItem(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate().
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 188 of file trigo.h.
References VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by EDA_SHAPE::calcEdit(), EDIT_TOOL::DragArcTrack(), KIGFX::GERBVIEW_PAINTER::draw(), FootprintWriteShape(), GERBER_DRAW_ITEM::GetBoundingBox(), SCH_LINE::GetLength(), EDA_SHAPE::GetLength(), PCB_TRACK::GetLength(), getMinDist(), EDA_SHAPE::GetRadius(), PCB_ARC::GetRadius(), HelperShapeLineChainFromAltiumVertices(), GERBER_DRAW_ITEM::HitTest(), PCB_TRACK::IsPointOnEnds(), EAGLE_PLUGIN::loadPlain(), GERBER_DRAW_ITEM::Print(), EDA_SHAPE::ShapeGetMsgPanelInfo(), and GERBER_DRAW_ITEM::ViewGetLOD().
Test, if two points are near each other.
pointA | First point |
pointB | Second point |
threshold | The maximum distance |
Definition at line 159 of file trigo.h.
References VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by GERBER_DRAW_ITEM::HitTest(), and EE_SELECTION_TOOL::selectPoint().
|
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 258 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 240 of file trigo.h.
Referenced by BOOST_AUTO_TEST_CASE().
bool IsPointOnSegment | ( | const VECTOR2I & | aSegStart, |
const VECTOR2I & | aSegEnd, | ||
const VECTOR2I & | 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.
References VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_SCREEN::GetBusesAndWires(), SCH_SCREEN::GetNeededJunctions(), 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 214 of file trigo.h.
References NormalizeAnglePos().
|
inline |
Normalize angle to be in the -180.0 .. 180.0 range.
Definition at line 221 of file trigo.h.
Referenced by DIALOG_COPPER_ZONE::AcceptOptions().
|
inline |
Normalize angle to be in the 0.0 .. 360.0 range: angle is in 1/10 degrees.
Definition at line 205 of file trigo.h.
Referenced by NORMALIZE_ANGLE_POS().
|
inline |
Definition at line 196 of file trigo.h.
Referenced by GBR_TO_PCB_EXPORTER::export_non_copper_item(), and PCB_BASE_FRAME::UpdateStatusBar().
void RotatePoint | ( | double * | pX, |
double * | pY, | ||
const EDA_ANGLE & | aAngle | ||
) |
Definition at line 249 of file trigo.cpp.
References ANGLE_0, ANGLE_180, ANGLE_270, ANGLE_90, EDA_ANGLE::Cos(), EDA_ANGLE::Normalize(), EDA_ANGLE::Sin(), VECTOR2< T >::x, and VECTOR2< T >::y.
void RotatePoint | ( | double * | pX, |
double * | pY, | ||
double | cx, | ||
double | cy, | ||
const EDA_ANGLE & | aAngle | ||
) |
Definition at line 235 of file trigo.cpp.
References RotatePoint().
void RotatePoint | ( | int * | pX, |
int * | pY, | ||
const EDA_ANGLE & | aAngle | ||
) |
Definition at line 183 of file trigo.cpp.
References ANGLE_0, ANGLE_180, ANGLE_270, ANGLE_90, EDA_ANGLE::Cos(), KiROUND(), EDA_ANGLE::Normalize(), EDA_ANGLE::Sin(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by DXF_IMPORT_PLUGIN::addArc(), GRAPHICS_IMPORTER_PCBNEW::AddArc(), PCAD2KICAD::PCAD_FOOTPRINT::AddToBoard(), PCAD2KICAD::PCAD_PAD::AddToFootprint(), EC_CIRCLE::Apply(), CADSTAR_SCH_ARCHIVE_LOADER::applyTransform(), SVG_PLOTTER::Arc(), PDF_PLOTTER::Arc(), PCB_TEXT::buildBoundingHull(), BuildConvexHull(), BuildCornersList_S_Shape(), PAD::BuildEffectiveShapes(), DIRECTION_45::BuildInitialTrace(), CalcArcCenter(), CalcArcMid(), PNS::OPTIMIZER::circleBreakouts(), PCB_GRID_HELPER::computeAnchors(), computeCenter(), PSLIKE_PLOTTER::computeTextParameters(), SHAPE_ARC::ConstructFromStartEndAngle(), SHAPE_ARC::ConstructFromStartEndCenter(), AM_PRIMITIVE::ConvertBasicShapeToPolygon(), ConvertOutlineToPolygon(), AM_PRIMITIVE::ConvertShapeToPolygon(), D_CODE::ConvertShapeToPolygon(), CornerListToPolygon(), PCAD2KICAD::CorrectTextPosition(), EXCELLON_WRITER::createDrillFile(), MICROWAVE_TOOL::createFootprint(), SCH_GLOBALLABEL::CreateGraphicShape(), SCH_DIRECTIVE_LABEL::CreateGraphicShape(), PNS::OPTIMIZER::customBreakouts(), KIGFX::SCH_PAINTER::draw(), KIGFX::CAIRO_GAL_BASE::DrawArcSegment(), drawBacksideTicks(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DrawHalfOpenCylinder(), AR_MATRIX::drawSegmentQcq(), drawTicksAlongLine(), GBR_TO_PCB_EXPORTER::export_segarc_copper_item(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), fillArcPOLY(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), GERBER_PLOTTER::FlashPadChamferRoundRect(), GERBER_PLOTTER::FlashPadCustom(), HPGL_PLOTTER::FlashPadOval(), PSLIKE_PLOTTER::FlashPadOval(), HPGL_PLOTTER::FlashPadRect(), PSLIKE_PLOTTER::FlashPadRect(), DXF_PLOTTER::FlashPadRect(), DXF_PLOTTER::FlashPadTrapez(), GERBER_PLOTTER::FlashPadTrapez(), HPGL_PLOTTER::FlashPadTrapez(), PSLIKE_PLOTTER::FlashPadTrapez(), GERBER_PLOTTER::FlashRegularPolygon(), FootprintWriteShape(), PCB_PLUGIN::format(), formatInternalUnits(), GERBER_DRAW_ITEM::GetABPosition(), EDA_SHAPE::GetArcMid(), SCH_LABEL::GetBodyBoundingBox(), LIB_FIELD::GetBoundingBox(), LIB_TEXT::GetBoundingBox(), SCH_FIELD::GetBoundingBox(), SCH_TEXT::GetBoundingBox(), LIB_PIN::GetBoundingBox(), BOX2< Vec >::GetBoundingBoxRotated(), DS_DATA_ITEM_POLYGONS::GetCornerPosition(), PCB_TEXTBOX::GetDrawPos(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::GetEndRadiusEnd(), BOARD_ITEM::GetFPRelativePosition(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad(), EDA_TEXT::GetLinePositions(), CADSTAR_SCH_ARCHIVE_LOADER::getLocationOfNetElement(), getRectangleAlongCentreLine(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::GetStartRadiusEnd(), KIFONT::OUTLINE_FONT::getTextAsGlyphsUnlocked(), ARRAY_CIRCULAR_OPTIONS::GetTransform(), GERBER_DRAW_ITEM::GetXYPosition(), GRCSegm(), hash_fp_item(), ALTIUM_PCB::HelperParseDimensions6Center(), ALTIUM_PCB::HelperParseDimensions6Leader(), idf_export_footprint(), RENDER_3D_RAYTRACE::insertHole(), CIRCLE::Intersect(), BOX2< Vec >::Intersects(), EAGLE_PLUGIN::loadPlain(), SCH_EAGLE_PLUGIN::loadRectangle(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances(), SCH_EAGLE_PLUGIN::loadSymbolRectangle(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymdef(), DSN::mapPt(), FOOTPRINT::MoveAnchorPosition(), EAGLE_PLUGIN::packageCircle(), SCH_ALTIUM_PLUGIN::ParseArc(), ALTIUM_PCB::ParseComponentsBodies6Data(), GPCB_FPL_CACHE::parseFOOTPRINT(), SCH_TEXT::Plot(), GERBER_PLOTTER::plotRoundRectAsRegion(), SCH_TEXT::Print(), FABMASTER::processArc(), SHAPE_ARC::Rotate(), SHAPE_LINE_CHAIN::Rotate(), EDIT_TOOL::Rotate(), SCH_BITMAP::Rotate(), SCH_BUS_ENTRY_BASE::Rotate(), SCH_FIELD::Rotate(), SCH_JUNCTION::Rotate(), SCH_LABEL_BASE::Rotate(), SCH_LINE::Rotate(), SCH_NO_CONNECT::Rotate(), SCH_SHEET::Rotate(), SCH_SHEET_PIN::Rotate(), SCH_SYMBOL::Rotate(), SCH_TEXT::Rotate(), LIB_FIELD::Rotate(), LIB_PIN::Rotate(), LIB_TEXT::Rotate(), PCB_BITMAP::Rotate(), EDA_SHAPE::rotate(), FOOTPRINT::Rotate(), PAD::Rotate(), PCB_DIMENSION_BASE::Rotate(), PCB_TARGET::Rotate(), PCB_TEXT::Rotate(), PCB_TRACK::Rotate(), PCB_ARC::Rotate(), SCH_LABEL_BASE::Rotate90(), SCH_LINE::RotateEnd(), RotatePoint(), SCH_LINE::RotateStart(), EDA_SHAPE::SetArcAngleAndEnd(), DS_DATA_ITEM_POLYGONS::SetBoundingBox(), BOARD_ITEM::SetFPRelativePosition(), SHAPE_ARC::SHAPE_ARC(), PAD::ShapePos(), PLOTTER::sketchOval(), KIGFX::PCB_PAINTER::strokeText(), PNS_KICAD_IFACE_BASE::syncPad(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testShapeLineChain(), PDF_PLOTTER::Text(), EDA_TEXT::TextHitTest(), AR_MATRIX::TraceFilledRectangle(), EAGLE_PLUGIN::transferPad(), KIFONT::STROKE_GLYPH::Transform(), BOARD_ADAPTER::transformArcToSegments(), TransformCircleToPolygon(), TransformEllipseToBeziers(), TransformOvalToPolygon(), PAD::TransformShapeToPolygon(), PNS::MEANDER_SHAPE::turn(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_RADIAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), PCB_DIM_CENTER::updateGeometry(), PCB_POINT_EDITOR::updateItem(), PCB_DIM_ALIGNED::updateText(), and GERBER_PLOTTER::writeApertureList().
void RotatePoint | ( | int * | pX, |
int * | pY, | ||
int | cx, | ||
int | cy, | ||
const EDA_ANGLE & | aAngle | ||
) |
Definition at line 221 of file trigo.cpp.
References RotatePoint().
Definition at line 89 of file trigo.h.
References RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.
Definition at line 97 of file trigo.h.
References RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.
Definition at line 66 of file trigo.h.
References RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.
Definition at line 77 of file trigo.h.
References RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.
bool SegmentIntersectsSegment | ( | const VECTOR2I & | a_p1_l1, |
const VECTOR2I & | a_p2_l1, | ||
const VECTOR2I & | a_p1_l2, | ||
const VECTOR2I & | a_p2_l2, | ||
VECTOR2I * | 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(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BOX2< Vec >::Intersects().
bool TestSegmentHit | ( | const VECTOR2I & | aRefPoint, |
const VECTOR2I & | aStart, | ||
const VECTOR2I & | 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 std::abs(), delta, SEG::Square(), SEG::SquaredDistance(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), EE_GRID_HELPER::computeAnchors(), DRAWING_TOOL::DrawVia(), EDA_SHAPE::hitTest(), SCH_BUS_ENTRY_BASE::HitTest(), SCH_LINE::HitTest(), DS_DRAW_ITEM_LINE::HitTest(), DS_DRAW_ITEM_RECT::HitTest(), PCB_TRACK::HitTest(), GERBER_DRAW_ITEM::HitTest(), SCH_EAGLE_PLUGIN::moveLabels(), and SCH_LABEL_BASE::UpdateDanglingState().