Код: Выделить всё
const double SegmentLength = static_cast(PointsCount) / SymmetryCenters;
const double HalfSegment = SegmentLength / 2;
//const auto OddOffset = std::fmod(SegmentLength, 2);
for (int32 CenterIndex = 0; CenterIndex < SymmetryCenters; CenterIndex++) {
const int32 Center = FMath::RoundToInt(CenterIndex * SegmentLength + HalfSegment);
for (int32 PointIndex = 0; PointIndex < HalfSegment; PointIndex++) {
const int32 LeftIndex = Center - PointIndex - 1;
const int32 RightIndex = Center + PointIndex;
// const int32 RightIndex = Center + PointIndex - OddOffset;
// Set values if within bounds
if (LeftIndex >= 0) OutPoints[LeftIndex] = MyValue();
if (RightIndex < PointsCount) OutPoints[RightIndex] = MyValue();
}
}
Код: Выделить всё
For 06 Length: 1) [3], 2) [2, 5]
For 12 Length: 1) [6], 2) [3, 9]
For 18 Length: 1) [9], 2) [5, 14]
Подробнее здесь: https://stackoverflow.com/questions/791 ... s-in-array