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...
 
 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_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
 
static EDA_ANGLE m_Angle0 = EDA_ANGLE( 0, DEGREES_T )
 
static EDA_ANGLE m_Angle45 = EDA_ANGLE( 45, DEGREES_T )
 
static EDA_ANGLE m_Angle90 = EDA_ANGLE( 90, DEGREES_T )
 
static EDA_ANGLE m_Angle135 = EDA_ANGLE( 135, DEGREES_T )
 
static EDA_ANGLE m_Angle180 = EDA_ANGLE( 180, DEGREES_T )
 
static EDA_ANGLE m_Angle270 = EDA_ANGLE( 270, DEGREES_T )
 
static EDA_ANGLE m_Angle360 = EDA_ANGLE( 360, DEGREES_T )
 

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

EDA_ANGLE::EDA_ANGLE ( const VECTOR2D aVector)
inlineexplicit

Definition at line 63 of file eda_angle.h.

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

◆ EDA_ANGLE() [3/4]

EDA_ANGLE::EDA_ANGLE ( const VECTOR2I aVector)
inlineexplicit

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

References EDA_ANGLE(), and RADIANS_T.

◆ Arcsin()

static EDA_ANGLE EDA_ANGLE::Arcsin ( double  x)
inlinestatic

Definition at line 240 of file eda_angle.h.

References EDA_ANGLE(), and RADIANS_T.

◆ Arctan()

static EDA_ANGLE EDA_ANGLE::Arctan ( double  x)
inlinestatic

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

References EDA_ANGLE(), and RADIANS_T.

◆ AsDegrees()

double EDA_ANGLE::AsDegrees ( ) const
inline

Definition at line 149 of file eda_angle.h.

References m_value.

Referenced by std::abs(), DXF_IMPORT_PLUGIN::addEllipse(), 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(), CreateComponentsSection(), MICROWAVE_TOOL::createFootprint(), CreateShapesSection(), BOARD_ADAPTER::createTrack(), KIGFX::OPENGL_GAL::DrawBitmap(), drawCursorStrings(), EC_CONVERGING::EC_CONVERGING(), EXPORTER_PCB_VRML::ExportVrmlPadHole(), fillArcPOLY(), PCB_PLUGIN::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>=(), EAGLE_PLUGIN::orientFPText(), padHasOverrides(), ALTIUM_PCB::ParseComponentsBodies6Data(), DXF_PLOTTER::plotOneLineOfText(), BRDITEMS_PLOTTER::PlotPcbShape(), PCB_BITMAP::Rotate(), SCH_SEXPR_PLUGIN_CACHE::saveField(), GERBER_PLOTTER::selectAperture(), UNIT_BINDER::SetAngleValue(), SHAPE_ARC::sliceContainsPoint(), UNITS_PROVIDER::StringFromValue(), SVG_PLOTTER::Text(), AR_MATRIX::traceArc(), 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 49 of file eda_angle.cpp.

References m_value.

Referenced by GERBER_PLOTTER::FlashPadOval(), GERBER_PLOTTER::FlashPadRect(), 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 63 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 184 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 32 of file eda_angle.cpp.

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

◆ Normalize()

EDA_ANGLE EDA_ANGLE::Normalize ( )
inline

Definition at line 249 of file eda_angle.h.

References m_value.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), PLOTTER::Arc(), PDF_PLOTTER::Arc(), BOOST_AUTO_TEST_CASE(), EDA_SHAPE::CalcArcAngles(), SHAPE_ARC::Collide(), EDA_SHAPE::computeArcBBox(), SHAPE_ARC::ConstructFromStartEndCenter(), ALTIUM_PCB::ConvertArcs6ToBoardItemOnLayer(), ALTIUM_PCB::ConvertArcs6ToPcbShape(), ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper(), CreateComponentsSection(), 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_SEXPR_PARSER::parseArc(), SCH_ALTIUM_PLUGIN::ParseArc(), FABMASTER::processArc(), PCB_BITMAP::Rotate(), PAD::Rotate(), PCB_DIMENSION_BASE::Rotate(), PCB_TEXTBOX::Rotate(), RotatePoint(), PAD::SetOrientation(), STROKE_PARAMS::Stroke(), GERBER_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 260 of file eda_angle.h.

References Normalize().

Referenced by PCB_TEXTBOX::SetTextAngle().

◆ NormalizeNegative()

EDA_ANGLE EDA_ANGLE::NormalizeNegative ( )
inline

Definition at line 266 of file eda_angle.h.

References m_value.

Referenced by BOOST_AUTO_TEST_CASE(), and CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex().

◆ operator+=()

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

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

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

◆ Sin()

◆ Tan()

double EDA_ANGLE::Tan ( ) const
inline

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

Referenced by AsRadians(), and EDA_ANGLE().

◆ m_Angle0

EDA_ANGLE EDA_ANGLE::m_Angle0 = EDA_ANGLE( 0, DEGREES_T )
static

Definition at line 328 of file eda_angle.h.

Referenced by BOOST_AUTO_TEST_CASE().

◆ m_Angle135

EDA_ANGLE EDA_ANGLE::m_Angle135 = EDA_ANGLE( 135, DEGREES_T )
static

Definition at line 331 of file eda_angle.h.

◆ m_Angle180

EDA_ANGLE EDA_ANGLE::m_Angle180 = EDA_ANGLE( 180, DEGREES_T )
static

Definition at line 332 of file eda_angle.h.

◆ m_Angle270

EDA_ANGLE EDA_ANGLE::m_Angle270 = EDA_ANGLE( 270, DEGREES_T )
static

Definition at line 333 of file eda_angle.h.

◆ m_Angle360

EDA_ANGLE EDA_ANGLE::m_Angle360 = EDA_ANGLE( 360, DEGREES_T )
static

Definition at line 334 of file eda_angle.h.

◆ m_Angle45

EDA_ANGLE EDA_ANGLE::m_Angle45 = EDA_ANGLE( 45, DEGREES_T )
static

Definition at line 329 of file eda_angle.h.

◆ m_Angle90

EDA_ANGLE EDA_ANGLE::m_Angle90 = EDA_ANGLE( 90, DEGREES_T )
static

Definition at line 330 of file eda_angle.h.

◆ m_value


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