Let say I have a polygon. Now I need to scale the polygon at x meters from edges? What will be the scale factor. See this image,
Here I have all co-ordinates of polygon and I need scaling factor of inner polygon which is x meter far from outer one.
Let say I have a polygon. Now I need to scale the polygon at x meters from edges? What will be the scale factor. See this image,
Here I have all co-ordinates of polygon and I need scaling factor of inner polygon which is x meter far from outer one.
Warning: too chatty answer. Sorry about that.
TL;DR If all the corner points are given, then everything you need is in the first chapter of any computational geometry book.
For $1 \le i \le 6,$ let the corner points be $p_i = (x_i, y_i).$ Let the sides of the polygon be $s_1 = (p_1, p_2), s_2 = (p_2, p_3), \ldots, s_5 = (p_5, p_6), s_6 = (p_6, p_1)$ Of course, the length of each side $s = (p_i, p_j)$ is given by $\| p_i - p_j \|.$
Since we are given all the $p_i$'s, we can form linear equations for the $6$ lines passing through each side. Each line takes the forms $ l_i : y = m_i x + b_i $ where $m_i$ is the slope, and $b_i$ is the intercept. Of course, solving each pair of lines would give one of our points back. For example, solving $l_1$ and $l_6$ would yield $p_1.$
Now, given that the new polygon is $d$ meters away (sorry I used $d$ instead of $x$ to avoid notation conflict), our goal should be
Find the $6$ new line equations l'_i: y = m'_i x + b'_i
Solve each pair of l'_1, l'_2 etc to find all corner points p'_i.
From p'_i, compute the new side lengths, and hence the scaling factor for each side.
Step 2, 3 are obvious. So I'll focus on step 1. To do so, let's look on the new system of line equations l'_i : y = m'_i x + b'_i corresponding to the lines passing through the sides of the scaled away polygon. To find m'_i and b'_i, we first notice that the slope remains the same, but the intercept changes. In other words, m'_i = m_i Now we're left with finding b'_i, and the problem is solved.
To do so, take each pair of line equations and do the following:
I'll only pick, for example, $l_1: y = m x + b_1$ and l'_1: y = mx + b'_1 (we already agreed that $m'_1 = m'_2 = m.$) Remember, we know $l_1,$ and we know a point $p_1$ on $l_1.$ We have to figure out b'_1. The perpendicular distance from $l_1$ to l'_1 is $d.$ i.e., the distance from $p_1$ to l'_1 is $d.$
Out of laziness, I will leave the rest as an exercise. Given $p_1,$ and $l_1,$ figure out the unit vector in the direction of $l_1.$ Then flip it (sign change) to get the unit vector in the normal (perpindicual) direction on $l_1.$ Translate $p_1$ in the direction of the normal $d$ meters away to get p'_1. We got our first point! Solve l'_1 using p'_1 to find b'_1. Repeat for all pairs of l_i, l'_i. And continue the steps 1, 2, 3 above.
If I understand your question, it's not as simple as just finding a single scaling factor.
Let's look at something easier. Suppose I have a $6\times48$ rectangle, with a rectangle at 1/2 meter from it. That bigger rectangle will be $7\times49$, which is not just a scaling of the $6\times48$. Scaling preserves relative dimensions, but the $6\times48$ is a 1-to-8 rectangle, while the $7\times49$ is 1-to-7.