Skip to content

Multiple uinions cause StackOverflow Error #59

@Fliens

Description

@Fliens

I've written this code:

public class Main {

    public static void main(String[] args) throws IOException {
        CSG cube = STL.file(Paths.get("cube.stl"));

        CSG union = cube;
        for (int x = 0; x < 100; x++) {
            union = union.union(cube.transformed(Transform.unity().translateX(x * 10)));
        }

        try {
            FileUtil.write(Paths.get("sample.stl"), union.toStlString());
        } catch (IOException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}

But after 26 unions i get this error:

Exception in thread "main" java.lang.StackOverflowError
at java.util.stream.AbstractPipeline.wrapSink(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.collect(Unknown Source)
at eu.mihosoft.jcsg.Node.build(Node.java:244)
at eu.mihosoft.jcsg.Node.build(Node.java:265)

I'm trying to combine multiple objects to one but unluckily i get this error :/

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