I’m working on a piece of software that should be able to calculate an area defined by some logic that I will describe beneath. People that would help me out with this challenge should take a look at the image that I have on this link. I think that image makes it easier to understand my text below.

My main question is: How do I calculate a rectangle surrounding multiple circles?

1. I have a known point called A

2. From there a make a vector ending at point B, based on some business rules

3. From point B I make another vector ending at point C, also based on some business rules

4. A point B, I make two additional vectors by adding/subtracting X degrees from vector C direction. This new vectors is ending at point c(min) and c(max)

5. I know make three new vectors between point A and the three new point named C, C(min) and C(max). Showed with solid lines on the image

6. Around each of the three C-points I make a circle with a radius that is 30 % of the magnitude of the related vector made in step 5.

7. So far so good, no problems in calculating that.

8. The problem is now, how do I calculate a rectangle that surrounds the circles? As you can see the surrounding rectangle must be rect-angled on the vector between A and C.

Anybody that can help me out here? I have tried several solutions but without luck