Add compressor functionality to the tessellator#68
Conversation
lmdiazangulo
commented
May 8, 2026
- 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
|
@copilot fix this so the actions pass |
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 can you check what is wrong with the failing action and fix it? |
Agent-Logs-Url: https://github.com/OpenSEMBA/tessellator/sessions/e5974172-7eed-4d3b-a308-0d68b508b8c4 Co-authored-by: lmdiazangulo <4919398+lmdiazangulo@users.noreply.github.com>
Fixed in b3b9b63. The failure was a transient vcpkg dependency download error on Windows ( |
| 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}); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Final surfaces are not tested to check if original shape is maintained.
| auto splitCount = core::Splitter::splitSurfaces(mesh); | ||
| EXPECT_EQ(splitCount, 4u); | ||
| EXPECT_EQ(countMeshElementsIf(mesh, isQuad), 4u); |
There was a problem hiding this comment.
Splitter should have its own tests that ensure the mesh is consistent.
| 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]; |
There was a problem hiding this comment.
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.
| 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); | ||
| } |
There was a problem hiding this comment.
Missing tests for meshing with compression.