How to enlarge a 2D polygon (conex, nonconvex)

R

Rafal 'Raf256' Maj

(e-mail address removed)
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;
 
S

Shamli

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 said:
(e-mail address removed)
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

Arthur J. O'Dwyer

[re-arranged for clarity]
Please, please, please don't top-post!

A: Because it's annoying as hell.
Q: Why shouldn't I top-post?
Rafal 'Raf256' Maj said:
(e-mail address removed)
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.

Take this to comp.programming (followups set).

-Arthur
 
R

Rafal 'Raf256' Maj

(e-mail address removed)
yes the polygon is a set of 2D points;
No this will not work. by multiplying we are just moving the polygon.

Wrong,
by multiplaying You *are* zooming (and maybe also moving - is object is not
centered before).

To just move we must add x+= y+=

Hm maybe I can write smale example for You, contact mu on priv (I'm adding
(e-mail address removed) to my whitelist)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top