80 const BOX2I BBox(
int aClearance = 0 )
const override;
82 bool Collide(
const SEG& aSeg,
int aClearance = 0,
int* aActual =
nullptr,
83 VECTOR2I* aLocation =
nullptr )
const override;
85 bool Collide(
const SHAPE* aShape,
int aClearance = 0,
int* aActual =
nullptr,
86 VECTOR2I* aLocation =
nullptr )
const override
106 const std::string
Format(
bool aCplusPlus =
true )
const override;
118 bool PointInside(
const VECTOR2I& aPt,
int aAccuracy = 0,
bool aUseBBoxCache =
false )
const override;
143 std::vector<VECTOR2I>
Intersect(
const SEG& aSeg,
bool aTreatAsLine =
false )
const;
174 void sweepRange(
double& aStart,
double& aEnd )
const;
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
Represent basic circle geometry with utility geometry functions.
Plain ellipse / elliptical-arc data.
VECTOR2< NumericType > Center
VECTOR2I::extended_type ecoord
void SetRotation(const EDA_ANGLE &aAngle)
int GetMajorRadius() const
void updateCache()
Recompute cached sin/cos and inverse-radius-squared values.
SHAPE_LINE_CHAIN ConvertToPolyline(int aMaxError) const
Build a polyline approximation of the ellipse or arc.
const VECTOR2I & GetCenter() const
void SetMajorRadius(int aRadius)
ELLIPSE< int > m_ellipse
Wrapped geometric data (from geometry/ellipse.h)
bool isAngleInSweep(double aAngleRad) const
Return true if aAngleRad falls between StartAngle and EndAngle (counter-clockwise sweep).
SEG::ecoord SquaredDistance(const VECTOR2I &aP, bool aOutlineOnly=false) const override
double m_invMinorRSq
1 / MinorRadius ^ 2
void SetStartAngle(const EDA_ANGLE &aAngle)
VECTOR2D toLocal(const VECTOR2I &aP) const
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.
const EDA_ANGLE & GetStartAngle() const
double m_cosRot
cos(Rotation)
const EDA_ANGLE & GetEndAngle() const
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.
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const override
Check if point aP lies inside a closed shape.
const std::string Format(bool aCplusPlus=true) const override
Serialize the ellipse.
VECTOR2I toWorld(const VECTOR2D &aP) const
bool operator==(const SHAPE_ELLIPSE &aOther) const
The cached trigonometry is derived from these fields, so it is not compared.
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
std::vector< double > conicRoots(const CONIC &aConic) const
Parameter angles of this curve where aConic is zero, already limited to its sweep.
void Mirror(const VECTOR2I &aRef, FLIP_DIRECTION aFlipDirection)
Mirror the ellipse across a horizontal or vertical axis passing through aRef.
VECTOR2D pointAtParam(double aTheta) const
Point on the full ellipse at parameter angle aTheta, in the local frame.
void sweepRange(double &aStart, double &aEnd) const
Canonical CCW sweep in radians; aEnd >= aStart. Used by all sweep-aware paths.
void normalize()
If major < minor, swap them and add 90 degrees to rotation.
VECTOR2I NearestPoint(const VECTOR2I &aP) const
Find the point on the curve closest to aP.
const EDA_ANGLE & GetRotation() const
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.
~SHAPE_ELLIPSE() override=default
void SetCenter(const VECTOR2I &aCenter)
std::vector< VECTOR2I > Intersect(const SHAPE_ELLIPSE &aOther) const
Find the points where this curve crosses another one.
void SetMinorRadius(int aRadius)
double m_invMajorRSq
1 / MajorRadius ^ 2
double m_sinRot
sin(Rotation)
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
VECTOR2D closestLocalPoint(const VECTOR2D &aLocal) const
Point of the curve closest to aLocal, both in the local frame.
void Move(const VECTOR2I &aVector) override
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,...
SHAPE_ELLIPSE & operator=(const SHAPE_ELLIPSE &)=default
int GetMinorRadius() const
bool IsSolid() const override
bool m_isArc
true if open elliptical arc, false if closed ellipse
void SetEndAngle(const EDA_ANGLE &aAngle)
SHAPE_ELLIPSE(const SHAPE_ELLIPSE &aOther)=default
SHAPE * Clone() const override
Return a dynamically allocated copy of the shape.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
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,...
SHAPE(SHAPE_TYPE aType)
Create an empty shape of type aType.
A conic curve Axx x^2 + Axy xy + Ayy y^2 + Bx x + By y + C = 0, written in this ellipse's local frame...
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D