John Smith wrote:

//Shrinks the specified polygon by one pixel (in any relevant

direction) //so that the shrunken polygon sits exactly within the

original (specifed) polygon.

public void Point[] ShrinkPolygon(Point[] polygon)

{

//How do I do this?

}

You haven't provided enough information. Is the polygon displayed in

2D or 3D? Is there an orthogal projection of the polygon on the screen

or not?

if it's an orthogonal projection in 2D, you also could have done it

(translate the x / y of the vertices passed in towards the center of

it) so I guess it's not orthogonal in 2D ;).

If it's a problem which means that you want to end up with a polygon

P' which is exactly 1 pixel inside polygon P in _pixelspace_ (thus

after translation), you've to first calculate the end polygon of P in

pixelspace, thus after translation, then do a subtract towards the

center, and then use an inverse matrix to get to the original polygon.

FB

--

------------------------------------------------------------------------

Lead developer of LLBLGen Pro, the productive O/R mapper for .NET

LLBLGen Pro website:

http://www.llblgen.com
My .NET blog:

http://weblogs.asp.net/fbouma
Microsoft MVP (C#)

------------------------------------------------------------------------