Question: My maths isn't that good so I'm having a bit of trouble in one of my applications that I'm trying to do where I want a rectangle to represent a vehicle and I want that vehicle/rectangle to "drive" around in a circle. Imagine a roundabout with only 1 vehicle in it, just circling around forever.

If I can get some help how to do that then I'll be able to build on the example and most importantly learn. 

If someone could write up a simple example for me I'd be grateful. No background no images, just a rectangle "driving" around in a circle. I'm using java and Swing.

Answer: 
Sorry, I am not sure if could understand clear you exactly need. If you need to draw rectangle which is moving around inside of circle, you can use sin/cos functions.

Something like that:

```
double r = 50.0; // radius (it might radius of your circle, but consider dimensions of rectangle to make sure you are drawing inside of circle, e.g. circleRadius - rectangeDimesion / 2.0)
for (int f = 0; f < 360; f++) {
    double x = Math.sin(Math.toRadians((double)f)) * r;
    double y = Math.cos(Math.toRadians((double)f)) * r;
    // draw rectangle on [x, y] coordinates
}

```
If you know the radius of the round about, all the you would need would be a trigonometric function and the angle which the vehicle makes to the round about. You could take a look at [this](http://www.mathsisfun.com/sine-cosine-tangent.html) simple introduction which should get you started in the right direction.

On another hand, another approach would be to use a [Transformation Matrix](http://en.wikipedia.org/wiki/Transformation_matrix) where you start with a matrix containing two points (your X and Y co-ordinates) and you transform them to become the new co-ordinates.

You can then rotate the rectangle to mimic a vehicle turning.

If you have a limited background in Mathematics, the first option might be easier for you to grasp.