How to get the co-ordinates of scaled down polygon

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.

Solutions Collecting From Web of "How to get the co-ordinates of scaled down polygon"

  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}$.

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.