Second Magma infill pattern, after Triangle and before Tri-hex. This note is the implementation reference; the design below is settled.
Terminology: rectilinear (a.k.a. “square”) cells pair into the same U-tube as the triangle pattern — two adjacent cells joined by a window gap at their shared wall, injected down one and vented up the other. It is the degenerate 1-leg manifold, exactly like triangle; only the cell shape and line families differ.
cell_spacing apart, so each cell
is a square of side = cell_spacing. No skew, no parity (unlike the triangle’s
up/down cells).CellId uses (a, b) = integer (column, row); c and kind are unused (0). Each
cell is the unit square [a, a+1] × [b, b+1] in lattice space.to_world(lx, ly) = (lx·cs + off_x, ly·cs + off_y).RectilinearLattice::neighbors() returns the 4 edge-sharing neighbors
(L/R/U/D); is_up() is always false; max_neighbors() = 4.SquareGeometry (MagmaGeometry impl)Walls are single shared beads centred on the grid lines, so the open interior is inset
by line_width/2 on each of the four sides → inset (open) square side = spacing − lw.
edge_length = spacing (the line spacing IS the square’s side).inset_open_area = (spacing − lw)².opening_diameter = (spacing − lw)·√2 — the circumscribed circle of the inset square,
which the nozzle flat must cover when sealing (all four corners).interior_for_opening = opening / √2).neighbor_centroid_distance = spacing (orthogonal grid; simpler than the triangle’s
side/√3).vertex_overlap_excess_area = lw² — only 2 line families crossing at 90°, ~1
crossing per cell (vs the triangle’s 3 families at 60° → 3√3·lw²/4). Less material is
double-deposited, so less is subtracted from the injected volume.window_volume = (spacing − lw)·lw·window_height — the shared-wall gap.auto_window_height = (spacing − lw) = interior_width — written as area/edge to
parallel the triangle, so the window flow cross-section equals the tube’s open
cross-section.max_neighbors = 4; a pair is 2 cells.square_window_cuts (pattern-owned)For each open U-tube pair (the solver decides which pairs are open on a given layer):
a) → the shared wall is vertical → cut the gap into
vert[col] as a Y-interval;b) → the shared wall is horizontal → cut into
horiz[row] as an X-interval.Intervals are merged per line index. Simpler than the triangle, which must classify the shared edge into three families (horizontal / 60° / 120°).
FillMagmaRectilinear::_fill_surface_singleb): y = b·cs + off_y, spanning X;a): x = a·cs + off_x, spanning Y.subtract_gaps (Y-intervals split
vertical lines, X-intervals split horizontal lines).chain_or_connect_infill routes within the family. Anchoring is disabled (zone
shells provide the bonding surface).RectilinearLattice) + SquareGeometry;
square_window_cuts; the 2-family axis-aligned toolpath.