**comp.graphics.algorithms**

## Subject: **Plotting non overlapping rectangles**

Hello all,

I'm not really sure what to call my objective apart from rectangle

avoidance. Anyway I'll do my best to describe the task at hand.

I have one fixed rectangle of known coordinates with its baseline

horizontal.

Within this rectangle (not necessarily center) I have a point of known

coordinates, which I'll call A.

Outside the rectangle I have another point also of known coordinates, which

I'll call B.

Point A is fixed, but Point B is moveable.

Points A and B describe the center line of another rectangle. To generate

the coordinates for the 4 corners of this rectangle I add or subtract

predetermined offsets (xoff & yoff) to Ax, Ay and Bx, By. xoff and yoff

being calculated from the known width of this rectangle.

If you can understand what I've tried to describe you'll see that you have 2

overlapping rectangles.

What I need to do is calculate the coordinates of a point C, along the line

AB and just outside the fixed rectangle. When I construct a rectangle around

the line CB using the same offsets as before, I want the resulting rectangle

to touch but not overlap the fixed rectangle.

If I were to replace the fixed rectangle with a polygon which has all sides

either vertical or horizontal, how would I go about finding a similar

solution.

Many thanks.

Steve

Reply

View All Messages in

**comp.graphics.algorithms**

path:

Replies:

Re: Plotting non overlapping rectangles

Copyright © 2006 WatermarkFactory.com. All Rights Reserved.