1

##### AutoLISP (Vanilla / Visual) / Re: Minimum rectangle

« Last post by**ribarm**on

*»*

**Today**at 10:14:00 amwell20152016, don't get me wrong, but I hope that you realized that results with multiple polygons nesting aren't 100% reliable...

To explain what I am saying :

Lets say we took selection set of polygons sorted by areas like it is in my posted lisps... Even without transformations like mirror, one resulting outcome of calculation by this array may be more adequate than with included mirroring. What I mean 1-2-3-4-5 polygons are currently calculated so that at each sub step 1-2 minimum enclosing rectangle is searched, then that 12 is meeting 3, so 12-3 is calculated so that 123 minimum enclosing rectangle is searched, but at this point it may sometimes occur that not minimum 123 will produce final 12345 as minimal, but some other branch where 123 is maybe larger than searched 123 by calculations by posted routines... Further more this not logical simptom may occur in every step of rearranging and what's even more frustrating when mirroring is included 12 may be normal, 3 mirrored, and then 123 already complex can be altogether mirrored again... So given all this facts, I think that you see that algorithm should be much more complex and to gain desired result, calculation should be much more time consuming... But that's not all!!! This is how should it be doing with 1-2-3-4-5, but in fact there are combinations of 5 elements multiplied with combinations of 5 mirrored elements and who knows how much combinations of already processed 123 for ex. elements combined of 2 mirrored and 1 not mirrored or 1 mirrored and 2 not mirrored or all 3 mirrored or all 3 not mirrored or middle (2) element mirrored and (13) elements not mirrored and ...

What can we say for sure is that posted routines are correct for 2 polygons - first without mirroring should get you desired result just little larger than second which is taking into consideration and mirroring...

So this versions are just fine for quick packing of multiple polygons into some kind of minimal enclosing rectangle that is composed in straight away lisp simple calculation giving in return result that's quick and satisfactory in optimal time limit...

Conclusion : do not take everything that's close to satisfactory as 100% true... Nesting is complex process and even with preset inputs that are simple like polygons without arcs and desired resulting minimal enclosing rectangle you see the complexity of calculations that are to be processed... So if you plan to utilize and use those posted lisps, I advice you to use it on only 2 polygons as by my testings only then result is reliable...

Of course if you're in hurry and plan to just find what's possible in short time limits with just a few input polygons, then it's your call wheather you'll find it good enough to be claimed as desired resulting outcome...

Regards, M.R.

To explain what I am saying :

Lets say we took selection set of polygons sorted by areas like it is in my posted lisps... Even without transformations like mirror, one resulting outcome of calculation by this array may be more adequate than with included mirroring. What I mean 1-2-3-4-5 polygons are currently calculated so that at each sub step 1-2 minimum enclosing rectangle is searched, then that 12 is meeting 3, so 12-3 is calculated so that 123 minimum enclosing rectangle is searched, but at this point it may sometimes occur that not minimum 123 will produce final 12345 as minimal, but some other branch where 123 is maybe larger than searched 123 by calculations by posted routines... Further more this not logical simptom may occur in every step of rearranging and what's even more frustrating when mirroring is included 12 may be normal, 3 mirrored, and then 123 already complex can be altogether mirrored again... So given all this facts, I think that you see that algorithm should be much more complex and to gain desired result, calculation should be much more time consuming... But that's not all!!! This is how should it be doing with 1-2-3-4-5, but in fact there are combinations of 5 elements multiplied with combinations of 5 mirrored elements and who knows how much combinations of already processed 123 for ex. elements combined of 2 mirrored and 1 not mirrored or 1 mirrored and 2 not mirrored or all 3 mirrored or all 3 not mirrored or middle (2) element mirrored and (13) elements not mirrored and ...

What can we say for sure is that posted routines are correct for 2 polygons - first without mirroring should get you desired result just little larger than second which is taking into consideration and mirroring...

So this versions are just fine for quick packing of multiple polygons into some kind of minimal enclosing rectangle that is composed in straight away lisp simple calculation giving in return result that's quick and satisfactory in optimal time limit...

Conclusion : do not take everything that's close to satisfactory as 100% true... Nesting is complex process and even with preset inputs that are simple like polygons without arcs and desired resulting minimal enclosing rectangle you see the complexity of calculations that are to be processed... So if you plan to utilize and use those posted lisps, I advice you to use it on only 2 polygons as by my testings only then result is reliable...

Of course if you're in hurry and plan to just find what's possible in short time limits with just a few input polygons, then it's your call wheather you'll find it good enough to be claimed as desired resulting outcome...

Regards, M.R.