KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SHAPE_ELLIPSE Class Reference

#include <shape_ellipse.h>

Inheritance diagram for SHAPE_ELLIPSE:
SHAPE SHAPE_BASE

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_ELLIPSEoperator= (const SHAPE_ELLIPSE &)=default
 
 ~SHAPE_ELLIPSE () override=default
 
SHAPEClone () const override
 Return a dynamically allocated copy of the shape.
 
const VECTOR2IGetCenter () const
 
int GetMajorRadius () const
 
int GetMinorRadius () const
 
const EDA_ANGLEGetRotation () const
 
const EDA_ANGLEGetStartAngle () const
 
const EDA_ANGLEGetEndAngle () 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
 
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)
 
FACETNewFacet ()
 
SGNODECalcShape (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.
 

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
 

Detailed Description

Definition at line 35 of file shape_ellipse.h.

Member Typedef Documentation

◆ ecoord

typedef VECTOR2I::extended_type SHAPE::ecoord
protectedinherited

Definition at line 303 of file shape.h.

Constructor & Destructor Documentation

◆ SHAPE_ELLIPSE() [1/6]

SHAPE_ELLIPSE::SHAPE_ELLIPSE ( )

◆ SHAPE_ELLIPSE() [2/6]

SHAPE_ELLIPSE::SHAPE_ELLIPSE ( const VECTOR2I & aCenter,
int aMajorRadius,
int aMinorRadius,
const EDA_ANGLE & aRotation )

Definition at line 131 of file shape_ellipse.cpp.

References m_ellipse, m_isArc, normalize(), SH_ELLIPSE, and SHAPE::SHAPE().

◆ SHAPE_ELLIPSE() [3/6]

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 141 of file shape_ellipse.cpp.

References m_ellipse, m_isArc, normalize(), SH_ELLIPSE, and SHAPE::SHAPE().

◆ SHAPE_ELLIPSE() [4/6]

SHAPE_ELLIPSE::SHAPE_ELLIPSE ( const VECTOR2I & aCenter,
const VECTOR2I & aMajorEndpoint,
double aRatio )

Definition at line 151 of file shape_ellipse.cpp.

References m_ellipse, m_isArc, normalize(), SH_ELLIPSE, and SHAPE::SHAPE().

◆ SHAPE_ELLIPSE() [5/6]

SHAPE_ELLIPSE::SHAPE_ELLIPSE ( const VECTOR2I & aCenter,
const VECTOR2I & aMajorEndpoint,
double aRatio,
const EDA_ANGLE & aStartAngle,
const EDA_ANGLE & aEndAngle )

Definition at line 160 of file shape_ellipse.cpp.

References m_ellipse, m_isArc, normalize(), SH_ELLIPSE, and SHAPE::SHAPE().

◆ SHAPE_ELLIPSE() [6/6]

SHAPE_ELLIPSE::SHAPE_ELLIPSE ( const SHAPE_ELLIPSE & aOther)
default

References SHAPE_ELLIPSE().

◆ ~SHAPE_ELLIPSE()

SHAPE_ELLIPSE::~SHAPE_ELLIPSE ( )
overridedefault

Member Function Documentation

◆ BBox()

const BOX2I SHAPE_ELLIPSE::BBox ( int aClearance = 0) const
overridevirtual

Compute a bounding box of the shape, with a margin of aClearance a collision.

Parameters
aClearancehow much the bounding box is expanded wrs to the minimum enclosing rectangle for the shape.
Returns
the bounding box.

Implements SHAPE.

Definition at line 230 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().

◆ CalcShape()

◆ Centre()

virtual VECTOR2I SHAPE::Centre ( ) const
inlinevirtualinherited

Compute a center-of-mass of the shape.

Returns
the center-of-mass point

Definition at line 234 of file shape.h.

References BBox(), and BOX2< Vec >::Centre().

Referenced by PCB_CONTROL::ApplyDesignBlockLayout(), PNS::TOPOLOGY::AssembleDiffPair(), Collide(), pickSegment(), and DRC_TEST_PROVIDER_EDGE_CLEARANCE::resolveSilkDisposition().

◆ Clone()

SHAPE * SHAPE_ELLIPSE::Clone ( ) const
inlineoverridevirtual

Return a dynamically allocated copy of the shape.

Return values
copyof the shape

Reimplemented from SHAPE.

Definition at line 54 of file shape_ellipse.h.

References SHAPE::SHAPE(), and SHAPE_ELLIPSE().

◆ Collide() [1/4]

bool SHAPE::Collide ( const SHAPE * aShape,
int aClearance,
VECTOR2I * aMTV ) const
virtualinherited

Check if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision.

Parameters
aShapeshape to check collision against
aClearanceminimum 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.
Returns
true, if there is a collision.

Reimplemented in SHAPE_COMPOUND, SHAPE_RECT, and SHAPE_SEGMENT.

Definition at line 1436 of file shape_collisions.cpp.

References collideShapes(), and SHAPE().

◆ Collide() [2/4]

virtual bool SHAPE::Collide ( const VECTOR2I & aP,
int aClearance = 0,
int * aActual = nullptr,
VECTOR2I * aLocation = nullptr ) const
inlinevirtualinherited

Check if the boundary of shape (this) lies closer to the point aP than aClearance, indicating a collision.

Parameters
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.
Returns
true, if there is a collision.

Reimplemented in SHAPE_ARC, SHAPE_LINE_CHAIN, SHAPE_LINE_CHAIN_BASE, SHAPE_POLY_SET, and SHAPE_SEGMENT.

Definition at line 183 of file shape.h.

References Collide().

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), 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(), 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_DISALLOW::Run(), 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::testPadAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testSingleLayerItemAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances(), and DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow().

