37 chain.Append( seg.
A - perp );
39 chain.Append( seg.
B + perp );
41 chain.SetClosed(
true );
48 const int half_width = aOval.
GetWidth() / 2;
54 std::vector<TYPED_POINT2I> pts;
75 pts.emplace_back(
VECTOR2I{ 0, half_len }, pt_type );
76 pts.emplace_back(
VECTOR2I{ 0, -half_len }, pt_type );
80 const int d_centre_to_cap_centre = half_len - half_width;
91 const auto add_end = [&](
const VECTOR2I& aPt )
97 add_end( { half_width, d_centre_to_cap_centre } );
98 add_end( { half_width, -d_centre_to_cap_centre } );
99 add_end( { -half_width, d_centre_to_cap_centre } );
100 add_end( { -half_width, -d_centre_to_cap_centre } );
116 const VECTOR2I cap_radial = { 0, half_width };
120 EDA_ANGLE radial_line_rotation = rotation;
124 VECTOR2I cap_radial_to_x_axis = cap_radial;
125 RotatePoint( cap_radial_to_x_axis, radial_line_rotation );
132 VECTOR2I cap_radial_to_y_axis = cap_radial;
133 RotatePoint( cap_radial_to_y_axis, radial_line_rotation );
135 const auto add_quadrant = [&](
const VECTOR2I& aPt )
141 add_quadrant(
VECTOR2I{ 0, d_centre_to_cap_centre } + cap_radial_to_y_axis );
142 add_quadrant(
VECTOR2I{ 0, d_centre_to_cap_centre } + cap_radial_to_x_axis );
144 add_quadrant(
VECTOR2I{ 0, -d_centre_to_cap_centre } - cap_radial_to_y_axis );
145 add_quadrant(
VECTOR2I{ 0, -d_centre_to_cap_centre } - cap_radial_to_x_axis );
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const SEG & GetSeg() const
EDA_ANGLE GetAngle() const
int GetWidth() const override
int GetTotalLength() const
Get the total length of the segment, from tip to tip.
VECTOR2I GetCenter() const
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_180
Construction helpers for the interactive arc drawing modes.
std::vector< TYPED_POINT2I > GetOvalKeyPoints(const SHAPE_SEGMENT &aOval, OVAL_KEY_POINT_FLAGS aFlags)
Get a list of interesting points on an oval (rectangle with semicircular end caps)
SHAPE_LINE_CHAIN ConvertToChain(const SHAPE_SEGMENT &aOval)
unsigned int OVAL_KEY_POINT_FLAGS
POINT_TYPE
Meanings that can be assigned to a point in pure geometric terms.
@ PT_CENTER
The point is the center of something.
@ PT_QUADRANT
The point is on a quadrant of a circle (N, E, S, W points).
@ PT_END
The point is at the end of a segment, arc, etc.
@ PT_MID
The point is at the middle of a segment, arc, etc.
const SHAPE_LINE_CHAIN chain
VECTOR2I GetRotated(const VECTOR2I &aVector, const EDA_ANGLE &aAngle)
Return a new VECTOR2I that is the result of rotating aVector by aAngle.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
VECTOR2< int32_t > VECTOR2I