In inkscape, it can be particullary hard to evaluate the real width of objects, such as square, rectangle or right triangle, when a stroke width is applied.
Let’s try to make it a little more clear:
- is the stroke width you set up in the “Fill and Stroke” box
- is the initial width you can set up in the “Transform” box (“Scale” tab) (Be carefull to apply until your object had the correct width and height
- is the total width of your object, taking into account the stroke width .
- is the width of the internal part of your object (the one wich is colored by the Fill function in the “Fill and Stroke” box
The tools allows you to set up and , but if you want to scale and place your object precisely, you will want to know and .
So, we need equations that link:
- to and (Equation 1)
- to and (Equation 2)
An exemple of application
In a specific project of mine, I had to put 2 identical right triangles in the height with this specific conditions:
- the bottom stroke of the triangle in the bottom should be visible inside the document and at the very bottom of it
- the top stroke of the triangle in the top should be out of the document and the top extremity of the “Fill” area should be at the very top of the document
- Moreover the outer limit of the stroke of the bottom triangle should arrive precisely at bottom right corner of the document
I summarize this conditions in the following equations:
- Equation 3: where MAX is the width of the document (in this cas, the width was equal to the eight)
- Equation 4:
When replacing from Equation 2 with its value in Equation 3, and replacing from Equation 1 with its value in Equation 4, we obtained a 2 equations system:
- Equation 5:
- Equation 6:
Solving this system lead to and allowed me obtain a unique pair value . By appling this object width and stroke width to my objects, I ended up with perfectly placed and scaled objects.
Thank you maths.