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.
 
constexpr EDA_ANGLE (double aAngleInDegrees)
 Construct an EDA_ANGLE in degrees.
 
 EDA_ANGLE (const VECTOR2D &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
 

Detailed Description

Definition at line 36 of file eda_angle.h.

Constructor & Destructor Documentation

◆ EDA_ANGLE() [1/4]

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/4]

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/4]

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/4]

EDA_ANGLE::EDA_ANGLE ( )
inline

Member Function Documentation

◆ Arccos()

static EDA_ANGLE EDA_ANGLE::Arccos ( double  x)
inlinestatic

Definition at line 210 of file eda_angle.h.

References EDA_ANGLE(), and RADIANS_T.

Referenced by DRC_TEST_PROVIDER_TRACK_ANGLE::Run().

◆ Arcsin()

static EDA_ANGLE EDA_ANGLE::Arcsin ( double  x)
inlinestatic

Definition at line 212 of file eda_angle.h.

References EDA_ANGLE(), and RADIANS_T.

◆ Arctan()

static EDA_ANGLE EDA_ANGLE::Arctan ( double  x)
inlinestatic

Definition at line 214 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 216 of file eda_angle.h.

References EDA_ANGLE(), and RADIANS_T.

◆ AsDegrees()

double EDA_ANGLE::AsDegrees ( ) const
inline

Definition at line 113 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(), GERBER_PLOTTER::Arc(), HPGL_PLOTTER::Arc(), PS_PLOTTER::Arc(), PNS::ArcHull(), BOOST_AUTO_TEST_CASE(), boost_test_print_type(), UNIT_BINDER::ChangeAngleValue(), CADSTAR_PCB_ARCHIVE_LOADER::checkAndLogHatchCode(), CheckArcGeom(), HPGL_PLOTTER::Circle(), TEXT_ATTRIBUTES::Compare(), ALTIUM_PCB::ConvertArcs6ToBoardItemOnLayer(), ConvertArcToPolyline(), ALTIUM_PCB::ConvertComponentBody6ToFootprintItem(), 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::createTrackWithMargin(), KIGFX::OPENGL_GAL::DrawBitmap(), EC_CONVERGING::EC_CONVERGING(), EXPORTER_PCB_VRML::ExportVrmlPadHole(), PCB_IO_KICAD_SEXPR::format(), DS_DATA_MODEL_IO::format(), EDA_UNIT_UTILS::FormatAngle(), DSN::SPECCTRA_DB::FromBOARD(), GetArcToSegmentCount(), EDA_ANGLE_VARIANT_DATA::GetAsAny(), IMPORTED_ARC::GetBoundingBox(), CADSTAR_SCH_ARCHIVE_LOADER::getCadstarAngle(), KIGFX::PREVIEW::RULER_ITEM::GetDimensionStrings(), 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(), HelperShapeLineChainFromAltiumVertices(), 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(), DIALOG_SET_OFFSET::OnPolarChanged(), operator!=(), std::hash< TEXT_ATTRIBUTES >::operator()(), operator*(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator<(), operator<<(), operator<=(), operator==(), operator>(), operator>=(), PCB_IO_EAGLE::orientFPText(), padNeedsUpdate(), ALTIUM_PCB::ParseComponentsBodies6Data(), DXF_PLOTTER::plotOneLineOfText(), BRDITEMS_PLOTTER::PlotShape(), REFERENCE_IMAGE::Rotate(), Round(), DRC_TEST_PROVIDER_TRACK_ANGLE::Run(), SCH_IO_KICAD_SEXPR_LIB_CACHE::saveField(), GERBER_PLOTTER::selectAperture(), PADSTACK::Serialize(), ZONE::Serialize(), UNIT_BINDER::SetAngleValue(), UNITS_PROVIDER::StringFromValue(), SVG_PLOTTER::Text(), SPICE_VALUE::ToString(), AR_MATRIX::traceArc(), DIALOG_DRAW_LAYERS_SETTINGS::TransferDataToWindow(), TransformIsClose(), SHAPE_ARC::update_values(), PCB_DIM_RADIAL::updateText(), ARC_GEOM_SYNCER::Validate(), KIGFX::PREVIEW::ARC_ASSISTANT::ViewDraw(), KIGFX::PREVIEW::TWO_POINT_ASSISTANT::ViewDraw(), EDA_ANGLE_VARIANT_DATA::Write(), ODB_PAD::WriteRecordContent(), and zoneNeedsUpdate().

◆ AsRadians()

◆ AsTenthsOfADegree()

◆ Cos()

◆ Invert()

EDA_ANGLE EDA_ANGLE::Invert ( ) const
inline

◆ IsCardinal()

◆ 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 ALTIUM_PCB::ConvertFills6ToFootprintItemOnLayer(), GERBER_PLOTTER::FlashPadOval(), and GERBER_PLOTTER::FlashPadRect().

◆ IsHorizontal()

◆ IsParallelTo()

bool EDA_ANGLE::IsParallelTo ( EDA_ANGLE  aAngle) const
inline

Definition at line 148 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 221 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(), PCB_TEXT::KeepUpright(), KeepUpright(), DSN::SPECCTRA_DB::makeIMAGE(), TRANSFORM::MapAngles(), Normalized(), padNeedsUpdate(), PCAD2KICAD::PCAD_ARC::Parse(), SCH_IO_KICAD_SEXPR_PARSER::parseSymbolArc(), FABMASTER::processArc(), REFERENCE_IMAGE::Rotate(), PCB_DIMENSION_BASE::Rotate(), PCB_TEXTBOX::Rotate(), RotatePoint(), PADSTACK::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(), PCB_DIM_RADIAL::updateText(), and ODB_PAD::WriteRecordContent().

◆ Normalize180()

◆ Normalize720()

EDA_ANGLE EDA_ANGLE::Normalize720 ( )
inline

◆ Normalize90()

◆ Normalized()

EDA_ANGLE EDA_ANGLE::Normalized ( ) const
inline

Definition at line 232 of file eda_angle.h.

References Normalize().

Referenced by FABMASTER::loadFootprints(), and PCB_TEXTBOX::SetTextAngle().

◆ NormalizeNegative()

EDA_ANGLE EDA_ANGLE::NormalizeNegative ( )
inline

◆ operator+=()

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

Definition at line 292 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 298 of file eda_angle.h.

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

◆ Round()

EDA_ANGLE EDA_ANGLE::Round ( int  digits) const
inline

Definition at line 284 of file eda_angle.h.

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

◆ Sin()

◆ Tan()

double EDA_ANGLE::Tan ( ) const
inline

Definition at line 208 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 119 of file eda_angle.h.

Referenced by AsRadians(), and EDA_ANGLE().

◆ m_value


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