|
KiCad PCB EDA Suite
|
A segment as used in IDFv3 outlines. More...
#include <idf_common.h>
Public Member Functions | |
| IDF_SEGMENT () | |
| Initialize the internal variables. | |
| IDF_SEGMENT (const IDF_POINT &aStartPoint, const IDF_POINT &aEndPoint) | |
| Create a straight segment. | |
| IDF_SEGMENT (const IDF_POINT &aStartPoint, const IDF_POINT &aEndPoint, double aAngle, bool aFromKicad) | |
| Create a straight segment, arc, or circle depending on the angle. | |
| bool | MatchesStart (const IDF_POINT &aPoint, double aRadius=1e-3) |
| Return true if the given coordinate is within a radius 'rad' of the start point. | |
| bool | MatchesEnd (const IDF_POINT &aPoint, double aRadius=1e-3) |
| Return true if the given coordinate is within a radius 'rad' of the end point. | |
| bool | IsCircle () |
| double | GetMinX () |
| void | SwapEnds () |
| Swap the start and end points and alters internal variables as necessary for arcs. | |
Public Attributes | |
| IDF_POINT | startPoint |
| starting point coordinates in mm | |
| IDF_POINT | endPoint |
| end point coordinates in mm | |
| IDF_POINT | center |
| center of an arc or circle; internally calculated and not to be set by the user. | |
| double | angle |
| included angle (degrees) according to IDFv3 specification | |
| double | offsetAngle |
| angle between center and start of arc; internally calculated | |
| double | radius |
| radius of the arc or circle; internally calculated | |
Private Member Functions | |
| void | CalcCenterAndRadius () |
A segment as used in IDFv3 outlines.
It may be any of an arc, line segment, or circle
Definition at line 467 of file idf_common.h.
| IDF_SEGMENT::IDF_SEGMENT | ( | ) |
Initialize the internal variables.
Definition at line 993 of file idf_common.cpp.
References angle, offsetAngle, and radius.
Create a straight segment.
Definition at line 1001 of file idf_common.cpp.
References angle, endPoint, offsetAngle, radius, and startPoint.
| IDF_SEGMENT::IDF_SEGMENT | ( | const IDF_POINT & | aStartPoint, |
| const IDF_POINT & | aEndPoint, | ||
| double | aAngle, | ||
| bool | aFromKicad ) |
Create a straight segment, arc, or circle depending on the angle.
| aStartPoint | is the start point (center if using KiCad convention, otherwise IDF convention) |
| aEndPoint | is the end point (start of arc if using KiCad convention, otherwise IDF convention) |
| aAngle | is the included angle; the KiCad convention is equivalent to the IDF convention |
| fromKicad | set to true if we need to convert from KiCad to IDF convention. |
Definition at line 1011 of file idf_common.cpp.
References std::abs(), angle, IDF3::CalcAngleDeg(), CalcCenterAndRadius(), IDF_POINT::CalcDistance(), center, endPoint, M_PI, MIN_ANG, offsetAngle, radius, and startPoint.
|
private |
Definition at line 1073 of file idf_common.cpp.
References angle, IDF3::CalcAngleDeg(), IDF3::CalcAngleRad(), center, endPoint, M_PI, offsetAngle, radius, and startPoint.
Referenced by IDF_SEGMENT().
| double IDF_SEGMENT::GetMinX | ( | ) |
Definition at line 1125 of file idf_common.cpp.
References angle, center, endPoint, IsCircle(), offsetAngle, radius, and startPoint.
| bool IDF_SEGMENT::IsCircle | ( | ) |
Definition at line 1114 of file idf_common.cpp.
References std::abs(), angle, and MIN_ANG.
Referenced by addSegment(), GetMinX(), IDF3::GetOutline(), IDF_OUTLINE::push(), BOARD_OUTLINE::readOutlines(), SwapEnds(), and BOARD_OUTLINE::writeOutline().
| bool IDF_SEGMENT::MatchesEnd | ( | const IDF_POINT & | aPoint, |
| double | aRadius = 1e-3 ) |
Return true if the given coordinate is within a radius 'rad' of the end point.
| aPoint | are the coordinates (mm) of the point being compared. |
| aRadius | is the radius (mm) within which the points are considered the same. |
Definition at line 1067 of file idf_common.cpp.
References endPoint.
| bool IDF_SEGMENT::MatchesStart | ( | const IDF_POINT & | aPoint, |
| double | aRadius = 1e-3 ) |
Return true if the given coordinate is within a radius 'rad' of the start point.
| aPoint | are the coordinates of the point (mm) being compared. |
| aRadius | is the radius (mm) within which the points are considered the same. |
Definition at line 1061 of file idf_common.cpp.
References startPoint.
Referenced by IDF3::GetOutline(), and IDF_OUTLINE::push().
| void IDF_SEGMENT::SwapEnds | ( | ) |
Swap the start and end points and alters internal variables as necessary for arcs.
Definition at line 1161 of file idf_common.cpp.
References angle, IDF3::CalcAngleDeg(), center, endPoint, IsCircle(), MIN_ANG, offsetAngle, and startPoint.
| double IDF_SEGMENT::angle |
included angle (degrees) according to IDFv3 specification
Definition at line 541 of file idf_common.h.
Referenced by addSegment(), CalcCenterAndRadius(), GetMinX(), IDF3::GetOutline(), IDF_SEGMENT(), IDF_SEGMENT(), IDF_SEGMENT(), IsCircle(), SwapEnds(), and BOARD_OUTLINE::writeOutline().
| IDF_POINT IDF_SEGMENT::center |
center of an arc or circle; internally calculated and not to be set by the user.
Definition at line 540 of file idf_common.h.
Referenced by addSegment(), CalcCenterAndRadius(), GetMinX(), IDF_SEGMENT(), and SwapEnds().
| IDF_POINT IDF_SEGMENT::endPoint |
end point coordinates in mm
Definition at line 537 of file idf_common.h.
Referenced by CalcCenterAndRadius(), GetMinX(), IDF3::GetOutline(), IDF_SEGMENT(), IDF_SEGMENT(), MatchesEnd(), SwapEnds(), and BOARD_OUTLINE::writeOutline().
| double IDF_SEGMENT::offsetAngle |
angle between center and start of arc; internally calculated
Definition at line 542 of file idf_common.h.
Referenced by addSegment(), CalcCenterAndRadius(), GetMinX(), IDF_SEGMENT(), IDF_SEGMENT(), IDF_SEGMENT(), and SwapEnds().
| double IDF_SEGMENT::radius |
radius of the arc or circle; internally calculated
Definition at line 543 of file idf_common.h.
Referenced by addSegment(), CalcCenterAndRadius(), GetMinX(), IDF_SEGMENT(), IDF_SEGMENT(), and IDF_SEGMENT().
| IDF_POINT IDF_SEGMENT::startPoint |
starting point coordinates in mm
Definition at line 536 of file idf_common.h.
Referenced by addSegment(), CalcCenterAndRadius(), GetMinX(), IDF3::GetOutline(), IDF_SEGMENT(), IDF_SEGMENT(), MatchesStart(), IDF_OUTLINE::push(), BOARD_OUTLINE::readOutlines(), SwapEnds(), and BOARD_OUTLINE::writeOutline().