Your image shows a square. Though it is a rectangle, there is no implication of which way it should be extended. My first thought was to extend it in the direction of its longer sides, but of course a square has all sides equal.
And then, what if the "sides" intersect a polyline arced (bulged) segment? Should the rectangle be morphed to adopt the same shape between its intersection points? Or is it preferred that the rectangle remain a rectangle?
Anyway, I guess the first step is to determine if the rectangle is rectangular. Or maybe the OP accepts the definition of a rectangle in a loose format, like a rectangularish trapezoid.
John F. Uhden
I was expecting you to shine through with your expertise.
Only thing is your midpoint function looks a little beginnerish.
I think this is what I use, but I didn't copy it...
(defun midpoint (p1 p2)
(mapcar '* '(0.5 0.5 0.5)(mapcar '+ p1 p2))
)
John F. Uhden
@john.uhden wrote:
...
(defun midpoint (p1 p2) (mapcar '* '(0.5 0.5 0.5)(mapcar '+ p1 p2)) )
Save yourself a few code characters:
(mapcar '/ (mapcar '+ p1 p2) '(2 2 2))
As long as p1 & p2 are point coordinate lists, coming from entity data or (getpoint) or (polar) or the like, their coordinates will always be real numbers, so the divisor 2's can be integers.
Excellent point!
I usually favor multiplying because it's faster than dividing, but unless you've got 10,000 midpoints to find you probably wouldn't discern a difference.
John F. Uhden