KiCad PCB EDA Suite
Loading...
Searching...
No Matches
teardrop_utils.cpp File Reference
#include <board_design_settings.h>
#include <pcb_track.h>
#include <pad.h>
#include <zone_filler.h>
#include <board_commit.h>
#include <drc/drc_rtree.h>
#include <trigo.h>
#include "teardrop.h"
#include <geometry/convex_hull.h>
#include <geometry/shape_line_chain.h>
#include <convert_basic_shapes_to_polygon.h>
#include <bezier_curves.h>
#include <wx/log.h>

Go to the source code of this file.

Functions

static VECTOR2D NormalizeVector (const VECTOR2I &aVector)
 
static VECTOR2I computeCornerTangentControlPoint (const VECTOR2I &aAnchor, const VECTOR2I &aCornerCenter, double aBias, const VECTOR2I &aDesiredDir)
 Helper to compute a control point for a teardrop anchor on a rounded rectangle corner.
 
static bool isPointOnOvalEnd (const VECTOR2I &aPoint, const VECTOR2I &aPadPos, const VECTOR2I &aPadSize, const EDA_ANGLE &aRotation, VECTOR2I &aArcCenter)
 Check if a point is on the curved (semicircular) end of an oval pad.
 
static bool isPointOnRoundedCorner (const VECTOR2I &aPoint, const VECTOR2I &aPadPos, const VECTOR2I &aPadSize, int aCornerRadius, const EDA_ANGLE &aRotation, VECTOR2I &aCornerCenter)
 Check if a point is within a rounded corner region of a rounded rectangle pad.
 

Function Documentation

◆ computeCornerTangentControlPoint()

static VECTOR2I computeCornerTangentControlPoint ( const VECTOR2I & aAnchor,
const VECTOR2I & aCornerCenter,
double aBias,
const VECTOR2I & aDesiredDir )
static

Helper to compute a control point for a teardrop anchor on a rounded rectangle corner.

The control point is placed along the tangent to the corner arc at the anchor point, in the direction that best aligns with the desired direction (typically toward the track).

Parameters
aAnchorthe anchor point on the pad edge
aCornerCenterthe center of the corner arc
aBiasthe distance from the anchor to place the control point
aDesiredDirthe direction we want the control point to go (toward track)
Returns
the computed control point

Definition at line 328 of file teardrop_utils.cpp.

References VECTOR2< T >::EuclideanNorm(), KiROUND(), VECTOR2< T >::Resize(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by TEARDROP_MANAGER::computeCurvedForRectShape().

◆ isPointOnOvalEnd()

static bool isPointOnOvalEnd ( const VECTOR2I & aPoint,
const VECTOR2I & aPadPos,
const VECTOR2I & aPadSize,
const EDA_ANGLE & aRotation,
VECTOR2I & aArcCenter )
static

Check if a point is on the curved (semicircular) end of an oval pad.

An oval is a stadium shape with semicircular caps on the ends of the minor axis.

Parameters
aPointthe point to check
aPadPosthe pad center position
aPadSizethe pad size (width, height)
aRotationthe pad rotation
aArcCenter[out] if on curved end, receives the semicircle center
Returns
true if point is on a curved end of the oval

Definition at line 367 of file teardrop_utils.cpp.

References std::abs(), radius, RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by TEARDROP_MANAGER::computeCurvedForRectShape().

◆ isPointOnRoundedCorner()

static bool isPointOnRoundedCorner ( const VECTOR2I & aPoint,
const VECTOR2I & aPadPos,
const VECTOR2I & aPadSize,
int aCornerRadius,
const EDA_ANGLE & aRotation,
VECTOR2I & aCornerCenter )
static

Check if a point is within a rounded corner region of a rounded rectangle pad.

Returns true if the point is in a corner arc region and provides the corner center.

Parameters
aPointthe point to check
aPadPosthe pad center position
aPadSizethe pad size (width, height)
aCornerRadiusthe corner radius
aRotationthe pad rotation
aCornerCenter[out] if in corner, receives the corner arc center
Returns
true if point is in a corner arc region

Definition at line 430 of file teardrop_utils.cpp.

References std::abs(), RotatePoint(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by TEARDROP_MANAGER::computeCurvedForRectShape().

◆ NormalizeVector()

static VECTOR2D NormalizeVector ( const VECTOR2I & aVector)
static
Returns
a vector unit length from aVector

Definition at line 221 of file teardrop_utils.cpp.

References VECTOR2< T >::EuclideanNorm().

Referenced by TEARDROP_MANAGER::computeTeardropPolygon().