Advertisements

yes the polygon is a set of 2D points;
No this will not work. by multiplying we are just moving the polygon.

"Rafal 'Raf256' Maj" <> wrote in message news:<Xns941195E9139Eraf256com@213.180.128.20>...
> news:
>
> > I am looking for an algorithm that enlarge a 2D polygon.
> > cheers,
>
> Is polygon is a set of 2D points, how about multiplying all of them by some
> value ?
>
> x *= zoom;
> y *= zoom;

A: Because it's annoying as hell.
Q: Why shouldn't I top-post?
> "Rafal 'Raf256' Maj" <> wrote in message news:<Xns941195E9139Eraf256com@213.180.128.20>...
> > news:
> >
> > > I am looking for an algorithm that enlarge a 2D polygon.
> > > cheers,
> >
> > Is polygon is a set of 2D points, how about multiplying all of them by some
> > value ?
> >
> > x *= zoom;
> > y *= zoom;
>
> yes the polygon is a set of 2D points;
> No this will not work. by multiplying we are just moving the polygon.

No, you're not. You're scaling it by the constant 'zoom'.
Try it and see. Alternately, you can keep the centroid of
the polygon in the same place by first scaling it, and *then*
translating ("moving") it back to the "right" place by adding
a second constant.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!