KiCad PCB EDA Suite
|
Utility functions for working with shapes. More...
#include <array>
#include <optional>
#include <math/vector2d.h>
#include <math/box2.h>
#include <geometry/direction45.h>
Go to the source code of this file.
Namespaces | |
namespace | KIGEOM |
Functions | |
SEG | KIGEOM::NormalisedSeg (const SEG &aSeg) |
Returns a SEG such that the start point is smaller or equal in x and y compared to the end point. | |
const VECTOR2I & | KIGEOM::GetOtherEnd (const SEG &aSeg, const VECTOR2I &aPoint) |
Get the end point of the segment that is not the given point. | |
OPT_VECTOR2I | KIGEOM::GetSharedEndpoint (const SEG &aSegA, const SEG &aSegB) |
Get the shared endpoint of two segments, if it exists, or std::nullopt if the segments are not connected end-to-end. | |
std::array< SEG, 4 > | KIGEOM::BoxToSegs (const BOX2I &aBox) |
Decompose a BOX2 into four segments. | |
std::vector< SEG > | KIGEOM::GetSegsInDirection (const BOX2I &aBox, DIRECTION_45::Directions aDir) |
Get the segments of a box that are in the given direction. | |
std::optional< SEG > | KIGEOM::ClipHalfLineToBox (const HALF_LINE &aRay, const BOX2I &aBox) |
Get the segment of a half-line that is inside a box, if any. | |
std::optional< SEG > | KIGEOM::ClipLineToBox (const LINE &aLine, const BOX2I &aBox) |
Get the segment of a line that is inside a box, if any. | |
SHAPE_ARC | KIGEOM::MakeArcCw90 (const VECTOR2I &aCenter, int aRadius, DIRECTION_45::Directions aDir) |
Get a SHAPE_ARC representing a 90-degree arc in the clockwise direction with the midpoint in the given direction from the center. | |
SHAPE_ARC | KIGEOM::MakeArcCw180 (const VECTOR2I &aCenter, int aRadius, DIRECTION_45::Directions aDir) |
Get a SHAPE_ARC representing a 180-degree arc in the clockwise direction with the midpoint in the given direction from the center. | |
VECTOR2I | KIGEOM::GetPoint (const SHAPE_RECT &aRect, DIRECTION_45::Directions aDir, int aOutset=0) |
Get the point on a rectangle that corresponds to a given direction. | |
std::vector< TYPED_POINT2I > | KIGEOM::GetCircleKeyPoints (const CIRCLE &aCircle, bool aIncludeCenter) |
Get key points of an CIRCLE. | |
Utility functions for working with shapes.
These are free functions to avoid bloating the shape classes with functions that only need to be used in a few places and can just use the public interfaces.
Definition in file shape_utils.h.