Update 3D Honeycomb Infill to switch directions at squares rather than every line (#4049)

* Initial attempt at updated minimal-bridging honeycomb pattern

* Revert, make incremental change of existing code
This commit is contained in:
David Eccles (gringer) 2018-01-06 15:20:06 +13:00 committed by Joseph Lenox
parent 1190a74f4e
commit 54fe2e4145

View File

@ -88,16 +88,13 @@ zip(const std::vector<coordf_t> &x, const std::vector<coordf_t> &y)
static std::vector<Pointfs>
makeNormalisedGrid(coordf_t z, size_t gridWidth, size_t gridHeight, size_t curveType)
{
// offset required to create a regular octagram
coordf_t octagramGap = coordf_t(0.5);
// sawtooth wave function for range f($z) = [-$octagramGap .. $octagramGap]
// sawtooth wave function
coordf_t a = std::sqrt(coordf_t(2.)); // period
coordf_t wave = fabs(fmod(z, a) - a/2.)/a*4. - 1.;
coordf_t offset = wave * octagramGap;
coordf_t offset = fabs(fmod(z, a) - a/2.)/a*2. - 0.5;
bool printHoriz = (fabs(fmod(z, a)) / a*2. < 1);
std::vector<Pointfs> points;
if ((curveType & 1) != 0) {
if (printHoriz) {
for (size_t x = 0; x <= gridWidth; ++x) {
points.push_back(Pointfs());
Pointfs &newPoints = points.back();
@ -109,8 +106,7 @@ makeNormalisedGrid(coordf_t z, size_t gridWidth, size_t gridHeight, size_t curve
if (x & 1)
std::reverse(newPoints.begin(), newPoints.end());
}
}
if ((curveType & 2) != 0) {
} else {
for (size_t y = 0; y <= gridHeight; ++y) {
points.push_back(Pointfs());
Pointfs &newPoints = points.back();