What steps will reproduce the problem?
1. Start some demo with many polygons in it.
2. Open visualvm, and make cpu sampling.
3. EdgePairs.toList() - on the top 1 position using many CPU time.
What is the expected output? What do you see instead?
-
What version of the product are you using? On what operating system?
2008-04-06
Please provide any additional information below.
I looked in code. And found that it is not nesessary to convert EdgePairs to
int[][]. Creation of int[][] is heavy operation. We can simply pass iterator of
EdgePairs where it needed instead of int[][]. Here is code of iterator:
private class EdgeParisIterator implements Iterator<EdgePair>
{
private EdgePair current;
@Override
public boolean hasNext()
{
if (current != null)
{
return current.next != null;
}
return first != null;
}
@Override
public EdgePair next()
{
current = current == null ? first : current.next;
return current;
}
@Override
public void remove()
{
throw new RuntimeException("Method not supported!");
}
}
Example of use in LinePolygonCollider:
Iterator<EdgeSweep.EdgePairs.EdgePair> collEdgeCands =
sweep.getOverlappingEdges();
IntersectionGatherer intGath = new IntersectionGatherer(vertsA, vertsB);
while (collEdgeCands.hasNext())
{
EdgeSweep.EdgePairs.EdgePair pair = collEdgeCands.next();
intGath.intersect(pair.a, pair.b);
}
Patched code shows much greater performance.
code of all engine with my patch in attachment.
Original issue reported on code.google.com by good.guy...@gmail.com on 28 Jul 2012 at 8:56
Original issue reported on code.google.com by
good.guy...@gmail.com
on 28 Jul 2012 at 8:56Attachments: