|
KiCad PCB EDA Suite
|
#include <shape_ellipse.h>
Classes | |
| struct | CONIC |
| A conic curve Axx x^2 + Axy xy + Ayy y^2 + Bx x + By y + C = 0, written in this ellipse's local frame. More... | |
Public Member Functions | |
| SHAPE_ELLIPSE () | |
| SHAPE_ELLIPSE (const VECTOR2I &aCenter, int aMajorRadius, int aMinorRadius, const EDA_ANGLE &aRotation) | |
| SHAPE_ELLIPSE (const VECTOR2I &aCenter, int aMajorRadius, int aMinorRadius, const EDA_ANGLE &aRotation, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle) | |
| SHAPE_ELLIPSE (const VECTOR2I &aCenter, const VECTOR2I &aMajorEndpoint, double aRatio) | |
| SHAPE_ELLIPSE (const VECTOR2I &aCenter, const VECTOR2I &aMajorEndpoint, double aRatio, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle) | |
| SHAPE_ELLIPSE (const SHAPE_ELLIPSE &aOther)=default | |
| SHAPE_ELLIPSE & | operator= (const SHAPE_ELLIPSE &)=default |
| ~SHAPE_ELLIPSE () override=default | |
| bool | operator== (const SHAPE_ELLIPSE &aOther) const |
| The cached trigonometry is derived from these fields, so it is not compared. | |
| SHAPE * | Clone () const override |
| Return a dynamically allocated copy of the shape. | |
| const VECTOR2I & | GetCenter () const |
| int | GetMajorRadius () const |
| int | GetMinorRadius () const |
| const EDA_ANGLE & | GetRotation () const |
| const EDA_ANGLE & | GetStartAngle () const |
| const EDA_ANGLE & | GetEndAngle () const |
| bool | IsArc () const |
| void | SetCenter (const VECTOR2I &aCenter) |
| void | SetMajorRadius (int aRadius) |
| void | SetMinorRadius (int aRadius) |
| void | SetRotation (const EDA_ANGLE &aAngle) |
| void | SetStartAngle (const EDA_ANGLE &aAngle) |
| void | SetEndAngle (const EDA_ANGLE &aAngle) |
| const BOX2I | BBox (int aClearance=0) const override |
| Compute a bounding box of the shape, with a margin of aClearance a collision. | |
| bool | Collide (const SEG &aSeg, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override |
| Check if the boundary of shape (this) lies closer to the segment aSeg than aClearance, indicating a collision. | |
| bool | Collide (const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override |
| void | TransformToPolygon (SHAPE_POLY_SET &aBuffer, int aError, ERROR_LOC aErrorLoc) const override |
| Fills a SHAPE_POLY_SET with a polygon representation of this shape. | |
| void | Rotate (const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override |
| void | Move (const VECTOR2I &aVector) override |
| bool | IsSolid () const override |
| void | Mirror (const VECTOR2I &aRef, FLIP_DIRECTION aFlipDirection) |
| Mirror the ellipse across a horizontal or vertical axis passing through aRef. | |
| const std::string | Format (bool aCplusPlus=true) const override |
| Serialize the ellipse. | |
| double | GetLength () const |
| SHAPE_LINE_CHAIN | ConvertToPolyline (int aMaxError) const |
| Build a polyline approximation of the ellipse or arc. | |
| bool | PointInside (const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const override |
| Check if point aP lies inside a closed shape. | |
| SEG::ecoord | SquaredDistance (const VECTOR2I &aP, bool aOutlineOnly=false) const override |
| VECTOR2I | NearestPoint (const VECTOR2I &aP) const |
| Find the point on the curve closest to aP. | |
| std::vector< VECTOR2I > | Intersect (const SHAPE_ELLIPSE &aOther) const |
| Find the points where this curve crosses another one. | |
| std::vector< VECTOR2I > | Intersect (const CIRCLE &aCircle) const |
| std::vector< VECTOR2I > | Intersect (const SHAPE_ARC &aArc) const |
| std::vector< VECTOR2I > | Intersect (const SEG &aSeg, bool aTreatAsLine=false) const |
| Find the points where this curve crosses aSeg. | |
| int | GetClearance (const SHAPE *aOther) const |
| Return the actual minimum distance between two shapes. | |
| bool | IsNull () const |
| Return true if the shape is a null shape. | |
| virtual bool | Collide (const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const |
| Check if the boundary of shape (this) lies closer to the point aP than aClearance, indicating a collision. | |
| virtual bool | Collide (const SHAPE *aShape, int aClearance, VECTOR2I *aMTV) const |
| Check if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision. | |
| virtual VECTOR2I | Centre () const |
| Compute a center-of-mass of the shape. | |
| virtual int | Distance (const VECTOR2I &aP) const |
| Returns the minimum distance from a given point to this shape. | |
| bool | NearestPoints (const SHAPE *aOther, VECTOR2I &aPtThis, VECTOR2I &aPtOther) const |
| Return the two points that mark the closest distance between this shape and aOther. | |
| virtual VECTOR2I | GetStart () const |
| virtual VECTOR2I | GetEnd () const |
| virtual int | GetWidth () const |
| virtual void | SetWidth (int aWidth) |
| virtual bool | Parse (std::stringstream &aStream) |
| FACET * | NewFacet () |
| SGNODE * | CalcShape (SGNODE *aParent, SGNODE *aColor, WRL1_ORDER aVertexOrder, float aCreaseLimit=0.74317, bool isVRML2=false) |
| SHAPE_TYPE | Type () const |
| Return the type of the shape. | |
| wxString | TypeName () const |
| virtual bool | HasIndexableSubshapes () const |
| virtual size_t | GetIndexableSubshapeCount () const |
| virtual void | GetIndexableSubshapes (std::vector< const SHAPE * > &aSubshapes) const |
Static Public Attributes | |
| static const int | MIN_PRECISION_IU = 4 |
| This is the minimum precision for all the points in a shape. | |
Protected Types | |
| typedef VECTOR2I::extended_type | ecoord |
Protected Attributes | |
| SHAPE_TYPE | m_type |
| < type of our shape | |
Private Member Functions | |
| void | normalize () |
| If major < minor, swap them and add 90 degrees to rotation. | |
| void | updateCache () |
| Recompute cached sin/cos and inverse-radius-squared values. | |
| bool | isAngleInSweep (double aAngleRad) const |
| Return true if aAngleRad falls between StartAngle and EndAngle (counter-clockwise sweep). | |
| void | sweepRange (double &aStart, double &aEnd) const |
| Canonical CCW sweep in radians; aEnd >= aStart. Used by all sweep-aware paths. | |
| VECTOR2D | toLocal (const VECTOR2I &aP) const |
| VECTOR2I | toWorld (const VECTOR2D &aP) const |
| VECTOR2D | pointAtParam (double aTheta) const |
| Point on the full ellipse at parameter angle aTheta, in the local frame. | |
| VECTOR2D | closestLocalPoint (const VECTOR2D &aLocal) const |
| Point of the curve closest to aLocal, both in the local frame. | |
| CONIC | conicOf (const VECTOR2I &aCenter, double aMajorR, double aMinorR, const EDA_ANGLE &aRotation) const |
| Write an ellipse with the given world placement as a conic in this local frame. | |
| std::vector< double > | conicRoots (const CONIC &aConic) const |
| Parameter angles of this curve where aConic is zero, already limited to its sweep. | |
| std::vector< VECTOR2I > | intersectCircle (const VECTOR2I &aCenter, double aRadius) const |
| Points where this curve crosses a full circle, before any sweep of that circle applies. | |
Private Attributes | |
| ELLIPSE< int > | m_ellipse |
| Wrapped geometric data (from geometry/ellipse.h) | |
| bool | m_isArc |
| true if open elliptical arc, false if closed ellipse | |
| double | m_sinRot |
| sin(Rotation) | |
| double | m_cosRot |
| cos(Rotation) | |
| double | m_invMajorRSq |
| 1 / MajorRadius ^ 2 | |
| double | m_invMinorRSq |
| 1 / MinorRadius ^ 2 | |
| std::list< FACET * > | facets |
Definition at line 33 of file shape_ellipse.h.
|
protectedinherited |
| SHAPE_ELLIPSE::SHAPE_ELLIPSE | ( | ) |
Definition at line 272 of file shape_ellipse.cpp.
References m_cosRot, m_ellipse, m_invMajorRSq, m_invMinorRSq, m_isArc, m_sinRot, SH_ELLIPSE, and SHAPE::SHAPE().
Referenced by Clone(), Intersect(), operator=(), operator==(), and SHAPE_ELLIPSE().
| SHAPE_ELLIPSE::SHAPE_ELLIPSE | ( | const VECTOR2I & | aCenter, |
| int | aMajorRadius, | ||
| int | aMinorRadius, | ||
| const EDA_ANGLE & | aRotation ) |
Definition at line 284 of file shape_ellipse.cpp.
References m_ellipse, m_isArc, normalize(), SH_ELLIPSE, and SHAPE::SHAPE().
| SHAPE_ELLIPSE::SHAPE_ELLIPSE | ( | const VECTOR2I & | aCenter, |
| int | aMajorRadius, | ||
| int | aMinorRadius, | ||
| const EDA_ANGLE & | aRotation, | ||
| const EDA_ANGLE & | aStartAngle, | ||
| const EDA_ANGLE & | aEndAngle ) |
Definition at line 294 of file shape_ellipse.cpp.
References m_ellipse, m_isArc, normalize(), SH_ELLIPSE, and SHAPE::SHAPE().
| SHAPE_ELLIPSE::SHAPE_ELLIPSE | ( | const VECTOR2I & | aCenter, |
| const VECTOR2I & | aMajorEndpoint, | ||
| double | aRatio ) |
Definition at line 304 of file shape_ellipse.cpp.
References m_ellipse, m_isArc, normalize(), SH_ELLIPSE, and SHAPE::SHAPE().
| SHAPE_ELLIPSE::SHAPE_ELLIPSE | ( | const VECTOR2I & | aCenter, |
| const VECTOR2I & | aMajorEndpoint, | ||
| double | aRatio, | ||
| const EDA_ANGLE & | aStartAngle, | ||
| const EDA_ANGLE & | aEndAngle ) |
Definition at line 313 of file shape_ellipse.cpp.
References m_ellipse, m_isArc, normalize(), SH_ELLIPSE, and SHAPE::SHAPE().
|
default |
References SHAPE_ELLIPSE().
|
overridedefault |
|
overridevirtual |
Compute a bounding box of the shape, with a margin of aClearance a collision.
| aClearance | how much the bounding box is expanded wrs to the minimum enclosing rectangle for the shape. |
Implements SHAPE.
Definition at line 383 of file shape_ellipse.cpp.
References isAngleInSweep(), m_cosRot, m_ellipse, m_isArc, M_PI, m_sinRot, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PNS::BuildHullForPrimitiveShape(), and EDA_SHAPE::getBoundingBox().
|
inherited |
Definition at line 699 of file wrlfacet.cpp.
References IFSG_NODE::AddChildNode(), IFSG_INDEX::AddIndex(), IFSG_NODE::AddRefNode(), facets, IFSG_NODE::GetRawPtr(), S3D::GetSGNodeParent(), IFSG_FACESET::NewNode(), IFSG_SHAPE::NewNode(), IFSG_COLORS::SetColorList(), IFSG_COORDS::SetCoordsList(), IFSG_NORMALS::SetNormalList(), SGPOINT::x, SGPOINT::y, and SGPOINT::z.
Referenced by WRL1FACESET::TranslateToSG(), WRL2FACESET::TranslateToSG(), and X3DIFACESET::TranslateToSG().
|
inlinevirtualinherited |
Compute a center-of-mass of the shape.
Definition at line 230 of file shape.h.
References BBox(), and BOX2< Vec >::Centre().
Referenced by PCB_CONTROL::ApplyDesignBlockLayout(), PNS::TOPOLOGY::AssembleDiffPair(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), Collide(), PNS::HELPERS::PickSegment(), and DRC_TEST_PROVIDER_EDGE_CLEARANCE::resolveSilkDisposition().
|
inlineoverridevirtual |
Return a dynamically allocated copy of the shape.
| copy | of the shape |
Reimplemented from SHAPE.
Definition at line 62 of file shape_ellipse.h.
References SHAPE::SHAPE(), and SHAPE_ELLIPSE().
Point of the curve closest to aLocal, both in the local frame.
Definition at line 780 of file shape_ellipse.cpp.
References std::abs(), end, isAngleInSweep(), m_ellipse, m_isArc, pointAtParam(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by NearestPoint(), and SquaredDistance().
|
virtualinherited |
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision.
| aShape | shape to check collision against |
| aClearance | minimum clearance |
| aMTV | [out] minimum translation vector |
| aActual | [out] an optional pointer to an int to store the actual distance in the event of a collision. |
| aLocation | [out] an option pointer to a point to store a nearby location in the event of a collision. |
Reimplemented in SHAPE_COMPOUND, SHAPE_RECT, and SHAPE_SEGMENT.
Definition at line 1432 of file shape_collisions.cpp.
References collideShapes(), and SHAPE().
|
inlinevirtualinherited |
Check if the boundary of shape (this) lies closer to the point aP than aClearance, indicating a collision.
| aActual | [out] an optional pointer to an int to store the actual distance in the event of a collision. |
| aLocation | [out] an option pointer to a point to store a nearby location in the event of a collision. |
Reimplemented in SHAPE_ARC, SHAPE_LINE_CHAIN, SHAPE_LINE_CHAIN_BASE, SHAPE_POLY_SET, and SHAPE_SEGMENT.
Definition at line 179 of file shape.h.
References Collide().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), DRC_RTREE::CheckColliding(), DRC_RTREE::CheckColliding(), FOOTPRINT::CheckShortingPads(), CN_ZONE_LAYER::Collide(), Collide(), SHAPE_ARC::Collide(), SHAPE_COMPOUND::Collide(), SHAPE_COMPOUND::Collide(), SHAPE_ELLIPSE::Collide(), SHAPE_POLY_SET::Collide(), SHAPE_RECT::Collide(), SHAPE_RECT::Collide(), SHAPE_SEGMENT::Collide(), SHAPE_SEGMENT::Collide(), collide(), PNS::ITEM::collideSimple(), PNS::TOPOLOGY::findLinesFromVia(), SCH_LINE::HitTest(), EDA_SHAPE::hitTest(), PCB_SELECTION_TOOL::hitTestDistance(), PNS::SHOVE::onCollidingVia(), PNS::SHOVE::onReverseCollidingVia(), CN_VISITOR::operator()(), PNS::HIT_VISITOR::operator()(), PNS::VIA::PushoutForce(), DRC_RTREE::QueryColliding(), DRC_RTREE::QueryColliding(), DRC_TEST_PROVIDER_SILK_CLEARANCE::Run(), KIGEOM::ShapeHitTest(), PNS::OPTIMIZER::smartPadsSingle(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testSingleLayerItemAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances(), and DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow().
|
overridevirtual |
Check if the boundary of shape (this) lies closer to the segment aSeg than aClearance, indicating a collision.
| aActual | [out] an optional pointer to an int to be updated with the actual distance int the event of a collision. |
| aLocation | [out] an option pointer to a point to store a nearby location in the event of a collision. |
Implements SHAPE.
Definition at line 472 of file shape_ellipse.cpp.
References SEG::A, SEG::B, D, isAngleInSweep(), m_ellipse, m_isArc, M_PI, SquaredDistance(), toLocal(), toWorld(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), Collide(), and collideEllipseVsSegments().
|
inlineoverridevirtual |
Reimplemented from SHAPE.
Definition at line 85 of file shape_ellipse.h.
References SHAPE::Collide(), and SHAPE::SHAPE().
|
private |
Write an ellipse with the given world placement as a conic in this local frame.
Definition at line 918 of file shape_ellipse.cpp.
References EDA_ANGLE::AsRadians(), SHAPE_ELLIPSE::CONIC::Axx, SHAPE_ELLIPSE::CONIC::Axy, SHAPE_ELLIPSE::CONIC::Ayy, SHAPE_ELLIPSE::CONIC::Bx, SHAPE_ELLIPSE::CONIC::By, SHAPE_ELLIPSE::CONIC::C, delta, m_ellipse, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Intersect(), and intersectCircle().
|
private |
Parameter angles of this curve where aConic is zero, already limited to its sweep.
Definition at line 951 of file shape_ellipse.cpp.
References std::abs(), SHAPE_ELLIPSE::CONIC::Axx, SHAPE_ELLIPSE::CONIC::Axy, SHAPE_ELLIPSE::CONIC::Ayy, SHAPE_ELLIPSE::CONIC::Bx, SHAPE_ELLIPSE::CONIC::By, SHAPE_ELLIPSE::CONIC::C, isAngleInSweep(), m_ellipse, m_isArc, M_PI, result, and scale.
Referenced by Intersect(), Intersect(), and intersectCircle().
| SHAPE_LINE_CHAIN SHAPE_ELLIPSE::ConvertToPolyline | ( | int | aMaxError | ) | const |
Build a polyline approximation of the ellipse or arc.
Stay within aMaxError IU of the true curve.
| aMaxError | maximum error in IU |
Definition at line 1126 of file shape_ellipse.cpp.
References SHAPE_LINE_CHAIN::Append(), SHAPE_LINE_CHAIN::CPoint(), m_cosRot, m_ellipse, m_isArc, m_sinRot, SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::Remove(), SHAPE_LINE_CHAIN::SetClosed(), and sweepRange().
Referenced by FEATURES_MANAGER::AddShape(), PCB_IO_IPC2581::addShape(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), Collide(), CONVERT_TOOL::CreateLines(), BOARD_ADAPTER::createPadWithMargin(), KIGFX::GAL::DrawEllipse(), KIGFX::GAL::DrawEllipseArc(), EDA_SHAPE::hitTest(), EDA_SHAPE::makeEffectiveShapes(), SCH_SHAPE::Plot(), BRDITEMS_PLOTTER::PlotShape(), processClosedShape(), processShapeSegment(), CONSTRAINT_OVERLAY::render(), EDA_SHAPE::TransformShapeToPolygon(), TransformToPolygon(), and EDA_SHAPE::UpdateHatching().
|
virtualinherited |
Returns the minimum distance from a given point to this shape.
Always returns zero if the point is inside a closed shape and aOutlineOnly is false.
| aP | is the point to test |
Reimplemented in SHAPE_COMPOUND, and SHAPE_LINE_CHAIN.
Definition at line 105 of file shape.cpp.
References SquaredDistance().
|
overridevirtual |
Serialize the ellipse.
Reimplemented from SHAPE.
Definition at line 679 of file shape_ellipse.cpp.
References SHAPE::Format(), m_ellipse, and m_isArc.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 64 of file shape_ellipse.h.
References m_ellipse.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), Collide(), Collide(), collideEllipseVsSegments(), ROUTER_PREVIEW_ITEM::drawShape(), and STROKE_PARAMS::Stroke().
|
inherited |
Return the actual minimum distance between two shapes.
| distance | in IU |
POLY_SETs contain a bunch of polygons that are triangulated. But there are way more triangles than necessary for collision detection. Triangles check three vertices each but for the outline, we only need one. These are also fractured, so we don't need to worry about holes
Definition at line 51 of file shape.cpp.
References SHAPE_POLY_SET::COutline(), SHAPE_BASE::GetIndexableSubshapeCount(), SHAPE_BASE::GetIndexableSubshapes(), SHAPE_POLY_SET::OutlineCount(), SH_POLY_SET, SHAPE(), and SHAPE_BASE::Type().
|
inlinevirtualinherited |
Reimplemented in SHAPE_ARC, and SHAPE_SEGMENT.
|
inline |
Definition at line 69 of file shape_ellipse.h.
References m_ellipse.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), ROUTER_PREVIEW_ITEM::drawShape(), and STROKE_PARAMS::Stroke().
|
inlinevirtualinherited |
Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.
Definition at line 111 of file shape.h.
Referenced by SHAPE::GetClearance().
|
inlinevirtualinherited |
Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.
Definition at line 113 of file shape.h.
Referenced by SHAPE_COMPOUND::AddShape(), and SHAPE::GetClearance().
| double SHAPE_ELLIPSE::GetLength | ( | ) | const |
Definition at line 444 of file shape_ellipse.cpp.
References m_ellipse, m_isArc, M_PI, and sweepRange().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and EDA_SHAPE::GetLength().
|
inline |
Definition at line 65 of file shape_ellipse.h.
References m_ellipse.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), ROUTER_PREVIEW_ITEM::drawShape(), and STROKE_PARAMS::Stroke().
|
inline |
Definition at line 66 of file shape_ellipse.h.
References m_ellipse.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), ROUTER_PREVIEW_ITEM::drawShape(), and STROKE_PARAMS::Stroke().
|
inline |
Definition at line 67 of file shape_ellipse.h.
References m_ellipse.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), ROUTER_PREVIEW_ITEM::drawShape(), and STROKE_PARAMS::Stroke().
|
inlinevirtualinherited |
Reimplemented in SHAPE_ARC, and SHAPE_SEGMENT.
Definition at line 284 of file shape.h.
Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers().
|
inline |
Definition at line 68 of file shape_ellipse.h.
References m_ellipse.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), ROUTER_PREVIEW_ITEM::drawShape(), and STROKE_PARAMS::Stroke().
|
inlinevirtualinherited |
Reimplemented in SHAPE_ARC, SHAPE_RECT, and SHAPE_SEGMENT.
Definition at line 287 of file shape.h.
Referenced by BOARD_ADAPTER::createPadWithMargin(), ROUTER_PREVIEW_ITEM::drawShape(), and SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN().
|
inlinevirtualinherited |
Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.
Definition at line 1071 of file shape_ellipse.cpp.
References CIRCLE::Center, intersectCircle(), and CIRCLE::Radius.
| std::vector< VECTOR2I > SHAPE_ELLIPSE::Intersect | ( | const SEG & | aSeg, |
| bool | aTreatAsLine = false ) const |
Find the points where this curve crosses aSeg.
| aTreatAsLine | extends the segment to an infinite line. |
Definition at line 1094 of file shape_ellipse.cpp.
References SEG::A, SHAPE_ELLIPSE::CONIC::Axx, SHAPE_ELLIPSE::CONIC::Axy, SHAPE_ELLIPSE::CONIC::Ayy, SEG::B, SHAPE_ELLIPSE::CONIC::Bx, SHAPE_ELLIPSE::CONIC::By, SHAPE_ELLIPSE::CONIC::C, conicRoots(), SEG::Contains(), m_ellipse, RADIANS_T, toLocal(), VECTOR2< T >::x, and VECTOR2< T >::y.
Definition at line 1077 of file shape_ellipse.cpp.
References VECTOR2< T >::Distance(), SHAPE_ARC::GetCenter(), SHAPE_ARC::GetRadius(), intersectCircle(), SHAPE::MIN_PRECISION_IU, and SHAPE_ARC::NearestPoint().
| std::vector< VECTOR2I > SHAPE_ELLIPSE::Intersect | ( | const SHAPE_ELLIPSE & | aOther | ) | const |
Find the points where this curve crosses another one.
Crossings outside either drawn sweep are dropped, so an elliptical arc never reports a point beyond its own start and end angles.
Definition at line 1032 of file shape_ellipse.cpp.
References EDA_ANGLE::AsRadians(), ELLIPSE< NumericType >::Center, conicOf(), conicRoots(), ELLIPSE< NumericType >::GetAngleAtPoint(), isAngleInSweep(), m_ellipse, m_isArc, ELLIPSE< NumericType >::MajorRadius, ELLIPSE< NumericType >::MinorRadius, RADIANS_T, ELLIPSE< NumericType >::Rotation, and SHAPE_ELLIPSE().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
private |
Points where this curve crosses a full circle, before any sweep of that circle applies.
Definition at line 1056 of file shape_ellipse.cpp.
References ANGLE_0, conicOf(), conicRoots(), m_ellipse, and RADIANS_T.
Referenced by Intersect(), and Intersect().
|
private |
Return true if aAngleRad falls between StartAngle and EndAngle (counter-clockwise sweep).
Only valid for arcs.
Definition at line 1196 of file shape_ellipse.cpp.
References M_PI, and sweepRange().
Referenced by BBox(), closestLocalPoint(), Collide(), conicRoots(), and Intersect().
|
inline |
Definition at line 71 of file shape_ellipse.h.
References m_isArc.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), Collide(), ROUTER_PREVIEW_ITEM::drawShape(), and STROKE_PARAMS::Stroke().
|
inlineinherited |
Return true if the shape is a null shape.
| true | if null :-) |
Definition at line 164 of file shape.h.
References SHAPE_BASE::m_type, and SH_NULL.
|
inlineoverridevirtual |
| void SHAPE_ELLIPSE::Mirror | ( | const VECTOR2I & | aRef, |
| FLIP_DIRECTION | aFlipDirection ) |
Mirror the ellipse across a horizontal or vertical axis passing through aRef.
Definition at line 672 of file shape_ellipse.cpp.
References m_ellipse, and updateCache().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
overridevirtual |
Find the point on the curve closest to aP.
For an arc the result is limited to the drawn sweep.
Definition at line 912 of file shape_ellipse.cpp.
References closestLocalPoint(), toLocal(), and toWorld().
|
inherited |
Return the two points that mark the closest distance between this shape and aOther.
Public interface for finding nearest points between two shapes.
If the shapes are overlapping, the points will be the same.
| aOther | the other shape to compare with |
| aPtThis | [out] the point on this shape closest to aOther |
| aPtOther | [out] the point on aOther closest to this shape |
| aA | first shape |
| aB | second shape |
| aPtA | [out] nearest point on first shape |
| aPtB | [out] nearest point on second shape |
Definition at line 934 of file shape_nearest_points.cpp.
References nearestPoints(), and SHAPE().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), SHAPE_ARC::NearestPoints(), PAD::Recombine(), DRC_TEST_PROVIDER::reportTwoShapeGeometry(), and DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run().
|
inherited |
Definition at line 691 of file wrlfacet.cpp.
References facets.
Referenced by WRL1FACESET::TranslateToSG(), WRL2FACESET::TranslateToSG(), and X3DIFACESET::TranslateToSG().
|
private |
If major < minor, swap them and add 90 degrees to rotation.
Clamps non positive radii to 1.
Definition at line 323 of file shape_ellipse.cpp.
References ANGLE_90, m_ellipse, m_isArc, and updateCache().
Referenced by SetMajorRadius(), SetMinorRadius(), SHAPE_ELLIPSE(), SHAPE_ELLIPSE(), SHAPE_ELLIPSE(), and SHAPE_ELLIPSE().
|
default |
References SHAPE_ELLIPSE().
|
inline |
The cached trigonometry is derived from these fields, so it is not compared.
Definition at line 53 of file shape_ellipse.h.
References ELLIPSE< NumericType >::Center, ELLIPSE< NumericType >::EndAngle, m_ellipse, m_isArc, ELLIPSE< NumericType >::MajorRadius, ELLIPSE< NumericType >::MinorRadius, ELLIPSE< NumericType >::Rotation, SHAPE_ELLIPSE(), and ELLIPSE< NumericType >::StartAngle.
|
virtualinherited |
Reimplemented in SHAPE_LINE_CHAIN, and SHAPE_POLY_SET.
|
private |
Point on the full ellipse at parameter angle aTheta, in the local frame.
Definition at line 774 of file shape_ellipse.cpp.
References m_ellipse.
Referenced by closestLocalPoint().
|
overridevirtual |
Check if point aP lies inside a closed shape.
Always returns false if this shape is not closed.
| aPt | point to check |
| aUseBBoxCache | gives better performance if the bounding box caches have been generated. |
Reimplemented from SHAPE.
Definition at line 732 of file shape_ellipse.cpp.
References m_cosRot, m_ellipse, m_invMajorRSq, m_invMinorRSq, m_isArc, m_sinRot, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and Collide().
|
overridevirtual |
| aCenter | is the rotation center. |
| aAngle | rotation angle. |
Implements SHAPE.
Definition at line 664 of file shape_ellipse.cpp.
References m_ellipse, RotatePoint(), and updateCache().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| void SHAPE_ELLIPSE::SetCenter | ( | const VECTOR2I & | aCenter | ) |
Definition at line 344 of file shape_ellipse.cpp.
References m_ellipse.
| void SHAPE_ELLIPSE::SetEndAngle | ( | const EDA_ANGLE & | aAngle | ) |
Definition at line 377 of file shape_ellipse.cpp.
References m_ellipse.
| void SHAPE_ELLIPSE::SetMajorRadius | ( | int | aRadius | ) |
Definition at line 350 of file shape_ellipse.cpp.
References m_ellipse, and normalize().
Referenced by BOOST_AUTO_TEST_CASE().
| void SHAPE_ELLIPSE::SetMinorRadius | ( | int | aRadius | ) |
Definition at line 357 of file shape_ellipse.cpp.
References m_ellipse, and normalize().
| void SHAPE_ELLIPSE::SetRotation | ( | const EDA_ANGLE & | aAngle | ) |
Definition at line 364 of file shape_ellipse.cpp.
References m_ellipse, and updateCache().
Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| void SHAPE_ELLIPSE::SetStartAngle | ( | const EDA_ANGLE & | aAngle | ) |
Definition at line 371 of file shape_ellipse.cpp.
References m_ellipse.
|
inlinevirtualinherited |
Reimplemented in SHAPE_ARC, SHAPE_LINE_CHAIN, and SHAPE_SEGMENT.
|
overridevirtual |
Reimplemented from SHAPE.
Definition at line 891 of file shape_ellipse.cpp.
References closestLocalPoint(), m_invMajorRSq, m_invMinorRSq, m_isArc, toLocal(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), Collide(), Collide(), and EDA_SHAPE::hitTest().
|
private |
Canonical CCW sweep in radians; aEnd >= aStart. Used by all sweep-aware paths.
Definition at line 1173 of file shape_ellipse.cpp.
References m_ellipse, m_isArc, and M_PI.
Referenced by ConvertToPolyline(), GetLength(), and isAngleInSweep().
Definition at line 755 of file shape_ellipse.cpp.
References m_cosRot, m_ellipse, m_sinRot, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Collide(), Intersect(), NearestPoint(), and SquaredDistance().
Definition at line 764 of file shape_ellipse.cpp.
References m_cosRot, m_ellipse, m_sinRot, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Collide(), and NearestPoint().
|
overridevirtual |
Fills a SHAPE_POLY_SET with a polygon representation of this shape.
| aBuffer | [out] will be filled with the polygonal representation of this shape. |
| aError | controls the maximum allowed deviation when converting rounded shapes to segments |
| aErrorLoc | controls where the error is placed when approximating rounded shapes |
Implements SHAPE.
Definition at line 653 of file shape_ellipse.cpp.
References SHAPE_POLY_SET::AddOutline(), chain, ConvertToPolyline(), and m_isArc.
|
inlineinherited |
Return the type of the shape.
| the | type |
Definition at line 96 of file shape.h.
References m_type.
Referenced by CREEPAGE_GRAPH::Addshape(), PNS::DP_GATEWAYS::BuildFromPrimitivePair(), PNS::BuildHullForPrimitiveShape(), PNS_LOG_VIEWER_FRAME::buildListTree(), Collide(), SHAPE_POLY_SET::Collide(), collideShapes(), collideSingleShapes(), comparePnsItems(), PNS::OPTIMIZER::computeBreakouts(), ROUTER_PREVIEW_ITEM::drawShape(), PNS_LOG_VIEWER_FRAME::drawSimpleShape(), EDA_SHAPE::EDA_SHAPE(), PNS::LOGGER::formatShapeAsJSON(), SHAPE::GetClearance(), nearestPoints(), nearestPointsSingleShapes(), DRC_RTREE::QueryColliding(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::resolveSilkDisposition(), STROKE_PARAMS::Stroke(), and SHAPE_FILE_IO::Write().
|
inlineinherited |
|
private |
Recompute cached sin/cos and inverse-radius-squared values.
Definition at line 719 of file shape_ellipse.cpp.
References m_cosRot, m_ellipse, m_invMajorRSq, m_invMinorRSq, and m_sinRot.
Referenced by Mirror(), normalize(), Rotate(), and SetRotation().
|
privateinherited |
Definition at line 139 of file wrlfacet.h.
Referenced by CalcShape(), and NewFacet().
|
private |
cos(Rotation)
Definition at line 198 of file shape_ellipse.h.
Referenced by BBox(), ConvertToPolyline(), PointInside(), SHAPE_ELLIPSE(), toLocal(), toWorld(), and updateCache().
|
private |
Wrapped geometric data (from geometry/ellipse.h)
Definition at line 194 of file shape_ellipse.h.
Referenced by BBox(), closestLocalPoint(), Collide(), conicOf(), conicRoots(), ConvertToPolyline(), Format(), GetCenter(), GetEndAngle(), GetLength(), GetMajorRadius(), GetMinorRadius(), GetRotation(), GetStartAngle(), Intersect(), Intersect(), intersectCircle(), Mirror(), Move(), normalize(), operator==(), pointAtParam(), PointInside(), Rotate(), SetCenter(), SetEndAngle(), SetMajorRadius(), SetMinorRadius(), SetRotation(), SetStartAngle(), SHAPE_ELLIPSE(), SHAPE_ELLIPSE(), SHAPE_ELLIPSE(), SHAPE_ELLIPSE(), SHAPE_ELLIPSE(), sweepRange(), toLocal(), toWorld(), and updateCache().
|
private |
1 / MajorRadius ^ 2
Definition at line 199 of file shape_ellipse.h.
Referenced by PointInside(), SHAPE_ELLIPSE(), SquaredDistance(), and updateCache().
|
private |
1 / MinorRadius ^ 2
Definition at line 200 of file shape_ellipse.h.
Referenced by PointInside(), SHAPE_ELLIPSE(), SquaredDistance(), and updateCache().
|
private |
true if open elliptical arc, false if closed ellipse
Definition at line 195 of file shape_ellipse.h.
Referenced by BBox(), closestLocalPoint(), Collide(), conicRoots(), ConvertToPolyline(), Format(), GetLength(), Intersect(), IsArc(), IsSolid(), normalize(), operator==(), PointInside(), SHAPE_ELLIPSE(), SHAPE_ELLIPSE(), SHAPE_ELLIPSE(), SHAPE_ELLIPSE(), SHAPE_ELLIPSE(), SquaredDistance(), sweepRange(), and TransformToPolygon().
|
private |
sin(Rotation)
Definition at line 197 of file shape_ellipse.h.
Referenced by BBox(), ConvertToPolyline(), PointInside(), SHAPE_ELLIPSE(), toLocal(), toWorld(), and updateCache().
|
protectedinherited |
< type of our shape
Definition at line 117 of file shape.h.
Referenced by SHAPE::Format(), SHAPE::IsNull(), SHAPE_BASE(), Type(), and TypeName().
|
staticinherited |
This is the minimum precision for all the points in a shape.
Definition at line 129 of file shape.h.
Referenced by DIRECTION_45::BuildInitialTrace(), CompareLength(), CIRCLE::Contains(), EDIT_TOOL::FilletTracks(), SHAPE_ELLIPSE::Intersect(), CIRCLE::IntersectLine(), and LINE_FILLET_ROUTINE::ProcessLinePair().