◆ Collide() [3/4]

bool SHAPE_ELLIPSE::Collide ( const SEG & aSeg,
int aClearance = 0,
int * aActual = nullptr,
VECTOR2I * aLocation = nullptr ) const
overridevirtual

Check if the boundary of shape (this) lies closer to the segment aSeg than aClearance, indicating a collision.

Parameters
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.
Returns
true, if there is a collision.

Implements SHAPE.

Definition at line 319 of file shape_ellipse.cpp.

References SEG::A, SEG::B, D, isAngleInSweep(), m_cosRot, m_ellipse, m_isArc, M_PI, m_sinRot, SquaredDistance(), 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().

◆ Collide() [4/4]

bool SHAPE_ELLIPSE::Collide ( const SHAPE * aShape,
int aClearance = 0,
int * aActual = nullptr,
VECTOR2I * aLocation = nullptr ) const
inlineoverridevirtual

Reimplemented from SHAPE.

Definition at line 77 of file shape_ellipse.h.

References SHAPE::Collide(), and SHAPE::SHAPE().

◆ ConvertToPolyline()

◆ Distance()

int SHAPE::Distance ( const VECTOR2I & aP) const
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.

Parameters
aPis the point to test
Returns
the distance from the shape to aP

Reimplemented in SHAPE_COMPOUND, and SHAPE_LINE_CHAIN.

Definition at line 109 of file shape.cpp.

References SquaredDistance().

◆ Format()

const std::string SHAPE_ELLIPSE::Format ( bool aCplusPlus = true) const
overridevirtual

Serialize the ellipse.

Reimplemented from SHAPE.

Definition at line 541 of file shape_ellipse.cpp.

References SHAPE::Format(), m_ellipse, and m_isArc.

Referenced by BOOST_AUTO_TEST_CASE().

◆ GetCenter()

◆ GetClearance()

int SHAPE::GetClearance ( const SHAPE * aOther) const
inherited

Return the actual minimum distance between two shapes.

Return values
distancein 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 55 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().

◆ GetEnd()

virtual VECTOR2I SHAPE::GetEnd ( ) const
inlinevirtualinherited

Reimplemented in SHAPE_ARC, and SHAPE_SEGMENT.

Definition at line 289 of file shape.h.

◆ GetEndAngle()

const EDA_ANGLE & SHAPE_ELLIPSE::GetEndAngle ( ) const
inline

◆ GetIndexableSubshapeCount()

virtual size_t SHAPE_BASE::GetIndexableSubshapeCount ( ) const
inlinevirtualinherited

Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.

Definition at line 115 of file shape.h.

Referenced by SHAPE::GetClearance().

◆ GetIndexableSubshapes()

virtual void SHAPE_BASE::GetIndexableSubshapes ( std::vector< const SHAPE * > & aSubshapes) const
inlinevirtualinherited

Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.

Definition at line 117 of file shape.h.

Referenced by SHAPE_COMPOUND::AddShape(), and SHAPE::GetClearance().

◆ GetLength()

double SHAPE_ELLIPSE::GetLength ( ) const

◆ GetMajorRadius()

◆ GetMinorRadius()

◆ GetRotation()

◆ GetStart()

virtual VECTOR2I SHAPE::GetStart ( ) const
inlinevirtualinherited

Reimplemented in SHAPE_ARC, and SHAPE_SEGMENT.

Definition at line 288 of file shape.h.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers().

◆ GetStartAngle()

const EDA_ANGLE & SHAPE_ELLIPSE::GetStartAngle ( ) const
inline

◆ GetWidth()

virtual int SHAPE::GetWidth ( ) const
inlinevirtualinherited

◆ HasIndexableSubshapes()

