MASON-INTEREST-L Archives

July 2009

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Maíra Athanázio Gatti <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Fri, 3 Jul 2009 18:13:34 +0100
Content-Type:
multipart/alternative
Parts/Attachments:
text/plain (1208 bytes) , text/html (1425 bytes)
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


ATOM RSS1 RSS2