How to obtain all vertices of equal parallelograms that cover a 2D rectangular area?
3 views (last 30 days)
Show older comments
Can anyone help me? I have a 2D rectangular area and I want to fill it with equal parallelograms with specific size so that the first one is located at the left vertice. At the end I want get the vertices of all parallelograms. Is there an easy method in matlab to do this?
0 Comments
Answers (1)
Walter Roberson
on 3 Jun 2015
In the general case, this cannot be done. Consider for example asking to fill a 3 x 3 area with parallelograms of area 2. No matter how you arrange them, no matter what angle you used for the sides, after you have put 4 non-overlapping parallelograms in, the covered area will be 4*2 = 8, and there would not be enough room to fit another parallelogram of the same area into the remaining 1 unit of rectangle.
The easiest way to fill a rectangle is with rectangles. Rectangles are parallelograms. There are some situations you can use different rectangles with the same size (area) to fill a given area. For example, consider a 3 x 4 area, then you can fill it like
---------
|x x x x|
---------
|x x|x x|
|x x|x x|
---------
In this particular case you could also use 3 of the 1 x 4 rectangles. I do not know at the moment if there are cases where using two different shapes with the same area is necessary.
If you do not use rectangles then you cannot fill the rectangular area. For example:
--------
|o/x x/|
|/x x/o|
--------
you cannot fill the triangles marked with "o" with parallelograms: even if you use smaller and smaller parallelograms you would always have some portions left over.
3 Comments
Image Analyst
on 4 Jun 2015
So just make an array of x and y. Every other row/line/y will have the x values shifted/sheared so that you don't simply have a rectangular grid, like
y = whatever....Maybe use meshgrid or something to construct it.
x = whatever....
x(2:2:end, :) = x(1, :) + someShiftAmount;
Walter Roberson
on 4 Jun 2015
Are the parallelograms to be identical or equal area or equal length of one of the sides or equal angle? Are they to form a regular lattice or are they to be at different orientations that all pack together, sort of like the tangram puzzle?
Are you asking to divide the rectangular area into a given number of parallelograms across (or down) and with a given area each and the question is to find the skew that will produce that area of parallelogram? If so then the area of a parallelogram is base times heigh. by dividing the known rectangle width by the number of divisions, you calculate the base. Divide the required area by that to get the height. Any angle can be used. In practice this means that if you construct a rectangular grid and add a linear amount to each x according to the y, then the result will still have the same area and your only complication would come if the skew angle was enough that you need to add more nodes if the total x shift by the top exceeds the base. Easier explained with a diagram but this mobile phone interface is too awful to draw one.
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!