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

#include <eda_angle.h>

Public Member Functions

 EDA_ANGLE (double aValue, EDA_ANGLE_T aAngleType)
 Angles can be created in degrees, 1/10ths of a degree, or radians, and read as any of the angle types. More...
 
constexpr EDA_ANGLE (double aAngleInDegrees)
 Construct an EDA_ANGLE in degrees. More...
 
 EDA_ANGLE (const VECTOR2D &aVector)
 
 EDA_ANGLE (const VECTOR2I &aVector)
 
 EDA_ANGLE ()
 
double AsDegrees () const
 
int AsTenthsOfADegree () const
 
double AsRadians () const
 
bool IsCardinal () const
 
bool IsCardinal90 () const
 
bool IsZero () const
 
bool IsHorizontal () const
 
bool IsVertical () const
 
bool IsParallelTo (EDA_ANGLE aAngle) const
 
EDA_ANGLE Invert () const
 
double Sin () const
 
double Cos () const
 
double Tan () const
 
EDA_ANGLE Normalize ()
 
EDA_ANGLE Normalized () const
 
EDA_ANGLE NormalizeNegative ()
 
EDA_ANGLE Normalize90 ()
 
EDA_ANGLE Normalize180 ()
 
EDA_ANGLE Normalize720 ()
 
EDA_ANGLE KeepUpright () const
 
EDA_ANGLE Round (int digits) const
 
EDA_ANGLEoperator+= (const EDA_ANGLE &aAngle)
 
EDA_ANGLEoperator-= (const EDA_ANGLE &aAngle)
 

Static Public Member Functions

static EDA_ANGLE Arccos (double x)
 
static EDA_ANGLE Arcsin (double x)
 
static EDA_ANGLE Arctan (double x)
 
static EDA_ANGLE Arctan2 (double y, double x)
 

Static Public Attributes

static constexpr double DEGREES_TO_RADIANS = M_PI / 180.0
 

Private Attributes

double m_value
 value in degrees More...
 

Detailed Description

Definition at line 36 of file eda_angle.h.

Constructor & Destructor Documentation

◆ EDA_ANGLE() [1/5]

EDA_ANGLE::EDA_ANGLE ( double  aValue,
EDA_ANGLE_T  aAngleType 
)
inline

Angles can be created in degrees, 1/10ths of a degree, or radians, and read as any of the angle types.

Angle type must be explicitly specified at creation, because there is no other way of knowing what an int or a double represents.

Definition at line 46 of file eda_angle.h.

References DEGREES_TO_RADIANS, m_value, RADIANS_T, and TENTHS_OF_A_DEGREE_T.

◆ EDA_ANGLE() [2/5]

constexpr EDA_ANGLE::EDA_ANGLE ( double  aAngleInDegrees)
inlineconstexpr

Construct an EDA_ANGLE in degrees.

Parameters
aAngleInDegrees

Definition at line 67 of file eda_angle.h.

◆ EDA_ANGLE() [3/5]

EDA_ANGLE::EDA_ANGLE ( const VECTOR2D aVector)
inlineexplicit

Definition at line 69 of file eda_angle.h.

References EDA_ANGLE(), m_value, RADIANS_T, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ EDA_ANGLE() [4/5]

EDA_ANGLE::EDA_ANGLE ( const VECTOR2I aVector)
inlineexplicit

Definition at line 109 of file eda_angle.h.

References EDA_ANGLE(), m_value, RADIANS_T, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ EDA_ANGLE() [5/5]

EDA_ANGLE::EDA_ANGLE ( )
inline

Member Function Documentation

◆ Arccos()

static EDA_ANGLE EDA_ANGLE::Arccos ( double  x)
inlinestatic

Definition at line 244 of file eda_angle.h.

References EDA_ANGLE(), and RADIANS_T.

◆ Arcsin()

static EDA_ANGLE EDA_ANGLE::Arcsin ( double  x)
inlinestatic

Definition at line 246 of file eda_angle.h.

References EDA_ANGLE(), and RADIANS_T.

◆ Arctan()

static EDA_ANGLE EDA_ANGLE::Arctan ( double  x)
inlinestatic

Definition at line 248 of file eda_angle.h.

References EDA_ANGLE(), and RADIANS_T.

◆ Arctan2()

static EDA_ANGLE EDA_ANGLE::Arctan2 ( double  y,
double  x 
)
inlinestatic

Definition at line 250 of file eda_angle.h.

References EDA_ANGLE(), and RADIANS_T.

◆ AsDegrees()

double EDA_ANGLE::AsDegrees ( ) const
inline

Definition at line 155 of file eda_angle.h.

References m_value.

