3
$\begingroup$

Let say I have a polygon. I need to draw another polygon inside this polygon which is scaled-down. See this image,

enter image description here

I need inner Polygon co-ordinates. Given that I have outer polygon co-ordinates and scaled down value.

$\endgroup$
2
$\begingroup$
  1. Define the center of the polygon $(\bar{x}, \bar{y})$. This could be the mean, center of gravity, center line, etc.

  2. Subtract the center from each vertex point $x_i = x_i - \bar{x}$, $y_i = y_i - \bar{y}$.

  3. Scale each vertex point $x_i = \alpha x_i$, $y_i =\alpha y_i$.

  4. Shift back the center $x_i = x_i + \bar{x}$, $y_i = y_i + \bar{y}$.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Excellent Man.. $\endgroup$ – user960567 Mar 28 '12 at 10:47
4
$\begingroup$

Shift the center of the polygon to the origin, scale it in X and Y directions and push the center of the polygon back where it was.

Here are the matrix multiplications you need to perform:

$$\begin{pmatrix} x_a & y_a & 1\\ x_b & y_b & 1\\ x_c & y_c & 1\\ x_d & y_d & 1\\ \end{pmatrix} \begin{bmatrix} 1 & 0 &0\\ 0 & 1 &0\\ -x_{center} & -y_{center} &1\\ \end{bmatrix} \begin{bmatrix} Scale_x & 0 &0\\ 0 & Scale_y &0\\ 0 & 0 &1\\ \end{bmatrix} \begin{bmatrix} 1 & 0 &0\\ 0 & 1 &0\\ +x_{center} & +y_{center} &1\\ \end{bmatrix} $$ where $x_{blah}$ denotes the x co-ordinate of blah. Y is similar.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ This is also correct. Thanks $\endgroup$ – user960567 Mar 28 '12 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.