KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ELLIPSE< NumericType > Class Template Reference

Plain ellipse / elliptical-arc data. More...

#include <ellipse.h>

Public Member Functions

 ELLIPSE ()
 
 ELLIPSE (const VECTOR2< NumericType > &aCenter, NumericType aMajorRadius, NumericType aMinorRadius, EDA_ANGLE aRotation, EDA_ANGLE aStartAngle=ANGLE_0, EDA_ANGLE aEndAngle=FULL_CIRCLE)
 Constructs an ellipse or elliptical arc.
 
 ELLIPSE (const VECTOR2< NumericType > &aCenter, const VECTOR2< NumericType > &aMajor, double aRatio, EDA_ANGLE aStartAngle=ANGLE_0, EDA_ANGLE aEndAngle=FULL_CIRCLE)
 Constructs a DXF-style ellipse or elliptical arc, where the major axis is given by a point rather than a radius, and therefore defines not only the major radius but also the rotation of the ellipse.
 
void Mirror (const VECTOR2< NumericType > &aRef, FLIP_DIRECTION aFlipDirection)
 Mirror the ellipse along a horizontal or vertical axis passing through aRef.
 
EDA_ANGLE GetSubtendedAngle () const
 Get the subtended angle of the ellipse or elliptical arc at the center.
 
VECTOR2< NumericType > GetPointAtAngle (EDA_ANGLE angle) const
 Get the point on the ellipse at a given angle.
 
VECTOR2< NumericType > GetArcStartPoint () const
 Get the point on the ellipse at the start angle of the arc.
 
VECTOR2< NumericType > GetArcEndPoint () const
 Get the point on the ellipse at the end angle of the arc.
 
EDA_ANGLE GetAngleAtPoint (const VECTOR2< NumericType > &aPt) const
 Get the parametric angle of a point on the ellipse.
 

Public Attributes

VECTOR2< NumericType > Center
 
NumericType MajorRadius
 
NumericType MinorRadius
 
EDA_ANGLE Rotation
 
EDA_ANGLE StartAngle
 
EDA_ANGLE EndAngle
 

Detailed Description

template<typename NumericType>
class ELLIPSE< NumericType >

Plain ellipse / elliptical-arc data.

Used by SHAPE_ELLIPSE, by EDA_SHAPE's native ellipse storage, and by importers that need to round-trip ellipses.

Definition at line 31 of file ellipse.h.

Constructor & Destructor Documentation

◆ ELLIPSE() [1/3]

template<typename NumericType>
ELLIPSE< NumericType >::ELLIPSE ( )
inline

Definition at line 34 of file ellipse.h.

References MajorRadius, and MinorRadius.

◆ ELLIPSE() [2/3]

template<typename NumericType>
ELLIPSE< NumericType >::ELLIPSE ( const VECTOR2< NumericType > & aCenter,
NumericType aMajorRadius,
NumericType aMinorRadius,
EDA_ANGLE aRotation,
EDA_ANGLE aStartAngle = ANGLE_0,
EDA_ANGLE aEndAngle = FULL_CIRCLE )

Constructs an ellipse or elliptical arc.

The ellipse sweeps from aStartAngle to aEndAngle in a counter-clockwise direction.

Parameters
aCenteris the center point of the ellipse.
aMajorRadiusis the radius of the "x-axis" dimension of the ellipse.
aMinorRadiusis the radius of the "y-axis" dimension of the ellipse.
aRotationis the angle of the ellipse "x-axis" relative to world x-axis.
aStartAngleis the starting angle of the elliptical arc.
aEndAngleis the ending angle of the elliptical arc.

Definition at line 26 of file ellipse.cpp.

References Center, EndAngle, MajorRadius, MinorRadius, Rotation, and StartAngle.

◆ ELLIPSE() [3/3]

template<typename NumericType>
ELLIPSE< NumericType >::ELLIPSE ( const VECTOR2< NumericType > & aCenter,
const VECTOR2< NumericType > & aMajor,
double aRatio,
EDA_ANGLE aStartAngle = ANGLE_0,
EDA_ANGLE aEndAngle = FULL_CIRCLE )

Constructs a DXF-style ellipse or elliptical arc, where the major axis is given by a point rather than a radius, and therefore defines not only the major radius but also the rotation of the ellipse.

