Print

Print


Thanks, Maira!  I'm at a conference right now and so can't easily do a 
double-check and bugfix.  But we'll get it updated soon enough.

Sean

Maíra Athanázio Gatti wrote:
> Hi all,
> 
> I have found a bug in NetworkPortrayal2D.
> I am using the (sim.field.network.)Network field with a Continuous2D field.
> If I use a network directed graph, everything happens fine. But if it is 
> an undirected graph, when the NetworkPortrayal2D is going to draw it, it 
> includes an edge from every node to itself. It was happenning because 
> for each node, it gets all edges and for each node.out of the edge, it 
> tries to draw it. Then if the node.out is not the original node (what 
> would happen for the edges entering into the original node), than we 
> have the bug!
> 
> To fix the problem I put this (italic) statement:
> 
> Bag nodes = field.network.getAllNodes();
> for (int x = 0; x < nodes.numObjs; x++) {
> ...
>     for (int y = 0; y < edges.numObjs; y++) {
>     ...
> /    if ( (locStop == locStart) && (edge.from() != nodes.objs[x])) continue;
> /    ...
>     }
> }
> 
> 
> which means, if the stop location is the same then the start location 
> BUT node.out is different from edge.node.out then it skips drawing it.
> If there are "self-edges node" it will work fine, since edge.from will 
> be equal to nodes.objs[x].
> 
> Well, now everything is working fine.
> 
> Cheers,
> 
> -- 
> Maíra Athanázio de C. Gatti
> PhD student, PUC-Rio, Brazil
> King's College London