virtual bool SHAPE_BASE::HasIndexableSubshapes ( ) const
inlinevirtualinherited

Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.

Definition at line 110 of file shape.h.

◆ isAngleInSweep()

bool SHAPE_ELLIPSE::isAngleInSweep ( double aAngleRad) const
private

Return true if aAngleRad falls between StartAngle and EndAngle (counter-clockwise sweep).

Only valid for arcs.

Definition at line 820 of file shape_ellipse.cpp.

References M_PI, and sweepRange().

Referenced by BBox(), Collide(), and SquaredDistance().

◆ IsArc()

bool SHAPE_ELLIPSE::IsArc ( ) const
inline

◆ IsNull()

bool SHAPE::IsNull ( ) const
inlineinherited

Return true if the shape is a null shape.

Return values
trueif null :-)

Definition at line 168 of file shape.h.

References SHAPE_BASE::m_type, and SH_NULL.

◆ IsSolid()

bool SHAPE_ELLIPSE::IsSolid ( ) const
inlineoverridevirtual

Implements SHAPE.

Definition at line 88 of file shape_ellipse.h.

References m_isArc.

◆ Mirror()

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 534 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().

◆ Move()

void SHAPE_ELLIPSE::Move ( const VECTOR2I & aVector)
overridevirtual

Implements SHAPE.

Definition at line 575 of file shape_ellipse.cpp.

References m_ellipse.

◆ NearestPoints()

bool SHAPE::NearestPoints ( const SHAPE * aOther,
VECTOR2I & aPtThis,
VECTOR2I & aPtOther ) const
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.

Parameters
aOtherthe 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
Returns
true if the points were found
Parameters
aAfirst shape
aBsecond shape
aPtA[out] nearest point on first shape
aPtB[out] nearest point on second shape
Returns
true if nearest points were found, false otherwise

Definition at line 938 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(), DRC_TEST_PROVIDER::reportTwoShapeGeometry(), and DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run().

◆ NewFacet()

FACET * SHAPE::NewFacet ( )
inherited

◆ normalize()

void SHAPE_ELLIPSE::normalize ( )
private

If major < minor, swap them and add 90 degrees to rotation.

Clamps non positive radii to 1.

Definition at line 170 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().

◆ operator=()

SHAPE_ELLIPSE & SHAPE_ELLIPSE::operator= ( const SHAPE_ELLIPSE & )
default

References SHAPE_ELLIPSE().

◆ Parse()

bool SHAPE::Parse ( std::stringstream & aStream)
virtualinherited

Reimplemented in SHAPE_LINE_CHAIN, and SHAPE_POLY_SET.

Definition at line 40 of file shape.cpp.

◆ PointInside()

bool SHAPE_ELLIPSE::PointInside ( const VECTOR2I & aPt,
int aAccuracy = 0,
bool aUseBBoxCache = false ) const
overridevirtual

Check if point aP lies inside a closed shape.

Always returns false if this shape is not closed.

Parameters
aPtpoint to check
aUseBBoxCachegives better performance if the bounding box caches have been generated.
Returns
true if the point is inside the shape (edge is not treated as being inside).

Reimplemented from SHAPE.

Definition at line 594 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().

◆ Rotate()

void SHAPE_ELLIPSE::Rotate ( const EDA_ANGLE & aAngle,
const VECTOR2I & aCenter = { 0, 0 } )
overridevirtual
Parameters
aCenteris the rotation center.
aAnglerotation angle.

Implements SHAPE.

Definition at line 526 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().

◆ SetCenter()

void SHAPE_ELLIPSE::SetCenter ( const VECTOR2I & aCenter)

Definition at line 191 of file shape_ellipse.cpp.

References m_ellipse.

◆ SetEndAngle()

void SHAPE_ELLIPSE::SetEndAngle ( const EDA_ANGLE & aAngle)

Definition at line 224 of file shape_ellipse.cpp.

References m_ellipse.

◆ SetMajorRadius()

void SHAPE_ELLIPSE::SetMajorRadius ( int aRadius)

Definition at line 197 of file shape_ellipse.cpp.

References m_ellipse, and normalize().

Referenced by BOOST_AUTO_TEST_CASE().

◆ SetMinorRadius()

void SHAPE_ELLIPSE::SetMinorRadius ( int aRadius)

Definition at line 204 of file shape_ellipse.cpp.

References m_ellipse, and normalize().

◆ SetRotation()

void SHAPE_ELLIPSE::SetRotation ( const EDA_ANGLE & aAngle)

Definition at line 211 of file shape_ellipse.cpp.

References m_ellipse, and updateCache().

Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ SetStartAngle()

void SHAPE_ELLIPSE::SetStartAngle ( const EDA_ANGLE & aAngle)

