Skip to content

Contour grid points from the root origin and a global index so split render jobs share seam vertices - #459

Open
dylanoliverdo-coder wants to merge 1 commit into
CauldronDevelopmentLLC:masterfrom
dylanoliverdo-coder:fix-seam-lattice-points
Open

dylanoliverdo-coder wants to merge 1 commit into
CauldronDevelopmentLLC:masterfrom
dylanoliverdo-coder:fix-seam-lattice-points

Conversation

@dylanoliverdo-coder

Copy link
Copy Markdown

When the surface grid is split into render jobs, two neighbouring jobs can compute the plane they share by different floating-point sums: (origin + a*res) + b*res in one job and origin + (a+b)*res in the other. These can differ in the last bits (for example x = 35.0 against x = 34.999999999999996 on a 70 mm block at 0.3 mm).

FieldFunction::linearIntersect bisects each edge 8 times. Where a cut wall crosses the seam edges exactly at a bisection midpoint (a 45° cone wall does this), the tool's inside test cancels to about zero and rounding decides the branch. The two jobs then take different branches, their seam vertices land 1/128 of a cell apart on one side only, and the exported mesh is open along the seam.

Fix: each Grid carries the root origin and its integer index. CubeSlice, VertexSlice and SliceContourGenerator compute every point as origin + resolution * (index + i), and split, slice and GridTreeRef pass the origin and index on. Both jobs now bisect the same edge between bit-identical endpoints. offset is kept equal to the grid's first point, so other users of getOffset() are unchanged.

Repro: a 70 x 20 x 10 mm block at 0.3 mm resolution, a 90° V tool, and 12 grooves along X with non-round endpoints, run with camsim --threads 1 --binary --reduce=false. Counting edges with corners merged by exact coordinate:

Build Triangles Open edges Edges on more than 2 faces
master (two runs) 120,892 106, every one at x = 35 (the job seam) 0
this branch (two runs) 120,780 0 0

Tests: the tests/testHarness gcodetool suites (oCodeTests, offsetTests, varRefTests) pass 15 of 15 on master and on this branch. Built with scons, with_gui=0 with_tpl=0, MSVC 14.38.

Repro job (vgroove3.camotics and vgroove3.nc)
{
 "units": "metric",
 "resolution-mode": "manual",
 "resolution": 0.3,
 "tools": {
  "1": {
   "units": "metric",
   "shape": "conical",
   "length": 3,
   "diameter": 6,
   "description": ""
  }
 },
 "workpiece": {
  "automatic": false,
  "margin": 0,
  "bounds": {
   "min": [
    0.0,
    0.0,
    -10.0
   ],
   "max": [
    70.0,
    20.0,
    0.0
   ]
  }
 },
 "files": [
  "vgroove3.nc"
 ]
}
G21 G90 G17
T1 M6
G0 Z5
G0 X4.7172 Y2.0499999999999998
G1 Z-0.79999999999999893 F300
G1 X65.4096 F600
G0 Z5
G0 X5.0883 Y3.5499999999999998
G1 Z-1.0999999999999996 F300
G1 X65.1179 F600
G0 Z5
G0 X5.4594 Y5.0499999999999989
G1 Z-1.3999999999999986 F300
G1 X64.8262 F600
G0 Z5
G0 X5.8305 Y6.6999999999999993
G1 Z-0.79999999999999893 F300
G1 X64.5345 F600
G0 Z5
G0 X6.2016 Y8.2000000000000011
G1 Z-1.0999999999999996 F300
G1 X64.2428 F600
G0 Z5
G0 X6.5727 Y9.7000000000000011
G1 Z-1.3999999999999986 F300
G1 X63.9511 F600
G0 Z5
G0 X6.9438 Y11.125
G1 Z-0.79999999999999893 F300
G1 X63.6594 F600
G0 Z5
G0 X7.3149 Y12.625
G1 Z-1.0999999999999996 F300
G1 X63.3677 F600
G0 Z5
G0 X7.6860 Y14.124999999999998
G1 Z-1.3999999999999986 F300
G1 X63.0760 F600
G0 Z5
G0 X8.0571 Y15.587499999999999
G1 Z-0.79999999999999893 F300
G1 X62.7843 F600
G0 Z5
G0 X8.4282 Y17.087499999999999
G1 Z-1.0999999999999996 F300
G1 X62.4926 F600
G0 Z5
G0 X8.7993 Y18.587499999999999
G1 Z-1.3999999999999986 F300
G1 X62.2009 F600
G0 Z5
M2

🤖 Generated with Claude Code

Split render jobs computed the points on their shared planes from
differently accumulated offsets, which can differ in the last bit.  On
a surface that lies on a bisection midpoint this moves the vertex by
one bisection step (1/128 of a cell) on one side of the seam only,
leaving the mesh open along the plane.  Each grid now carries the root
origin and its integer index, and every point is computed as
origin + resolution * (index + i), so both jobs get the same vertex.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant