Skip to content

A bug in the "closeHoles" feature #9

@jhollinger22

Description

@jhollinger22

I noticed that when slicing a simple cube that has not been rotated, the fill holes feature does not work.
I created an example CodePen to demonstrate the issue here.

As a potential fix, I added an extra loop at the end of the joinEdges function (shown below), and I removed the call to filter(validFace). I am not sure whether my fix would cause problems in other scenarios. Perhaps you would see a better way to address the bug?

function joinEdges(edges) {
    changes = true;
    var chains = edges.map(function(edge) {
        return [edge];
    });
    while (changes) {
        changes = connectChains(chains);
    }
    chains = chains.filter(function(chain) {
        return chain.length; 
    });
    chains.forEach(function(chain) {
        if (!validFace(chain)) {
		// If the face is not valid, add a final chain link to connect the end to the beginning
		chain[chain.length] = [chainEnd(chain), chainStart(chain)];
	}
    });
    return chains;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions