algorithm - How to find best fit of convex polygon into other convex polygon -


i'm looking algorithm calculate translation, rotation , scaling required position convex polygon (p1) inside convex polygon (p2). need return "best fit", meaning p1 contained within p2 , has maximum area possible.

consider following diagram: http://i.imgur.com/ckaiiv7.png

the black polygon on right (p1) needs placed optimally inside blue polygon on left (p2).

i have found lots of written papers online polygon containment algorithms algorithms determine whether or not polygons can fit inside polygon given ability translate , rotate them.

the algorithm i'm looking should produce result because includes ability scale polygon p1. understand type of algorithm produce multiple optimal answers , that's okay.

any help?

ok, if nobody has better idea, give not-so-good algorithm.

let's have p1 p vertices , p2 q vertices, , want fit p1 inside p2.

you found articles describing how determine whether p1 can fit inside p2. example this article gives algorithm in o(pq^2) time. i'm not sure if can still faster if know both p1 , p2 convex.

so, start large number a such a(p1) cannot fit inside (p2), , binary search on value of a.

this not clever, @ least gives answer. if else posts better answer, please ignore mine...


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -