**comp.graphics.algorithms**

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

"Stephen Brown"

news:-6KdnfK1q7zBnv_Z4p2dnA@comcast.com...

> 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.

Let D = B - A. The point C = A + t*D for some t > 0.

The line containing C and perpendicular to D has the

property that it contains one or two of the fixed

rectangle's vertices, the other vertices "behind" the

line.

Let V[i], 0 <= i <= 3, be the vertices of the fixed

rectangle. Determine the index k for which

Dot(D,V[k]-A) is a maximum. The vertex V[k] is

an extreme vertex of the rectangle in the direction D.

The point C = A + Dot(D,V[k]-A)*D.

--

Dave Eberly

http://www.geometrictools.com

Reply

View All Messages in

**comp.graphics.algorithms**

path:

Plotting non overlapping rectangles =>

Replies:

Re: Plotting non overlapping rectangles

Copyright © 2006 WatermarkFactory.com. All Rights Reserved.