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
}

```
This is more an extended comment than an answer.

I would divide the problem up into several easier problems, and work on each of them separately:

* Draw your rectangle with a specified center location and long axis orientation.
* Determine the center point and long axis orientation for an object orbiting around the origin. Note that to get make the long axis a tangent it needs to be perpendicular to the radius through the center.
* Translate the whole system so that it orbits the desired point, rather than the origin.