Definition at line 218 of file shape_ellipse.cpp.

References m_ellipse.

◆ SetWidth()

virtual void SHAPE::SetWidth ( int aWidth)
inlinevirtualinherited

Reimplemented in SHAPE_ARC, SHAPE_LINE_CHAIN, and SHAPE_SEGMENT.

Definition at line 292 of file shape.h.

◆ SquaredDistance()

SEG::ecoord SHAPE_ELLIPSE::SquaredDistance ( const VECTOR2I & aP,
bool aOutlineOnly = false ) const
overridevirtual

◆ sweepRange()

void SHAPE_ELLIPSE::sweepRange ( double & aStart,
double & aEnd ) const
private

Canonical CCW sweep in radians; aEnd >= aStart. Used by all sweep-aware paths.

Definition at line 797 of file shape_ellipse.cpp.

References m_ellipse, m_isArc, and M_PI.

Referenced by ConvertToPolyline(), GetLength(), and isAngleInSweep().

◆ TransformToPolygon()

void SHAPE_ELLIPSE::TransformToPolygon ( SHAPE_POLY_SET & aBuffer,
int aError,
ERROR_LOC aErrorLoc ) const
overridevirtual

Fills a SHAPE_POLY_SET with a polygon representation of this shape.

Parameters
aBuffer[out] will be filled with the polygonal representation of this shape.
aErrorcontrols the maximum allowed deviation when converting rounded shapes to segments
aErrorLoccontrols where the error is placed when approximating rounded shapes

Implements SHAPE.

Definition at line 515 of file shape_ellipse.cpp.

References SHAPE_POLY_SET::AddOutline(), chain, ConvertToPolyline(), and m_isArc.

◆ Type()

◆ TypeName()

wxString SHAPE_BASE::TypeName ( ) const
inlineinherited

Definition at line 105 of file shape.h.

References m_type, and SHAPE_TYPE_asString().

Referenced by Collide(), Collide(), Collide(), Collide(), Collide(), Collide(), Collide(), and Collide().

◆ updateCache()

void SHAPE_ELLIPSE::updateCache ( )
private

Recompute cached sin/cos and inverse-radius-squared values.

Definition at line 581 of file shape_ellipse.cpp.

References m_cosRot, m_ellipse, m_invMajorRSq, m_invMinorRSq, and m_sinRot.

Referenced by Mirror(), normalize(), Rotate(), and SetRotation().

Member Data Documentation

◆ facets

std::list< FACET* > SHAPE::facets
privateinherited

Definition at line 143 of file wrlfacet.h.

Referenced by CalcShape(), and NewFacet().

◆ m_cosRot

double SHAPE_ELLIPSE::m_cosRot
private

cos(Rotation)

Definition at line 137 of file shape_ellipse.h.

Referenced by BBox(), Collide(), ConvertToPolyline(), PointInside(), SHAPE_ELLIPSE(), SquaredDistance(), and updateCache().

◆ m_ellipse

◆ m_invMajorRSq

double SHAPE_ELLIPSE::m_invMajorRSq
private

1 / MajorRadius ^ 2

Definition at line 138 of file shape_ellipse.h.

Referenced by PointInside(), SHAPE_ELLIPSE(), SquaredDistance(), and updateCache().

◆ m_invMinorRSq

double SHAPE_ELLIPSE::m_invMinorRSq
private

1 / MinorRadius ^ 2

Definition at line 139 of file shape_ellipse.h.

Referenced by PointInside(), SHAPE_ELLIPSE(), SquaredDistance(), and updateCache().

◆ m_isArc

bool SHAPE_ELLIPSE::m_isArc
private

◆ m_sinRot

double SHAPE_ELLIPSE::m_sinRot
private

sin(Rotation)

Definition at line 136 of file shape_ellipse.h.

Referenced by BBox(), Collide(), ConvertToPolyline(), PointInside(), SHAPE_ELLIPSE(), SquaredDistance(), and updateCache().

◆ m_type

SHAPE_TYPE SHAPE_BASE::m_type
protectedinherited

< type of our shape

Definition at line 121 of file shape.h.

Referenced by SHAPE::Format(), SHAPE::IsNull(), SHAPE_BASE(), Type(), and TypeName().

◆ MIN_PRECISION_IU

const int SHAPE::MIN_PRECISION_IU = 4
staticinherited

This is the minimum precision for all the points in a shape.

Definition at line 133 of file shape.h.

Referenced by DIRECTION_45::BuildInitialTrace(), CompareLength(), CIRCLE::Contains(), EDIT_TOOL::FilletTracks(), CIRCLE::IntersectLine(), and LINE_FILLET_ROUTINE::ProcessLinePair().


The documentation for this class was generated from the following files: