@@ -812,7 +812,7 @@ static constexpr float64_t FillPatternShapeExtent = 32.0;
812812
813813void line (std::vector<CPolyline>& polylines, float64_t2 begin, float64_t2 end)
814814{
815- std::vector <float64_t2> points = {
815+ std::array <float64_t2, 2 > points = {
816816 begin, end
817817 };
818818 CPolyline polyline;
@@ -846,15 +846,23 @@ void checkered(std::vector<CPolyline>& polylines, const float64_t2& offset)
846846 float64_t2 (0.0 , 1.0 ),
847847 };
848848 {
849- std::vector<float64_t2> points;
850- points.reserve (squarePointsCW.size ());
851- for (const auto & p : squarePointsCW) points.push_back (p * FillPatternShapeExtent + offset);
849+ std::array<float64_t2, 5 > points;
850+ auto i = 0u ;
851+ for (const auto & p : squarePointsCW)
852+ {
853+ points[i] = p * FillPatternShapeExtent + offset;
854+ i++;
855+ }
852856 polyline.addLinePoints (points);
853857 }
854858 {
855- std::vector<float64_t2> points;
856- points.reserve (squarePointsCW.size ());
857- for (const auto & p : squarePointsCW) points.push_back ((p + float64_t2 (0.5 , -0.5 )) * FillPatternShapeExtent + offset);
859+ std::array<float64_t2, 5 > points;
860+ auto i = 0u ;
861+ for (const auto & p : squarePointsCW)
862+ {
863+ points[i] = (p + float64_t2 (0.5 , -0.5 )) * FillPatternShapeExtent + offset;
864+ i++;
865+ }
858866 polyline.addLinePoints (points);
859867 }
860868 polylines.push_back (std::move (polyline));
@@ -885,16 +893,24 @@ void diamonds(std::vector<CPolyline>& polylines, const float64_t2& offset)
885893
886894 // Outer
887895 {
888- std::vector<float64_t2> points;
889- points.reserve (diamondPointsCW.size ());
890- for (const auto & p : diamondPointsCW) points.push_back (p * outerSize + origin);
896+ std::array<float64_t2, 5 > points;
897+ auto i = 0u ;
898+ for (const auto & p : diamondPointsCW)
899+ {
900+ points[i] = p * outerSize + origin;
901+ i++;
902+ }
891903 polyline.addLinePoints (points);
892904 }
893905 // Inner
894906 {
895- std::vector<float64_t2> points;
896- points.reserve (diamondPointsCCW.size ());
897- for (const auto & p : diamondPointsCCW) points.push_back (p * innerSize + origin);
907+ std::array<float64_t2, 5 > points;
908+ auto i = 0u ;
909+ for (const auto & p : diamondPointsCCW)
910+ {
911+ points[i] = p * innerSize + origin;
912+ i++;
913+ }
898914 polyline.addLinePoints (points);
899915 }
900916 polylines.push_back (std::move (polyline));
@@ -915,9 +931,13 @@ void crossHatch(std::vector<CPolyline>& polylines, const float64_t2& offset)
915931 float64_t2 (0.375 , 0.0 ),
916932 };
917933 {
918- std::vector<float64_t2> points;
919- points.reserve (outerPointsCW.size ());
920- for (const auto & p : outerPointsCW) points.push_back (p * FillPatternShapeExtent + offset);
934+ std::array<float64_t2, 9u > points;
935+ auto i = 0u ;
936+ for (const auto & p : outerPointsCW)
937+ {
938+ points[i] = p * FillPatternShapeExtent + offset;
939+ i++;
940+ }
921941 polyline.addLinePoints (points);
922942 }
923943
@@ -930,9 +950,13 @@ void crossHatch(std::vector<CPolyline>& polylines, const float64_t2& offset)
930950 };
931951 {
932952 float64_t2 origin = float64_t2 (FillPatternShapeExtent/2.0 , FillPatternShapeExtent/2.0 ) + offset;
933- std::vector<float64_t2> points;
934- points.reserve (diamondPointsCCW.size ());
935- for (const auto & p : diamondPointsCCW) points.push_back (p * 0.75 * FillPatternShapeExtent + origin);
953+ std::array<float64_t2, 5u > points;
954+ auto i = 0u ;
955+ for (const auto & p : diamondPointsCCW)
956+ {
957+ points[i] = p * 0.75 * FillPatternShapeExtent + origin;
958+ i++;
959+ }
936960 polyline.addLinePoints (points);
937961 }
938962 polylines.push_back (std::move (polyline));
@@ -948,7 +972,7 @@ void hatch(std::vector<CPolyline>& polylines, const float64_t2& offset)
948972 {
949973 float64_t2 radiusOffsetTL = float64_t2 (+lineDiameter / 2.0 , +lineDiameter / 2.0 ) * FillPatternShapeExtent / 8.0 ;
950974 float64_t2 radiusOffsetBL = float64_t2 (-lineDiameter / 2.0 , -lineDiameter / 2.0 ) * FillPatternShapeExtent / 8.0 ;
951- std::vector <float64_t2> points = {
975+ std::array <float64_t2, 5u > points = {
952976 basePt0 + radiusOffsetTL,
953977 basePt0 + radiusOffsetBL, // 0
954978 basePt1 + radiusOffsetBL, // 1
@@ -1052,7 +1076,7 @@ void reverseHatch(std::vector<CPolyline>& polylines, const float64_t2& offset)
10521076 {
10531077 float64_t2 radiusOffsetTL = float64_t2 (-lineDiameter / 2.0 , +lineDiameter / 2.0 ) * FillPatternShapeExtent / 8.0 ;
10541078 float64_t2 radiusOffsetBL = float64_t2 (+lineDiameter / 2.0 , -lineDiameter / 2.0 ) * FillPatternShapeExtent / 8.0 ;
1055- std::vector <float64_t2> points = {
1079+ std::array <float64_t2, 5u > points = {
10561080 basePt0 + radiusOffsetTL,
10571081 basePt1 + radiusOffsetTL, // 0
10581082 basePt1 + radiusOffsetBL, // 1
0 commit comments