Parameters
aCenteris the center point of the ellipse.
aMajoris the endpoint of the major axis, relative to the center.
aRatiois the ratio of the minor axis length to the major axis length.
aStartAngleis the starting angle of the elliptical arc.
aEndAngleis the ending angle of the elliptical arc.

Definition at line 40 of file ellipse.cpp.

References Center, EndAngle, VECTOR2< T >::EuclideanNorm(), MajorRadius, MinorRadius, RADIANS_T, Rotation, StartAngle, VECTOR2< T >::x, and VECTOR2< T >::y.

Member Function Documentation

◆ GetAngleAtPoint()

template<typename NumericType>
EDA_ANGLE ELLIPSE< NumericType >::GetAngleAtPoint ( const VECTOR2< NumericType > & aPt) const

Get the parametric angle of a point on the ellipse.

The angle is measured in the ellipse's local coordinate system, where the x-axis is the major axis and the y-axis is the minor axis.

Definition at line 109 of file ellipse.cpp.

References Center, MajorRadius, MinorRadius, RADIANS_T, Rotation, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by EDA_ELLIPSE_POINT_EDIT_BEHAVIOR::parametricAngleOf(), KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER::setEndAngle(), and KIGFX::PREVIEW::ELLIPSE_GEOM_MANAGER::setStartAngle().

◆ GetArcEndPoint()

template<typename NumericType>
VECTOR2< NumericType > ELLIPSE< NumericType >::GetArcEndPoint ( ) const
inline

Get the point on the ellipse at the end angle of the arc.

Definition at line 93 of file ellipse.h.

References EndAngle, and GetPointAtAngle().

Referenced by KIGFX::PREVIEW::ELLIPSE_ASSISTANT::ViewDraw().

◆ GetArcStartPoint()

template<typename NumericType>
VECTOR2< NumericType > ELLIPSE< NumericType >::GetArcStartPoint ( ) const
inline

Get the point on the ellipse at the start angle of the arc.

Definition at line 88 of file ellipse.h.

References GetPointAtAngle(), and StartAngle.

Referenced by KIGFX::PREVIEW::ELLIPSE_ASSISTANT::ViewDraw().

◆ GetPointAtAngle()

template<typename NumericType>
VECTOR2< NumericType > ELLIPSE< NumericType >::GetPointAtAngle ( EDA_ANGLE angle) const

Get the point on the ellipse at a given angle.

The angle is measured in the ellipse's local coordinate system, where the x-axis is the major axis and the y-axis is the minor axis.

Definition at line 90 of file ellipse.cpp.

References EDA_ANGLE::AsRadians(), MajorRadius, MinorRadius, and Rotation.

Referenced by EDA_ELLIPSE_POINT_EDIT_BEHAVIOR::evaluateAt(), GetArcEndPoint(), GetArcStartPoint(), EDA_ELLIPSE_POINT_EDIT_BEHAVIOR::MakePoints(), EDA_ELLIPSE_POINT_EDIT_BEHAVIOR::UpdatePoints(), and KIGFX::PREVIEW::ELLIPSE_ASSISTANT::ViewDraw().

◆ GetSubtendedAngle()

template<typename NumericType>
EDA_ANGLE ELLIPSE< NumericType >::GetSubtendedAngle ( ) const

Get the subtended angle of the ellipse or elliptical arc at the center.

Definition at line 82 of file ellipse.cpp.

Referenced by KIGFX::PREVIEW::ELLIPSE_ASSISTANT::ViewDraw().

◆ Mirror()

template<typename NumericType>
void ELLIPSE< NumericType >::Mirror ( const VECTOR2< NumericType > & aRef,
FLIP_DIRECTION aFlipDirection )

Mirror the ellipse along a horizontal or vertical axis passing through aRef.

Definition at line 54 of file ellipse.cpp.

References Center, EndAngle, LEFT_RIGHT, Rotation, StartAngle, VECTOR2< T >::x, and VECTOR2< T >::y.

Member Data Documentation

◆ Center

◆ EndAngle

◆ MajorRadius

◆ MinorRadius

◆ Rotation

◆ StartAngle

template<typename NumericType>
EDA_ANGLE ELLIPSE< NumericType >::StartAngle

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