KiCad PCB EDA Suite
|
Go to the source code of this file.
Enumerations | |
enum | RECT_CHAMFER_POSITIONS : int { RECT_NO_CHAMFER = 0 , RECT_CHAMFER_TOP_LEFT = 1 , RECT_CHAMFER_TOP_RIGHT = 2 , RECT_CHAMFER_BOTTOM_LEFT = 4 , RECT_CHAMFER_BOTTOM_RIGHT = 8 , RECT_CHAMFER_ALL } |
Functions | |
int | ConvertArcToPolyline (SHAPE_LINE_CHAIN &aPolyline, VECTOR2I aCenter, int aRadius, const EDA_ANGLE &aStartAngleDeg, const EDA_ANGLE &aArcAngleDeg, double aAccuracy, ERROR_LOC aErrorLoc) |
Generate a polyline to approximate a arc. | |
void | TransformCircleToPolygon (SHAPE_LINE_CHAIN &aBuffer, const VECTOR2I &aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0) |
Convert a circle to a polygon, using multiple straight lines. | |
void | TransformCircleToPolygon (SHAPE_POLY_SET &aBuffer, const VECTOR2I &aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0) |
Convert a circle to a polygon, using multiple straight lines. | |
void | TransformOvalToPolygon (SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0) |
Convert a oblong shape to a polygon, using multiple segments. | |
void | TransformTrapezoidToPolygon (SHAPE_POLY_SET &aBuffer, const VECTOR2I &aPosition, const VECTOR2I &aSize, const EDA_ANGLE &aRotation, int aDeltaX, int aDeltaY, int aInflate, int aError, ERROR_LOC aErrorLoc) |
Convert a rectangle or trapezoid to a polygon. | |
void | TransformRoundChamferedRectToPolygon (SHAPE_POLY_SET &aBuffer, const VECTOR2I &aPosition, const VECTOR2I &aSize, const EDA_ANGLE &aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aInflate, int aError, ERROR_LOC aErrorLoc) |
Convert a rectangle with rounded corners and/or chamfered corners to a polygon. | |
void | TransformArcToPolygon (SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc) |
Convert arc to multiple straight segments. | |
void | TransformRingToPolygon (SHAPE_POLY_SET &aBuffer, const VECTOR2I &aCentre, int aRadius, int aWidth, int aError, ERROR_LOC aErrorLoc) |
Convert arcs to multiple straight segments. | |
enum RECT_CHAMFER_POSITIONS : int |
Enumerator | |
---|---|
RECT_NO_CHAMFER | |
RECT_CHAMFER_TOP_LEFT | |
RECT_CHAMFER_TOP_RIGHT | |
RECT_CHAMFER_BOTTOM_LEFT | |
RECT_CHAMFER_BOTTOM_RIGHT | |
RECT_CHAMFER_ALL |
Definition at line 36 of file convert_basic_shapes_to_polygon.h.
int ConvertArcToPolyline | ( | SHAPE_LINE_CHAIN & | aPolyline, |
VECTOR2I | aCenter, | ||
int | aRadius, | ||
const EDA_ANGLE & | aStartAngleDeg, | ||
const EDA_ANGLE & | aArcAngleDeg, | ||
double | aAccuracy, | ||
ERROR_LOC | aErrorLoc | ||
) |
Generate a polyline to approximate a arc.
aPolyline | is a buffer to store the polyline. |
aCenter | is the center of the arc. |
aRadius | is the radius of the arc. |
aStartAngleDeg | is the starting point of the arc. |
aArcAngleDeg | is the angle of the arc. |
aError | is the internal units allowed for error approximation. |
aErrorLoc | determines if the approximation error be placed outside or inside the polygon. |
Definition at line 519 of file convert_basic_shapes_to_polygon.cpp.
References std::abs(), SHAPE_LINE_CHAIN::Append(), EDA_ANGLE::AsDegrees(), CircleToEndSegmentDeltaRadius(), EDA_ANGLE::Cos(), delta, ERROR_INSIDE, GetArcToSegmentCount(), KiROUND(), EDA_ANGLE::Sin(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by DSN::SPECCTRA_DB::makeIMAGE(), and TransformArcToPolygon().
void TransformArcToPolygon | ( | SHAPE_POLY_SET & | aBuffer, |
const VECTOR2I & | aStart, | ||
const VECTOR2I & | aMid, | ||
const VECTOR2I & | aEnd, | ||
int | aWidth, | ||
int | aError, | ||
ERROR_LOC | aErrorLoc | ||
) |
Convert arc to multiple straight segments.
aBuffer | is a buffer to store the polygon. |
aCentre | is the center of the arc or circle. |
aStart | is the start point of the arc or a point on the circle. |
aArcAngle | is the arc angle in 0.1 degrees. For a circle, aArcAngle = 3600. |
aWidth | is the width (thickness) of the line. |
aError | is the internal units allowed for error in approximation. |
aErrorLoc | determines if the approximation error be placed outside or inside the polygon. |
Definition at line 580 of file convert_basic_shapes_to_polygon.cpp.
References ANGLE_0, ANGLE_180, SHAPE_POLY_SET::Append(), ConvertArcToPolyline(), SEG::Distance(), ERROR_INSIDE, ERROR_OUTSIDE, SHAPE_ARC::GetCenter(), SHAPE_ARC::GetCentralAngle(), SHAPE_ARC::GetP0(), SHAPE_ARC::GetP1(), SHAPE_ARC::GetRadius(), SHAPE_ARC::GetStartAngle(), SHAPE_ARC::GetWidth(), SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::Outline(), and TransformOvalToPolygon().
Referenced by BOOST_AUTO_TEST_CASE(), KIGFX::PCB_PAINTER::draw(), CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), EDA_SHAPE::TransformShapeToPolygon(), PCB_TRACK::TransformShapeToPolygon(), and SHAPE_ARC::TransformToPolygon().
void TransformCircleToPolygon | ( | SHAPE_LINE_CHAIN & | aBuffer, |
const VECTOR2I & | aCenter, | ||
int | aRadius, | ||
int | aError, | ||
ERROR_LOC | aErrorLoc, | ||
int | aMinSegCount = 0 |
||
) |
Convert a circle to a polygon, using multiple straight lines.
aBuffer | is a buffer to store the polygon. |
aCenter | is the center of the circle. |
aRadius | is the radius of the circle. |
aError | is the internal units allowed for error approximation. |
aErrorLoc | determines if the approximation error be placed outside or inside the polygon. |
aMinSegCount | is the min count of segments to approximate. Default = 0 to do not force a min count. |
Definition at line 38 of file convert_basic_shapes_to_polygon.cpp.
References ANGLE_360, SHAPE_LINE_CHAIN::Append(), CircleToEndSegmentDeltaRadius(), delta, ERROR_OUTSIDE, FULL_CIRCLE, GetArcToSegmentCount(), GetCircleToPolyCorrection(), RotatePoint(), SHAPE_LINE_CHAIN::SetClosed(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), addHoleToPolygon(), ZONE_FILLER::buildCopperItemClearances(), TEARDROP_MANAGER::computeAnchorPoints(), AM_PRIMITIVE::ConvertBasicShapeToPolygon(), D_CODE::ConvertShapeToPolygon(), BOARD_ADAPTER::createLayers(), TEARDROP_MANAGER::findAnchorPointsOnTrack(), RENDER_3D_OPENGL::generateViasAndPads(), DSN::SPECCTRA_DB::makeIMAGE(), PAD::MergePrimitivesAsPolygon(), PCB_IO_EASYEDAPRO_PARSER::ParseContour(), TransformRingToPolygon(), EDA_SHAPE::TransformShapeToPolygon(), PCB_DIMENSION_BASE::TransformShapeToPolygon(), PCB_TRACK::TransformShapeToPolygon(), PAD::TransformShapeToPolygon(), and SHAPE_CIRCLE::TransformToPolygon().
void TransformCircleToPolygon | ( | SHAPE_POLY_SET & | aBuffer, |
const VECTOR2I & | aCenter, | ||
int | aRadius, | ||
int | aError, | ||
ERROR_LOC | aErrorLoc, | ||
int | aMinSegCount = 0 |
||
) |
Convert a circle to a polygon, using multiple straight lines.
aBuffer | is a buffer to store the polygon. |
aCenter | is the center of the circle. |
aRadius | is the radius of the circle. |
aError | is the internal units allowed for error in approximation. |
aErrorLoc | determines if the approximation error be placed outside or inside the polygon. |
aMinSegCount | is the min count of segments to approximate. Default = 0 to do not force a min count. |
Definition at line 73 of file convert_basic_shapes_to_polygon.cpp.
References ANGLE_360, SHAPE_POLY_SET::Append(), CircleToEndSegmentDeltaRadius(), delta, ERROR_OUTSIDE, FULL_CIRCLE, GetArcToSegmentCount(), GetCircleToPolyCorrection(), SHAPE_POLY_SET::NewOutline(), RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.
void TransformOvalToPolygon | ( | SHAPE_POLY_SET & | aBuffer, |
const VECTOR2I & | aStart, | ||
const VECTOR2I & | aEnd, | ||
int | aWidth, | ||
int | aError, | ||
ERROR_LOC | aErrorLoc, | ||
int | aMinSegCount = 0 |
||
) |
Convert a oblong shape to a polygon, using multiple segments.
It is similar to TransformRoundedEndsSegmentToPolygon, but the polygon is outside the actual oblong shape (a segment with rounded ends). It is suitable to create oblong clearance areas because multiple segments create a smaller area than the circle. The radius of the circle to approximate must be bigger ( radius*aCorrectionFactor) to create segments outside the circle.
aBuffer | is a buffer to store the polygon. |
aStart | is the first point of the segment. |
aEnd | is the second point of the segment. |
aWidth | is the width of the segment. |
aError | is the internal units allowed for error in approximation. |
aErrorLoc | determines if the approximation error be placed outside or inside the polygon. |
aMinSegCount | is the min count of segments to approximate. Default = 0 to do not force a min count. |
Definition at line 115 of file convert_basic_shapes_to_polygon.cpp.
References ANGLE_180, ANGLE_360, SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::BooleanIntersection(), CircleToEndSegmentDeltaRadius(), correction, delta, ERROR_OUTSIDE, VECTOR2< T >::EuclideanNorm(), FULL_CIRCLE, GetArcToSegmentCount(), GetCircleToPolyCorrection(), SHAPE_POLY_SET::Move(), SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, SHAPE_POLY_SET::Rotate(), RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by buildPadOutlineAsPolygon(), PAD::doCheckPad(), CALLBACK_GAL::DrawGlyph(), CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), PCB_IO_KICAD_SEXPR_PARSER::parseZONE(), DXF_PLOTTER::PlotPoly(), DXF_PLOTTER::ThickSegment(), TransformArcToPolygon(), PAD::TransformHoleToPolygon(), EDA_SHAPE::TransformShapeToPolygon(), PCB_DIMENSION_BASE::TransformShapeToPolygon(), PCB_TRACK::TransformShapeToPolygon(), PCB_TEXTBOX::TransformShapeToPolygon(), PAD::TransformShapeToPolygon(), PCB_TEXT::TransformTextToPolySet(), PCB_TEXTBOX::TransformTextToPolySet(), and SHAPE_SEGMENT::TransformToPolygon().
void TransformRingToPolygon | ( | SHAPE_POLY_SET & | aBuffer, |
const VECTOR2I & | aCentre, | ||
int | aRadius, | ||
int | aWidth, | ||
int | aError, | ||
ERROR_LOC | aErrorLoc | ||
) |
Convert arcs to multiple straight segments.
aBuffer | is a buffer to store the polygon. |
aCentre | is the center of the arc or circle. |
aRadius | is the radius of the circle. |
aWidth | is the width (thickness) of the ring. |
aError | is the internal units allowed for error in approximation. |
aErrorLoc | determines if the approximation error be placed outside or inside the polygon. |
Definition at line 642 of file convert_basic_shapes_to_polygon.cpp.
References SHAPE_POLY_SET::Append(), ERROR_INSIDE, ERROR_OUTSIDE, SHAPE_POLY_SET::Fracture(), SHAPE_POLY_SET::Hole(), SHAPE_POLY_SET::NewHole(), SHAPE_POLY_SET::PM_FAST, and TransformCircleToPolygon().
Referenced by buildPadOutlineAsPolygon(), AM_PRIMITIVE::ConvertBasicShapeToPolygon(), and EDA_SHAPE::TransformShapeToPolygon().
void TransformRoundChamferedRectToPolygon | ( | SHAPE_POLY_SET & | aBuffer, |
const VECTOR2I & | aPosition, | ||
const VECTOR2I & | aSize, | ||
const EDA_ANGLE & | aRotation, | ||
int | aCornerRadius, | ||
double | aChamferRatio, | ||
int | aChamferCorners, | ||
int | aInflate, | ||
int | aError, | ||
ERROR_LOC | aErrorLoc | ||
) |
Convert a rectangle with rounded corners and/or chamfered corners to a polygon.
Convert rounded corners arcs to multiple straight lines. This will generate at least 16 segments per circle.
aBuffer | is a buffer to store the polygon. |
aPosition | is the coordinate of the center of the rectangle. |
aSize | is the size of the rectangle. |
aCornerRadius | is the radius of rounded corners (can be 0). |
aRotation | is the rotationof the rectangle. |
aChamferRatio | is the ratio between smaller rect side and chamfer value. |
aChamferCorners | is the identifier of the corners to chamfer:
|
aInflate | is the (positive) shape inflation or 0 |
aError | is the IU allowed for error in approximation. |
aErrorLoc | determines if the approximation error be placed outside or inside the polygon. |
Definition at line 452 of file convert_basic_shapes_to_polygon.cpp.
References SHAPE_POLY_SET::Append(), chamfer, CornerListRemoveDuplicates(), CornerListToPolygon(), EDA_ANGLE::IsZero(), KiROUND(), SHAPE_POLY_SET::Move(), RECT_CHAMFER_BOTTOM_LEFT, RECT_CHAMFER_BOTTOM_RIGHT, RECT_CHAMFER_TOP_LEFT, RECT_CHAMFER_TOP_RIGHT, SHAPE_POLY_SET::Rotate(), sign(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PAD::buildEffectiveShape(), GENCAD_EXPORTER::CreatePadsShapesSection(), GERBER_PLOTTER::FlashPadChamferRoundRect(), DXF_PLOTTER::FlashPadRoundRect(), GERBER_PLOTTER::FlashPadRoundRect(), HPGL_PLOTTER::FlashPadRoundRect(), PSLIKE_PLOTTER::FlashPadRoundRect(), DSN::SPECCTRA_DB::makePADSTACK(), PCB_IO_EASYEDAPRO_PARSER::ParseContour(), and PAD::TransformShapeToPolygon().
void TransformTrapezoidToPolygon | ( | SHAPE_POLY_SET & | aBuffer, |
const VECTOR2I & | aPosition, | ||
const VECTOR2I & | aSize, | ||
const EDA_ANGLE & | aRotation, | ||
int | aDeltaX, | ||
int | aDeltaY, | ||
int | aInflate, | ||
int | aError, | ||
ERROR_LOC | aErrorLoc | ||
) |
Convert a rectangle or trapezoid to a polygon.
This will generate at least 16 segments per circle (when using inflate).
aBuffer | is a buffer to store the polygon. |
aPosition | is the coordinate of the center of the rectangle. |
aSize | is the size of the rectangle. |
aDeltaX | is the delta for trapezoids in X direction |
aDeltaY | is the delta for trapezoids in Y direction |
aInflate | is the (positive) shape inflation or 0 |
aError | is the IU allowed for error in approximation. |
aErrorLoc | determines if the approximation error be placed outside or inside the polygon. |
Definition at line 379 of file convert_basic_shapes_to_polygon.cpp.
References std::abs(), SHAPE_POLY_SET::Append(), CornerListRemoveDuplicates(), CornerListToPolygon(), EDA_ANGLE::IsZero(), KiROUND(), SHAPE_POLY_SET::Move(), SHAPE_POLY_SET::Rotate(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PAD::TransformShapeToPolygon().