KiCad PCB EDA Suite
Loading...
Searching...
No Matches
arc_tangent_seed.h File Reference
#include <optional>
#include <geometry/seg.h>
#include <math/vector2d.h>

Go to the source code of this file.

Classes

struct  ARC_TANGENT_SEED
 Start point and departure direction that ARC_DRAW_MODE::TANGENT needs to begin an arc. More...
 

Functions

std::optional< ARC_TANGENT_SEED > ArcTangentSeedNear (const EDA_SHAPE &aShape, const VECTOR2I &aNear)
 Seed the next tangent arc from whichever endpoint of aShape lies nearest aNear.
 
std::optional< ARC_TANGENT_SEED > ArcTangentSeedAt (const EDA_SHAPE &aShape, const VECTOR2I &aPoint, int aTolerance)
 Tangent seed for a point on or near a segment, arc or Bezier shape.
 
std::optional< ARC_TANGENT_SEED > ArcTangentSeedAt (const SEG &aSegment, const VECTOR2I &aPoint, int aTolerance)
 Tangent seed for a point on or near a segment, arc or Bezier shape.
 

Variables

constexpr int ARC_SEED_PICK_PIXELS = 5
 Screen distance in pixels within which a click picks a graphic to start a tangent arc from.
 

Function Documentation

◆ ArcTangentSeedAt() [1/2]

std::optional< ARC_TANGENT_SEED > ArcTangentSeedAt ( const EDA_SHAPE & aShape,
const VECTOR2I & aPoint,
int aTolerance )

Tangent seed for a point on or near a segment, arc or Bezier shape.

A point within aTolerance of an endpoint gives the outward direction at that endpoint, and the seed starts at the endpoint itself. Any other point within aTolerance of the shape gives the tangent axis at the nearest point of the shape, and the seed starts there.

Parameters
aToleranceis the largest distance in IU between aPoint and the shape.
Returns
std::nullopt for other shape types or when the point is not close enough.

Definition at line 163 of file arc_tangent_seed.cpp.

References ARC, ArcTangentSeedAt(), BEZIER, SHAPE_POLY_SET::CHole(), BOX2< Vec >::Contains(), SHAPE_POLY_SET::COutline(), end, EDA_SHAPE::GetArcMid(), EDA_SHAPE::GetBezierC1(), EDA_SHAPE::GetBezierC2(), SHAPE_ARC::GetCenter(), EDA_SHAPE::GetEnd(), BEZIER_POLY::GetPoly(), EDA_SHAPE::GetPolyShape(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetStart(), SHAPE_POLY_SET::HoleCount(), BOX2< Vec >::Inflate(), BOX2< Vec >::Merge(), nearestEnd(), SHAPE_ARC::NearestPoint(), normalized(), SHAPE_POLY_SET::OutlineCount(), POLY, polylineSeedAt(), radius, SEGMENT, and tangentAtEndpoint().

◆ ArcTangentSeedAt() [2/2]

std::optional< ARC_TANGENT_SEED > ArcTangentSeedAt ( const SEG & aSegment,
const VECTOR2I & aPoint,
int aTolerance )

Tangent seed for a point on or near a segment, arc or Bezier shape.

A point within aTolerance of an endpoint gives the outward direction at that endpoint, and the seed starts at the endpoint itself. Any other point within aTolerance of the shape gives the tangent axis at the nearest point of the shape, and the seed starts there.

Parameters
aToleranceis the largest distance in IU between aPoint and the shape.
Returns
std::nullopt for other shape types or when the point is not close enough.

Definition at line 155 of file arc_tangent_seed.cpp.

References SEG::A, SEG::B, and polylineSeedAt().

Referenced by ArcTangentSeedAt(), DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().

◆ ArcTangentSeedNear()

std::optional< ARC_TANGENT_SEED > ArcTangentSeedNear ( const EDA_SHAPE & aShape,
const VECTOR2I & aNear )

Seed the next tangent arc from whichever endpoint of aShape lies nearest aNear.

Used to chain arcs, where aNear is the last point the user clicked on the previous arc.

Definition at line 93 of file arc_tangent_seed.cpp.

References EDA_SHAPE::GetEnd(), EDA_SHAPE::GetStart(), nearestEnd(), and tangentAtEndpoint().

Referenced by DRAWING_TOOL::DrawArc(), and EE_GRAPHIC_TOOL::DrawArc().

Variable Documentation

◆ ARC_SEED_PICK_PIXELS

int ARC_SEED_PICK_PIXELS = 5
constexpr

Screen distance in pixels within which a click picks a graphic to start a tangent arc from.

Definition at line 30 of file arc_tangent_seed.h.

Referenced by DRAWING_TOOL::drawManagedShape(), and EE_GRAPHIC_TOOL::drawManagedShape().