3

I do apologize beforehand as geometry is forever my Achilles heel. This might have some obvious solution I just cannot see. Please have a patience with me, if the schema is not marked or described by standards etc. Thanks

I have this geometrical object G1 (area filled with yellow):
enter image description here
It is a polygon created by 'widening' of geometry (G2) marked in black, widened by thickness (T).
All known values (lengths) are marked in the schema.
And I am trying to find a way to calculate X.

(It is a piece from graphic tool I am programming.)

The known values are: bounds of the object (width W1, height H1), bounds of the geometry G2, rectangular sides of the geometry G2 (W2,H2), radius (or offset) of the sloped corners of G2 (R) and coordinates of all vertices of geometry G2.

I was staring at it for 2 hours, charted all the known values, and trying to find a triangle in it with enough known values to calculate the unknown but came up with nothing so far.
Be glad for any advice

Aric
  • 249
Riva
  • 141

1 Answers1

1

I have found a solution (in two steps):
1. I have altered the variable R so R*2 = H2 producing this shape:

enter image description here
There is clearly visible quad that can be constructed from known values. Its side is always half of thickness T. From that I can calculate X with Pythagorean theorem.

Going back to original values / shape ..

enter image description here
I can still construct the quad there, but to get X, I need to subtract altitude to hypotenuse of the triangle that substitutes the missing 'tip'.
Since the tip is Right Isosceles Triangle, the altitude is always half of its base, which is
H2 - 2 * R.

So finally the X can be (clumsily) calculated as $$X = \sqrt {(T / 2)^2 + (T / 2)^2} - (H_2 - R \times 2) / 2$$

Riva
  • 141
  • If you have to program this for some "real" application, you might also have to take care about the case H2 >> R. So a max(T/2, X) might be a good idea. – Thomas Klimpel Jun 09 '14 at 21:43
  • "H2 >> R" do you mean "H2 is bigger then R" ? Sorry not sure what you mean. – Riva Jun 10 '14 at 18:08