This project has moved. For the latest updates, please go here.

Scaling problem

Mar 9, 2010 at 1:43 PM

I’m writing graphical representation of process inside SQL Server – each process (SPID) In SQL is represented by circle with body and geom – I would like to make circles grow while SPID is working (long time task will be larger). But I have a problem – when I’m scaling my circle other circles go inside this big circle instead collide and push away each other. To scale I’m using code like this:

// WPF circle object

_InnerVisual.Width *= ratio;

_InnerVisual.Height *= ratio;


// geom scale

Vector2 v = new Vector2(ratio);           

_InnerGeom.LocalVertices.Scale(ref v);


I’m new with this library – can anybody point me some advice how to scale circle to achieve right behavior? 

Mar 9, 2010 at 4:24 PM

Farseer Physics Engine 2.x does not have recovery code of the situation you mention and thus objects can get stuck in each other if you change them (scaling, moving without forces etc.). You will have to manually push the geometries away by applying forces to the surrounding geometries with a vector that is pointing away from the center of the circle. You can have a look at the explosion demo from the advanced samples to see how to calculate the vector.