# Physics - Equations Model

#### Modeling Motion

You could offset or move the object with the following type of method:

Boolean isInside(float x, float y, float z) {return shapeToBeMoved.isInside(x+xOffset, y+yOffset, z+zOffset);}

#### Modeling Forces

We could deform a shape by changing the parameters of an equation, for example we might model a muscle, which changes shape depending on a parameter 'contraction' as follows:

boolean isInside(float x, float y, float z) {return ((r*r < (x+contraction)*(x+contraction)+(y+contraction)*(y+contraction)+z*z);}

#### Collision detection

Then collisions could be detected by cycling though all values of x, y and z. Then checking if for a given set of x, y and z, if more than one objects isInside method returns true then the objects are trying to occupy the same space.

The scene graph could be generated, every frame, by feeding these equations into a mesher.

At first sight this may seem horribly inefficient, with lots of very slow bits of code like this:

```for (x=-100000; x<100000;  x=x+0.001) {
for (y=-100000; y<100000; y=y+0.001) {
for (z=-100000;  z<100000; z=z+0.001) {
...
}
}
}```

but I'm not sure its as bad as that, I think there could be tricks to make it more efficient, for example areas of space nearer the camera could be scanned at closer intervals than more remote parts of space.

#### Collision response

This might be done in the meshing method, for instance individual verticies could attract each other (as in metaballs) or they could repel each other (Relaxation Methods)