Home Products Download Order Contacts


Subject: Re: Plotting non overlapping rectangles

"Stephen Brown" wrote in message

> 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

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


View All Messages in comp.graphics.algorithms

Plotting non overlapping rectangles =>

Re: Plotting non overlapping rectangles

Copyright 2006 WatermarkFactory.com. All Rights Reserved.