## Re: [Algorithms] Best fit of polygon inside another polygon

 Re: [Algorithms] Best fit of polygon inside another polygon From: Osman, Brian - 2009-05-24 17:20:57 ```So what's your precise metric for "best fit"? Earlier you mentioned the area of the polygon that doesn't fit into the quad... But if scale (even uniform scale) is a permitted transformation then that must only be part of the metric. It's trivial to scale all polygons down to a point, such that they all fit perfectly into ANY quadrilateral. -Brian -----Original Message----- From: Stefan Dänzer [mailto:stefan.daenzer@...] Sent: Saturday, May 23, 2009 12:08 PM To: Game Development Algorithms Subject: Re: [Algorithms] Best fit of polygon inside another polygon Hi Emil, that's not exactly the problem I am trying to solve. Maybe I have stated it incorrectly. In my case the surrounding quad is of fixed size. I have different polygons with varying shape and size and I want to find the polygon and according transformation of the polygon which best fits it into the given quad. The allowed transformations which can be applied to the polygon are translation and scaling. regards, Stefan On Fri, May 22, 2009 at 8:27 PM, Emil Persson wrote: > I'm tired and I have a headache, but if I understand your problem right then > it sounds like a special case of a problem I just solved last night and > wrote a tool for: > > http://www.humus.name/index.php?page=News&ID=266 > > > > So you'd just input your polygon directly (instead of inputting a particle > texture and generate a polygon from that) and optimize for 4 vertices and > that would solve it, no? > > > > -Emil > > > > > > From: Stefan.Daenzer@... [mailto:Stefan.Daenzer@...] > Sent: 22 May 2009 14:59 > To: Game Development Algorithms > Subject: [Algorithms] Best fit of polygon inside another polygon > > > > Hi, > > I've been thinking about an algorithm which fits a given polygon into a > quad. I've stumbled upon this while trying to fit the largest possible > polygon out of a set of different polygons into a quadliteral. What I want > to find is the best-fit-polygon which can be contained completely in the > quadliteral. The polygon and quad can be assumed to be convex. An nice > feature would be to calculate the error as a function of the area which > doesn't fit into the quad for every polygon I throw at the quad. > > I'm working in 2D right now, but might want to expand the problem for a > later application into a 3D case (fit a polyhedra into a hexahedron). > > Any ideas how to solve this problem? > > Stefan > > ------------------------------------------------------------------------------ > Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT > is a gathering of tech-side developers & brand creativity professionals. > Meet > the minds behind Google Creative Lab, Visual Complexity, Processing, & > iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian > Group, R/GA, & Big Spaceship. http://www.creativitycat.com > _______________________________________________ > GDAlgorithms-list mailing list > GDAlgorithms-list@... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list > -- -- Stefan Daenzer Körnerplatz 8 04107 Leipzig Tel.: +49-176-61157550 "Work like you don't need the money, love like you've never been hurt and dance like no one is watching." - Randall G Leighton ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://www.creativitycat.com _______________________________________________ GDAlgorithms-list mailing list GDAlgorithms-list@... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list ```