KiCad PCB EDA Suite
|
Represent basic circle geometry with utility geometry functions. More...
#include <circle.h>
Public Member Functions | |
CIRCLE () | |
CIRCLE (const VECTOR2I &aCenter, int aRadius) | |
CIRCLE (const CIRCLE &aOther) | |
bool | operator== (const CIRCLE &aOther) const =default |
CIRCLE & | ConstructFromTanTanPt (const SEG &aLineA, const SEG &aLineB, const VECTOR2I &aP) |
Construct this circle such that it is tangent to the given segments and passes through the given point, generating the solution which can be used to fillet both segments. | |
bool | Contains (const VECTOR2I &aP) const |
Return true if aP is on the circumference of this circle. | |
VECTOR2I | NearestPoint (const VECTOR2I &aP) const |
Compute the point on the circumference of the circle that is the closest to aP. | |
VECTOR2D | NearestPoint (const VECTOR2D &aP) const |
Compute the point (floating point version) on the circumference of the circle that is the closest to aP. | |
std::vector< VECTOR2I > | Intersect (const CIRCLE &aCircle) const |
Compute the intersection points between this circle and aCircle. | |
std::vector< VECTOR2I > | Intersect (const SEG &aSeg) const |
Compute the intersection points between this circle and aSeg. | |
std::vector< VECTOR2I > | IntersectLine (const SEG &aLine) const |
Compute the intersection points between this circle and aLine. | |
bool | Contains (const VECTOR2I &aP) |
Check whether point aP is inside this circle. | |
Public Attributes | |
int | Radius |
Public to make access simpler. | |
VECTOR2I | Center |
Public to make access simpler. | |
Represent basic circle geometry with utility geometry functions.
CIRCLE::CIRCLE | ( | ) |
Definition at line 30 of file circle.cpp.
CIRCLE::CIRCLE | ( | const VECTOR2I & | aCenter, |
int | aRadius | ||
) |
Definition at line 37 of file circle.cpp.
CIRCLE::CIRCLE | ( | const CIRCLE & | aOther | ) |
Definition at line 44 of file circle.cpp.
CIRCLE & CIRCLE::ConstructFromTanTanPt | ( | const SEG & | aLineA, |
const SEG & | aLineB, | ||
const VECTOR2I & | aP | ||
) |
Construct this circle such that it is tangent to the given segments and passes through the given point, generating the solution which can be used to fillet both segments.
The caller is responsible for ensuring it is providing a solvable problem. This function will assert if this is not the case.
aLineA | is the first tangent line. Treated as an infinite line except for the purpose of selecting the solution to return. |
aLineB | is the second tangent line. Treated as an infinite line except for the purpose of selecting the solution to return. |
aP | is the point to pass through. |
Definition at line 51 of file circle.cpp.
References SEG::A, SEG::ApproxParallel(), SEG::B, CalcArcMid(), Center, SEG::Center(), IntersectLine(), SEG::IntersectLines(), SEG::LineDistance(), SEG::LineProject(), SEG::ParallelSeg(), SEG::PerpendicularSeg(), and Radius.
Referenced by BOOST_AUTO_TEST_CASE(), and EDIT_TOOL::DragArcTrack().
bool CIRCLE::Contains | ( | const VECTOR2I & | aP | ) |
Check whether point aP is inside this circle.
aP | The point to check. |
Definition at line 355 of file circle.cpp.
bool CIRCLE::Contains | ( | const VECTOR2I & | aP | ) | const |
Return true if aP is on the circumference of this circle.
Note that there is an accepted margin of error of SHAPE::MIN_PRECISION_IU to account for integer rounding errors.
aP | A point to test |
Definition at line 188 of file circle.cpp.
References Center, distance(), SHAPE::MIN_PRECISION_IU, and Radius.
Referenced by segCircleIntersection().
Compute the intersection points between this circle and aCircle.
aCircle | The other circle to intersect with this. |
Definition at line 221 of file circle.cpp.
References std::abs(), Center, VECTOR2< T >::EuclideanNorm(), KiROUND(), Radius, and RotatePoint().
Referenced by SHAPE_ARC::Collide(), SHAPE_CIRCLE::Collide(), ComputeDogbone(), SHAPE_ARC::Intersect(), segCircleIntersection(), and SHAPE_LINE_CHAIN::SelfIntersectingWithArcs().
Compute the intersection points between this circle and aSeg.
aSeg | The segment to intersect with this circle (end points ignored). |
Definition at line 286 of file circle.cpp.
References SEG::Contains(), and IntersectLine().
Compute the intersection points between this circle and aLine.
aLine | The line to intersect with this circle (end points ignored). |
Definition at line 300 of file circle.cpp.
References SEG::A, SEG::B, Center, SEG::LineProject(), SHAPE::MIN_PRECISION_IU, and Radius.
Referenced by ConstructFromTanTanPt(), Intersect(), and SHAPE_ARC::IntersectLine().
Compute the point (floating point version) on the circumference of the circle that is the closest to aP.
In other words: finds the intersection point of this circle and a line that passes through both this circle's center and aP.
aP. |
Definition at line 209 of file circle.cpp.
References Center, Radius, VECTOR2< T >::Resize(), VECTOR2< T >::x, and VECTOR2< T >::y.
Compute the point on the circumference of the circle that is the closest to aP.
In other words: finds the intersection point of this circle and a line that passes through both this circle's center and aP.
aP. |
Definition at line 197 of file circle.cpp.
References Center, Radius, VECTOR2< T >::Resize(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by SHAPE_ARC::Collide(), ConnectBoardShapes(), EDIT_TOOL::DragArcTrack(), and SHAPE_ARC::NearestPoint().
|
default |
VECTOR2I CIRCLE::Center |
Public to make access simpler.
Definition at line 130 of file circle.h.
Referenced by SHAPE_CIRCLE::BBox(), BOOST_AUTO_TEST_CASE(), CIRCLE(), SHAPE_CIRCLE::Collide(), SHAPE_ARC::Collide(), ConstructFromTanTanPt(), Contains(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::drawPinDanglingIndicator(), SHAPE_CIRCLE::Format(), SHAPE_CIRCLE::GetCenter(), KIGEOM::GetCircleKeyPoints(), PIN_LAYOUT_CACHE::GetPinBoundingBox(), Intersect(), IntersectLine(), SHAPE_CIRCLE::Move(), NearestPoint(), SHAPE_CIRCLE::SetCenter(), and SHAPE_CIRCLE::TransformToPolygon().
int CIRCLE::Radius |
Public to make access simpler.
Definition at line 129 of file circle.h.
Referenced by SHAPE_CIRCLE::BBox(), BOOST_AUTO_TEST_CASE(), CIRCLE(), SHAPE_CIRCLE::Collide(), ConstructFromTanTanPt(), Contains(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::drawPinDanglingIndicator(), SHAPE_CIRCLE::Format(), KIGEOM::GetCircleKeyPoints(), SHAPE_CIRCLE::GetRadius(), Intersect(), IntersectLine(), NearestPoint(), SHAPE_CIRCLE::SetRadius(), and SHAPE_CIRCLE::TransformToPolygon().