Jump to content

mesh removal


sQuid
 Share

Recommended Posts

Hi - I have an annoying bug in a simple graph visualization tool that can be seen here. What happens is that sometimes, when changing the displayed lattice, a subset of the edges are displaced. If you look at the link, for example, switching from Diamond(3) to the Diamond(2) shows the misplaced edges. However if you switch to Diamond(2) from any of the other examples everything is fine.

 

I *think* I haven't properly taken care of parent relationships when disposing of meshes, but can't figure out what I missed, and why it only happens for certain subsets when switching between graphs. 

 

The offending code can be found at http://www.ntpic.net/glattice/Glattice.js. Edges in the graphs are simple cylinders, whose parents are set to be the appropriate source vertex so they can be oriented and scaled in local coordinates.

var _edge = me.edges[ii];_edge.parent = me.vertices[ee[1]];

When switching from a larger graph to a smaller one, the excess vertices and edges are disposed of e.g.

if (data.edge.length < nedges){    me.edges.splice(data.edge.length, 1+nedges-data.edge.length).forEach(function(e) {e.dispose();});    nedges = me.edges.length;} 

and then the remaining edges and vertices are transformed into the correct positions.  Apart from certain cases like the one mentioned above. 

 

If anyone has any tips they would me much appreciated.

 

thanks

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...