Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Fit rectangle to set of points

  • To: mathgroup at
  • Subject: [mg69340] Re: [mg69330] Fit rectangle to set of points
  • From: Stern <nycstern at>
  • Date: Thu, 7 Sep 2006 23:58:09 -0400 (EDT)
  • References: <>

Sounds like a homework problem, but I'll bite. I'm assuming you want
to graph this.

Format your data in a list of cartesian points {{1.1, 3.4},{4.5,9.17},...}

Then create the rectangle

      bottom, left, right}, top = Max[Transpose[data][[2]]]; bottom = Min[
        Transpose[data][[2]]]; left = Max[Transpose[data][[1]]]; right =
          1]]]; Line[{{left, bottom}, {left, top}, {right, top}, {right,
          bottom}, {left, bottom}}]]] /. data -> WHATEVER]

Then create the dots

dots=Release[Hold[Map[Point[#] &, data]] /. data -> WHATEVER]

And finally,

Show[Graphics[box], Graphics[dots]]

Have fun!

On 9/7/06, buttgereit at <buttgereit at> wrote:
> Dear Group,
> I have a set of 2D points given for which I would like to find the
> smallest rectangle circumscribing all the points.
> Doing this with a circle instead of a rectangle was easy --- for the
> rectangle I don't see the trick.
> Any hints?
> TIA + Best Regards,
> Peter

  • Prev by Date: Re: GridLines on top of Raster or RasterArray?
  • Next by Date: Re: Fit rectangle to set of points
  • Previous by thread: Fit rectangle to set of points
  • Next by thread: Re: Fit rectangle to set of points