Yesterday I asked this question seems not clear. So, I am writing new question with mathematical terms only.
Here is some points about shapes I used:
- Square: Rectangle that all angles are 90° & all sides are equal length. So, consider Square also a Rectangle.
- Triangle: I used an equilateral triangle is a triangle in which all three sides have the same length.
- Polygon: A finite number of straight line segments connected to form a closed.
So, Here after I use the term Polygon to describe triangle & rectangle shapes when it's required to mention
consider this shape as polygone. Becuase, I used triangle (regular polygon) to simplfy the work to find out the formula.
Variables used in this problem:
- b = Border width
Bounds of Outer Rectangle (r) that enclosing the polygon(p):
- x = Origin x
- y = Origin y
- w = Width
- h = Height
r = (x,y,w,h) then, Bounds of Inner Rectangle that encloses the inner polygon(p1)
(r1) = (x1,y1,w1,h1)
Here, inner polygon = Polygon by subtracting the border width.
What is my final goal:
I should able to calculate inner rectangle boundary of any polygon like below image, I have angles, outer rectangle bounds & border width. The problem is to find out the inner rectangle bounds across to the outer rectangle based on the polygon at that enclosed by inner rectangle.
Consider a Polygon(p) as a shape of rectangle(r) which has width(w) is 100 & height(h) is 100. The border width of the polygon is 10. The what is the inner boundary of the rectangle that encloses the inner polygon?
Note: I solved it by mind calculation(I didn't took angles in the calculation). But we can't apply this same formula for triangle. So, this is not solution for my problem.
Consider the polygon (don't consider regulard) with three edges and three vertices & all angles are equal in measure.
If the rectangle(r) boundary is zero & size(w,h) is (100,87) that encloses the polygon(p) along with polygon border width as 10, then
What is the bounds of the inner rectangle(r2) that encloses the inner polygon(p2) ?
Hope I clearly explained the problem. If anything I am missed then please let me know. Thanks in advance.