34 const VECTOR2I half_size = aOvalSize / 2;
35 const int half_width = std::min( half_size.
x, half_size.
y );
36 const int half_len = std::max( half_size.
x, half_size.
y );
40 std::vector<VECTOR2I> pts;
45 pts.emplace_back( 0, 0 );
51 pts.emplace_back( half_width, 0 );
52 pts.emplace_back( -half_width, 0 );
58 pts.emplace_back( 0, half_len );
59 pts.emplace_back( 0, -half_len );
63 const int d_centre_to_cap_centre = half_len - half_width;
68 pts.emplace_back( 0, d_centre_to_cap_centre );
69 pts.emplace_back( 0, -d_centre_to_cap_centre );
75 pts.emplace_back( half_width, d_centre_to_cap_centre );
76 pts.emplace_back( half_width, -d_centre_to_cap_centre );
77 pts.emplace_back( -half_width, d_centre_to_cap_centre );
78 pts.emplace_back( -half_width, -d_centre_to_cap_centre );
83 const bool swap_xy = half_size.
x > half_size.
y;
99 const VECTOR2I cap_radial = { 0, half_width };
103 EDA_ANGLE radial_line_rotation = -rotation;
107 VECTOR2I cap_radial_to_x_axis = cap_radial;
108 RotatePoint( cap_radial_to_x_axis, radial_line_rotation );
115 VECTOR2I cap_radial_to_y_axis = cap_radial;
116 RotatePoint( cap_radial_to_y_axis, radial_line_rotation );
119 pts.emplace_back(
VECTOR2I{ 0, d_centre_to_cap_centre } + cap_radial_to_y_axis );
120 pts.emplace_back(
VECTOR2I{ 0, d_centre_to_cap_centre } + cap_radial_to_x_axis );
122 pts.emplace_back(
VECTOR2I{ 0, -d_centre_to_cap_centre } - cap_radial_to_y_axis );
123 pts.emplace_back(
VECTOR2I{ 0, -d_centre_to_cap_centre } - cap_radial_to_x_axis );
static constexpr EDA_ANGLE & ANGLE_90
static constexpr EDA_ANGLE & ANGLE_0
std::vector< VECTOR2I > GetOvalKeyPoints(const VECTOR2I &aOvalSize, const EDA_ANGLE &aRotation, OVAL_KEY_POINT_FLAGS aFlags)
Get a list of interesting points on an oval (rectangle with semicircular end caps)
unsigned int OVAL_KEY_POINT_FLAGS
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.