![]() |
|
|
#12 | |
|
Apr 2010
2268 Posts |
Quote:
|
|
|
|
|
|
|
#13 | |||
|
"Richard B. Woods"
Aug 2002
Wisconsin USA
22·3·641 Posts |
Quote:
Quote:
The plot consisted of pixels 0.01-inch wide. Subroutines were called with line endpoints as floating-point x,y pairs. One needed to convert each floating-point x,y pair to a series of integer x-pixel,y-pixel positions that lay closest to the line between the given endpoints. The pixel-plot was built up from those series, for each line segment. Quote:
Last fiddled with by cheesehead on 2010-07-09 at 03:30 |
|||
|
|
|
|
|
#14 | |
|
Apr 2010
2×3×52 Posts |
wblipp did. I didn't. Well, ok, I did, but only in the description of the second plot, in order to explain that such things do not matter. It would not hurt in the end, but we cannot consider pixel aspects yet when we have not worked out a precise concept of a polygon's (un)rectangularity.
Quote:
But all this leads us away from the track I have in mind. I have attached a third plot. Again the same set of quadrilateral vertices as in post #3, but this time with How would you fit Last fiddled with by ccorn on 2010-07-10 at 17:09 |
|
|
|
|
|
|
#15 |
|
Oct 2007
Manchester, UK
101010011002 Posts |
From the looks of it, the point x_m has co-ordinates that are simply the average of the x and y co-ordinates for the other 4 points.
There are then three important values, the area in common with the shape, the area of the rectangle that does not overlap the shape, and the area of the shape that is not overlapped by the rectangle. If I had to guess I'd say you find the rectangle centred on point x_m that has the highest area in common with the shape divided by area outside the shape, while also trying to minimise the area of the shape outside the rectangle. As to go about finding that, I don't know. Edit: Alternatively, perhaps you pick the points x'1 to x'4 by finding four points on the circumference of a circle centred at x_m, that form a rectangle, and also minimise the distance to the original four points. A generalisation of this to higher dimensions would be to use a sphere, then hypershere etc. This method would mean you only need to pick two points that will form one of the sides of the rectangle, then from these calculate the positions of the other two points. Last fiddled with by lavalamp on 2010-07-10 at 22:28 |
|
|
|
|
|
#16 |
|
"Richard B. Woods"
Aug 2002
Wisconsin USA
11110000011002 Posts |
|
|
|
|
|
|
#17 | |||
|
Apr 2010
100101102 Posts |
Quote:
For a rectangle this is identical to the barycenter, but for a general quadrilateral it is not. Therefore I just call it the mid-point. Your definition by average is the precise one. So an answer to a part of question (2) is: The mid-points of the given quadrilateral and of the fitting rectangle are the same. Quote:
Quote:
As for the circle/sphere etc: That is simply an easy way to create a guaranteed rectangle: Choose an arbitrary mid-point And indeed, The fitting of the rectangle is done by minimizing the distances of its vertices to the original four points. To make that precise, name a simple expression that takes those four distances and combines them into a single scalar that one could try to minimize. Then you have the answer to question (1), and the rest is a straightforward exercise in optimization with a constraint (equal lengths of Last fiddled with by ccorn on 2010-07-10 at 23:57 |
|||
|
|
|
|
|
#18 |
|
Apr 2010
100101102 Posts |
Yeah. For finite width and resolution, a less extreme version of the problem persists: For most practical purposes, you can still construct an actually inacceptable quadrilateral (with side crossings) with all very-close-to-90-degrees angles, by using a large aspect ratio. Angle-checking is not the way to go, and you have been the first to mention some of the difficulties.
Reconsider fitting a rectangle to the given quadrilateral, as described in post #1. We are making progress. Fill in the remaining blanks. I'd like the answers to the questions in post #1 to be found in order, but that requires analytical skills whereas geometrically-minded people might find the answer to question (2) by just looking at the provided figures. Last fiddled with by ccorn on 2010-07-11 at 00:23 |
|
|
|
|
|
#19 | |
|
Oct 2007
Manchester, UK
54C16 Posts |
Quote:
Making a huge rectangle would result in a smaller standard deviation. However it is possible that you placed a bound on the size of the circle, that it may not fully encompass the entirety of the original shape for example. |
|
|
|
|
|
|
#20 |
|
Oct 2007
Manchester, UK
22·3·113 Posts |
As an aside, just naturally thinking about an "equivalent rectangle" for a shape, I would suggest that the rectangle should have the same area as the original shape, and that it's four corners lie in such a way as to minimise the standard deviation of their distances to the corners of the original shape.
Though this is obviously a different direction to the one you have taken. Last fiddled with by lavalamp on 2010-07-11 at 00:26 |
|
|
|
|
|
#21 |
|
Apr 2010
2·3·52 Posts |
The sought solution is easier (from my point of view, at least). But I appreciate your suggestions on how to combine pointwise errors into one objective function. Among those proposals, clearly there is one that is analytically easiest to handle.
|
|
|
|
|
|
#22 |
|
Apr 2010
15010 Posts |
You almost got it. It's not exactly what you stated, but related. Think even simpler. And some ingredient of standard deviation is in there.
Last fiddled with by ccorn on 2010-07-11 at 00:48 |
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Rectangle Packing | henryzz | Puzzles | 4 | 2012-02-05 16:23 |