Skip to content

Conversation

brightman9
Copy link

@brightman9 brightman9 commented Nov 30, 2019

To avoid call stack overflow when the graph has a large nesting depth. For example:

let illo = new Zdog.Illustration({
    element: '.canvas'
});

let parent = illo;
for (let depth = 0; depth < 1000; depth++) {

    let rotateX = new Zdog.Anchor({
        addTo: parent,
        rotate: { x: Zdog.TAU / 4 }
    });

    let rotateY = new Zdog.Anchor({
        addTo: rotateX,
        rotate: { y: Zdog.TAU / 6 }
    });

    let rotateZ = new Zdog.Anchor({
        addTo: rotateY,
        rotate: { z: Zdog.TAU / 8 }
    });

    parent = rotateZ;
}

illo.updateRenderGraph();

To avoid call stack overflow when the graph has a large nesting depth
@brightman9
Copy link
Author

brightman9 commented Nov 30, 2019

Other recursive functions also have the same problem(Anchor.prototype.update, Anchor.prototype.transform, Anchor.prototype.copyGraph and so on).
I think they could be rewritten to loop in a uniform way.

@desandro
Copy link
Member

Add a 👍 reaction to this issue if you would like to see this feature added. Do not add +1 comments — They will be deleted.

@desandro
Copy link
Member

Thank you for this contribution. I can see how this could be an improvement, but I see two issues

  1. There needs to be a separate fix so it works with Group
  2. As it is, I saw worse performance in some of my buggier demos, like Steam Spooky House

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants