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

Class that represents an oval shape (rectangle with semicircular end caps) More...

#include <oval.h>

Public Member Functions

 OVAL (const SEG &aSeg, int aWidth)
 Create an oval from the segment joining the centers of the semicircles and the diameter of the semicircles.
 
 OVAL (const VECTOR2I &aOverallSize, const VECTOR2I &aCenter, const EDA_ANGLE &aRotation)
 Create an oval from the overall size, the center of the oval, and the rotation.
 
BOX2I BBox (int aClearance) const
 Get the bounding box of the oval.
 
int GetWidth () const
 Get the width of the oval (diameter of the semicircles)
 
int GetLength () const
 Get the overall length of the oval from endcap tip to endcap tip.
 
int GetSideLength () const
 Get the side length of the oval (=length between the centers of the semicircles)
 
VECTOR2I GetCenter () const
 Get the center point of the oval.
 
const SEGGetSegment () const
 Get the central segment of the oval.
 
EDA_ANGLE GetAngle () const
 Get the angle of the oval's central segment.
 

Private Attributes

SEG m_seg
 
int m_width
 

Detailed Description

Class that represents an oval shape (rectangle with semicircular end caps)

This is not a full-blown SHAPE (yet), but can be used for some simple purposes, as well as for type-based logic.

Definition at line 44 of file oval.h.

Constructor & Destructor Documentation

◆ OVAL() [1/2]

OVAL::OVAL ( const SEG aSeg,
int  aWidth 
)

Create an oval from the segment joining the centers of the semicircles and the diameter of the semicircles.

Definition at line 35 of file oval.cpp.

◆ OVAL() [2/2]

OVAL::OVAL ( const VECTOR2I aOverallSize,
const VECTOR2I aCenter,
const EDA_ANGLE aRotation 
)

Create an oval from the overall size, the center of the oval, and the rotation.

The shorter dimension is the width of the semicircles.

Definition at line 41 of file oval.cpp.

References m_seg, m_width, RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.

Member Function Documentation

◆ BBox()

BOX2I OVAL::BBox ( int  aClearance) const

Get the bounding box of the oval.

Definition at line 58 of file oval.cpp.

References SEG::A, SEG::B, BOX2< VECTOR2I >::ByCorners(), LexicographicalMax(), LexicographicalMin(), m_seg, and m_width.

◆ GetAngle()

EDA_ANGLE OVAL::GetAngle ( ) const
inline

Get the angle of the oval's central segment.

The direction is aligned with the segment start/end

Definition at line 97 of file oval.h.

References SEG::A, SEG::B, and m_seg.

Referenced by KIGEOM::GetOvalKeyPoints().

◆ GetCenter()

VECTOR2I OVAL::GetCenter ( ) const
inline

Get the center point of the oval.

Definition at line 83 of file oval.h.

References SEG::Center(), and m_seg.

Referenced by KIGEOM::GetOvalKeyPoints().

◆ GetLength()

int OVAL::GetLength ( ) const
inline

Get the overall length of the oval from endcap tip to endcap tip.

Definition at line 73 of file oval.h.

References SEG::Length(), m_seg, and m_width.

Referenced by KIGEOM::GetOvalKeyPoints().

◆ GetSegment()

const SEG & OVAL::GetSegment ( ) const
inline

Get the central segment of the oval.

(Endpoint are the centers of the semicircles)

Definition at line 90 of file oval.h.

References m_seg.

Referenced by KIGEOM::ConvertToChain().

◆ GetSideLength()

int OVAL::GetSideLength ( ) const
inline

Get the side length of the oval (=length between the centers of the semicircles)

Definition at line 78 of file oval.h.

References SEG::Length(), and m_seg.

◆ GetWidth()

int OVAL::GetWidth ( ) const
inline

Get the width of the oval (diameter of the semicircles)

Definition at line 68 of file oval.h.

References m_width.

Referenced by KIGEOM::ConvertToChain(), and KIGEOM::GetOvalKeyPoints().

Member Data Documentation

◆ m_seg

SEG OVAL::m_seg
private

Definition at line 100 of file oval.h.

Referenced by BBox(), GetAngle(), GetCenter(), GetLength(), GetSegment(), GetSideLength(), and OVAL().

◆ m_width

int OVAL::m_width
private

Definition at line 101 of file oval.h.

Referenced by BBox(), GetLength(), GetWidth(), and OVAL().


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