Skip to content

Add compressor functionality to the tessellator#68

Draft
lmdiazangulo wants to merge 14 commits into
devfrom
adds-compressor
Draft

Add compressor functionality to the tessellator#68
lmdiazangulo wants to merge 14 commits into
devfrom
adds-compressor

Conversation

@lmdiazangulo

Copy link
Copy Markdown
Contributor
  • Implemented Compressor class for merging coplanar quad surfaces.
  • Updated StaircaseMesher to include compression option.
  • Enhanced launcher to read compression settings from JSON input.
  • Added tests for Compressor functionality.

- Implemented Compressor class for merging coplanar quad surfaces.
- Updated StaircaseMesher to include compression option.
- Enhanced launcher to read compression settings from JSON input.
- Added tests for Compressor functionality.
- Add groups initialization check in addQuad() helper to prevent segfault
- Fix compressSurfaces() to properly remove merged elements
- Update test expectations for merged return value
@lmdiazangulo

Copy link
Copy Markdown
Contributor Author

@copilot fix this so the actions pass

Copilot AI and others added 2 commits May 16, 2026 10:44
Agent-Logs-Url: https://github.com/OpenSEMBA/tessellator/sessions/2ab9c1cf-5df7-41b4-aa40-c9d80938a5af

Co-authored-by: lmdiazangulo <4919398+lmdiazangulo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/OpenSEMBA/tessellator/sessions/2ab9c1cf-5df7-41b4-aa40-c9d80938a5af

Co-authored-by: lmdiazangulo <4919398+lmdiazangulo@users.noreply.github.com>

Copilot AI commented May 16, 2026

Copy link
Copy Markdown

@copilot fix this so the actions pass

Addressed in 1742a94 (plus f95e55f): I updated the CI workflow to disable the vcpkg GHA binary source during configure/build and added explicit minimal GITHUB_TOKEN permissions (contents: read) so the Actions security check also passes.

@lmdiazangulo lmdiazangulo changed the title Add compressor functionality to the tessellator [WIP] Add compressor functionality to the tessellator May 16, 2026
@lmdiazangulo lmdiazangulo marked this pull request as draft May 16, 2026 11:00
@lmdiazangulo

Copy link
Copy Markdown
Contributor Author

@copilot can you check what is wrong with the failing action and fix it?

Copilot AI commented May 17, 2026

Copy link
Copy Markdown

@copilot can you check what is wrong with the failing action and fix it?

Fixed in b3b9b63. The failure was a transient vcpkg dependency download error on Windows (status code 502 while fetching Boost). I added retries to the configure step (Windows and Ubuntu) so transient download/network issues don’t fail the whole action immediately.

@lmdiazangulo lmdiazangulo changed the title [WIP] Add compressor functionality to the tessellator Add compressor functionality to the tessellator May 18, 2026
@lmdiazangulo lmdiazangulo marked this pull request as ready for review May 18, 2026 08:37
Comment thread .vscode/launch.json
Comment thread src/app/launcher.cpp
addQuad(mesh, {2, 2, 0}, {3, 2, 0}, {3, 3, 0}, {2, 3, 0});
// Corners to complete the ring
addQuad(mesh, {1, 0, 0}, {2, 0, 0}, {2, 1, 0}, {1, 1, 0});
addQuad(mesh, {1, 3, 0}, {2, 3, 0}, {2, 2, 0}, {1, 2, 0});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This quad has the opposite orientation (and thus a different normal to the rest).

// - Top center (quad 8): cell x=1-2, y=2-3
// - Bottom center (quad 7): cell x=1-2, y=0-1
EXPECT_EQ(finalCount, 4u);
EXPECT_EQ(merged, 4u); // 8 - 4 = 4 surfaces merged

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final surfaces are not tested to check if original shape is maintained.

Comment on lines +175 to +177
auto splitCount = core::Splitter::splitSurfaces(mesh);
EXPECT_EQ(splitCount, 4u);
EXPECT_EQ(countMeshElementsIf(mesh, isQuad), 4u);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splitter should have its own tests that ensure the mesh is consistent.

Comment thread src/core/Splitter.cpp
Comment on lines +294 to +308
corners[0](normalAxis) = grid[normalAxis][plane];
corners[0](axis1) = grid[axis1][xCell];
corners[0](axis2) = grid[axis2][yCell];

corners[1](normalAxis) = grid[normalAxis][plane];
corners[1](axis1) = grid[axis1][xCell + 1];
corners[1](axis2) = grid[axis2][yCell];

corners[2](normalAxis) = grid[normalAxis][plane];
corners[2](axis1) = grid[axis1][xCell + 1];
corners[2](axis2) = grid[axis2][yCell + 1];

corners[3](normalAxis) = grid[normalAxis][plane];
corners[3](axis1) = grid[axis1][xCell];
corners[3](axis2) = grid[axis2][yCell + 1];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original quad coordinates are Relative. Getting the values directly from grid makes them absolute coordinates. They should stay Relative, making plane, xCell, xCell+ 1, yCell and yCell+ 1, the needed values.

Comment thread src/core/Splitter.cpp
Comment thread src/core/Compressor.cpp
Comment thread src/core/Compressor.cpp
Comment on lines +77 to +93
if (compress_) {
log("Compressing surfaces.", 1);
std::size_t beforeQuads = countMeshElementsIf(mesh, isQuad);
std::size_t merged = Compressor::compressSurfaces(mesh);
std::size_t afterQuads = countMeshElementsIf(mesh, isQuad);
log("Compressed " + std::to_string(beforeQuads) +
" -> " + std::to_string(afterQuads) +
" quads (merged " + std::to_string(merged) + " surfaces)", 1);

log("Compressing lines.", 1);
std::size_t beforeLines = countMeshElementsIf(mesh, isLine);
merged = Compressor::compressLines(mesh);
std::size_t afterLines = countMeshElementsIf(mesh, isLine);
log("Compressed " + std::to_string(beforeLines) +
" -> " + std::to_string(afterLines) +
" lines (merged " + std::to_string(merged) + " segments)", 1);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing tests for meshing with compression.

@lmdiazangulo lmdiazangulo marked this pull request as draft June 9, 2026 12:46
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.

3 participants