I’ve got two huge (>100000 items) collections of PathGeometry I need to compare using PathGeometry.Combine something like this:
List<PathGeometry> firstList;
List<PathGeometry> secondList;
[...]
foreach (PathGeometry pg1 in firstList)
foreach (PathGeometry pg2 in secondList)
{
PathGeometry intergeo = PathGeometry.Combine(pg1, pg2, GeometryCombineMode.Intersect, null);
if (intergeo.GetArea() > 0)
{
// do whatever with intergeo.GetArea()
}
}
To my surprise PathGeometry is part of the GUI and does use the dispatcher, which sometimes causes problems since my calculations do run in some background thread without GUI using Parallel.ForEach()
So I’m looking for an alternative to PathGeometry which is not connected to the GUI.
My figures are quite complex and add a lot of PathFigures to the PathGeometry.Figures.
I’m creating those PathGeometries myself from some bloated government xml files, so it would be no problem to create something else instead. But I need a function to create an intersection of two of these geometries (not adding them to each other) to get the area which both geometries cover, such as the red area in this diagram:

System.Windows.Mediaalso contains a classStreamGeometry, which is a “light-weight alternative” toPathGeometry. It does not support data binding, animation, or modification but since it derives fromGeometryit should have aCombinemethod.See StreamGeometry @ MSDN