Referenced by std::abs(), DXF_IMPORT_PLUGIN::addEllipse(), PCB_IO_IPC2581::addPad(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), DXF_PLOTTER::Arc(), HPGL_PLOTTER::Arc(), PS_PLOTTER::Arc(), BOOST_AUTO_TEST_CASE(), UNIT_BINDER::ChangeAngleValue(), CADSTAR_PCB_ARCHIVE_LOADER::checkAndLogHatchCode(), CheckArcGeom(), HPGL_PLOTTER::Circle(), TEXT_ATTRIBUTES::Compare(), ConvertArcToPolyline(), ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper(), SHAPE_ARC::ConvertToPolyline(), PROPERTIES_FRAME::CopyPrmsFromItemToPanel(), GENCAD_EXPORTER::CreateComponentsSection(), MICROWAVE_TOOL::createFootprint(), PCB_IO_EASYEDAPRO_PARSER::createPAD(), GENCAD_EXPORTER::CreateShapesSection(), BOARD_ADAPTER::createTrack(), KIGFX::OPENGL_GAL::DrawBitmap(), drawCursorStrings(), EC_CONVERGING::EC_CONVERGING(), EXPORTER_PCB_VRML::ExportVrmlPadHole(), fillArcPOLY(), PCB_IO_KICAD_SEXPR::format(), DS_DATA_MODEL_IO::format(), EDA_UNIT_UTILS::FormatAngle(), DSN::SPECCTRA_DB::FromBOARD(), GetArcToSegmentCount(), EDA_ANGLE_VARIANT_DATA::GetAsAny(), CADSTAR_SCH_ARCHIVE_LOADER::getCadstarAngle(), SCH_SCREEN::GetLabelOrientationForPoint(), PAD::GetMsgPanelInfo(), FOOTPRINT::GetOrientationDegrees(), PAD::GetOrientationDegrees(), EDA_TEXT::GetTextAngleDegrees(), PAD::GetThermalSpokeAngleDegrees(), ARRAY_CIRCULAR_OPTIONS::GetTransform(), PG_UNIT_EDITOR::GetValueFromControl(), hash_fp_item(), HYPERLYNX_PAD_STACK::HYPERLYNX_PAD_STACK(), idf_export_footprint(), idf_export_outline(), Invert(), SHAPE_SEGMENT::Is45Degree(), IsParallelTo(), KeepUpright(), CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(), CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute(), DSN::SPECCTRA_DB::makeIMAGE(), UNITS_PROVIDER::MessageTextFromValue(), EDA_UNIT_UTILS::UI::MessageTextFromValue(), DIALOG_MOVE_EXACT::OnPolarChanged(), DIALOG_POSITION_RELATIVE::OnPolarChanged(), operator!=(), std::hash< TEXT_ATTRIBUTES >::operator()(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator<(), operator<<(), operator<=(), operator==(), operator>(), operator>=(), PCB_IO_EAGLE::orientFPText(), ALTIUM_PCB::ParseComponentsBodies6Data(), DXF_PLOTTER::plotOneLineOfText(), BRDITEMS_PLOTTER::PlotShape(), PCB_REFERENCE_IMAGE::Rotate(), Round(), SCH_IO_KICAD_SEXPR_LIB_CACHE::saveField(), GERBER_PLOTTER::selectAperture(), UNIT_BINDER::SetAngleValue(), UNITS_PROVIDER::StringFromValue(), SVG_PLOTTER::Text(), AR_MATRIX::traceArc(), DIALOG_DRAW_LAYERS_SETTINGS::TransferDataToWindow(), TransformIsClose(), SHAPE_ARC::update_bbox(), PCB_DIM_RADIAL::updateText(), KIGFX::PREVIEW::ARC_ASSISTANT::ViewDraw(), KIGFX::PREVIEW::TWO_POINT_ASSISTANT::ViewDraw(), EDA_ANGLE_VARIANT_DATA::Write(), and zoneNeedsUpdate().

◆ AsRadians()

◆ AsTenthsOfADegree()

◆ Cos()

◆ Invert()

EDA_ANGLE EDA_ANGLE::Invert ( ) const
inline

◆ IsCardinal()

bool EDA_ANGLE::IsCardinal ( ) const
Returns
true if angle is one of the four cardinal directions (0/90/180/270 degrees), otherwise false

Definition at line 40 of file eda_angle.cpp.

References m_value.

Referenced by GERBER_PLOTTER::FlashPadOval(), GERBER_PLOTTER::FlashPadRect(), PCB_TEXTBOX::GetAnchorAndOppositeCorner(), GetOvalKeyPoints(), SCH_LINE::IsOrthogonal(), AR_MATRIX::PlacePad(), and EDA_SHAPE::rotate().

◆ IsCardinal90()

bool EDA_ANGLE::IsCardinal90 ( ) const
Returns
true if angle is one of the two cardinal directions (90/270 degrees), otherwise false

Definition at line 54 of file eda_angle.cpp.

References std::abs(), and m_value.

Referenced by GERBER_PLOTTER::FlashPadOval(), and GERBER_PLOTTER::FlashPadRect().

◆ IsHorizontal()

◆ IsParallelTo()

bool EDA_ANGLE::IsParallelTo ( EDA_ANGLE  aAngle) const
inline

Definition at line 190 of file eda_angle.h.

References AsDegrees(), DEGREES_T, EDA_ANGLE(), and Normalize90().

Referenced by SCH_MOVE_TOOL::orthoLineDrag().

◆ IsVertical()

◆ IsZero()

◆ KeepUpright()

EDA_ANGLE EDA_ANGLE::KeepUpright ( ) const

Definition at line 23 of file eda_angle.cpp.

References AsDegrees(), DEGREES_T, EDA_ANGLE(), and Normalize().

◆ Normalize()

EDA_ANGLE EDA_ANGLE::Normalize ( )
inline

Definition at line 255 of file eda_angle.h.

References m_value.

Referenced by PCB_IO_IPC2581::addPad(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), PLOTTER::Arc(), BOOST_AUTO_TEST_CASE(), SHAPE_ARC::Collide(), EDA_SHAPE::computeArcBBox(), SHAPE_ARC::ConstructFromStartEndCenter(), ALTIUM_PCB::ConvertArcs6ToBoardItemOnLayer(), ALTIUM_PCB::ConvertArcs6ToPcbShape(), ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper(), GENCAD_EXPORTER::CreateComponentsSection(), GENCAD_EXPORTER::CreateShapesSection(), GERBER_PLOTTER::FlashPadOval(), DSN::SPECCTRA_DB::FromBOARD(), PCB_TEXTBOX::GetAnchorAndOppositeCorner(), PCB_ARC::GetArcAngleEnd(), PCB_ARC::GetArcAngleStart(), GERBER_DRAW_ITEM::GetBoundingBox(), PCB_TEXT::GetDrawRotation(), SHAPE_ARC::GetEndAngle(), SHAPE_ARC::GetStartAngle(), HelperShapeLineChainFromAltiumVertices(), EDA_SHAPE::hitTest(), PCB_ARC::HitTest(), GERBER_DRAW_ITEM::HitTest(), BOX2< Vec >::Intersects(), KeepUpright(), PCB_TEXT::KeepUpright(), DSN::SPECCTRA_DB::makeIMAGE(), TRANSFORM::MapAngles(), Normalized(), PCAD2KICAD::PCAD_ARC::Parse(), SCH_IO_KICAD_SEXPR_PARSER::parseArc(), SCH_IO_ALTIUM::ParseArc(), FABMASTER::processArc(), PCB_REFERENCE_IMAGE::Rotate(), PAD::Rotate(), PCB_DIMENSION_BASE::Rotate(), PCB_TEXTBOX::Rotate(), RotatePoint(), PAD::SetOrientation(), SHAPE_ARC::sliceContainsPoint(), STROKE_PARAMS::Stroke(), PLOTTER::ThickArc(), AR_MATRIX::traceArc(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), PCB_DIM_ALIGNED::updateText(), and PCB_DIM_RADIAL::updateText().

◆ Normalize180()

◆ Normalize720()

EDA_ANGLE EDA_ANGLE::Normalize720 ( )
inline

◆ Normalize90()

◆ Normalized()

EDA_ANGLE EDA_ANGLE::Normalized ( ) const
inline

Definition at line 266 of file eda_angle.h.

References Normalize().

Referenced by PCB_TEXTBOX::SetTextAngle().

◆ NormalizeNegative()

EDA_ANGLE EDA_ANGLE::NormalizeNegative ( )
inline

◆ operator+=()

EDA_ANGLE & EDA_ANGLE::operator+= ( const EDA_ANGLE aAngle)
inline

Definition at line 326 of file eda_angle.h.

References AsDegrees(), DEGREES_T, and EDA_ANGLE().

◆ operator-=()

EDA_ANGLE & EDA_ANGLE::operator-= ( const EDA_ANGLE aAngle)
inline

Definition at line 332 of file eda_angle.h.

References AsDegrees(), DEGREES_T, and EDA_ANGLE().

◆ Round()

EDA_ANGLE EDA_ANGLE::Round ( int  digits) const
inline

◆ Sin()

◆ Tan()

double EDA_ANGLE::Tan ( ) const
inline

Definition at line 242 of file eda_angle.h.

References AsRadians().

Member Data Documentation

◆ DEGREES_TO_RADIANS

constexpr double EDA_ANGLE::DEGREES_TO_RADIANS = M_PI / 180.0
staticconstexpr

Definition at line 161 of file eda_angle.h.

Referenced by AsRadians(), and EDA_ANGLE().

◆ m_value


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