Inkscape.org
Beginners' Questions Nested objects
  1. #1
    JohnCC JohnCC @JohnCC

    Hi I created this nested object by a squence of square overlaps then using the union function then deleting segments, But would like to establish a quicker workflow.

    I have tried to use the an 8 sided star and varing the spoke ratio but cannot get the contol to ensure 90 and 45 degrees are right

    Sq
  2. #2
    Polygon Polygon @Polygon🌶

    Aside from having 2 squares - 1 at 45° - no stroke just fill - Boolean-add (Union) - delete fill give thick stroke - then Stroke to Path - ungroup - deleted garbage it´s in essence this:

  3. #3
    Tyler Durden Tyler Durden @TylerDurden

    Another way (includes optionally making two objects):

  4. #4
    Polygon Polygon @Polygon🌶

    Sorry Tyler, but the Spoke ratio for an octagonal star is wrong  -  I´m not getting behind the math; but it´s more something about ≅0,765

    Like I said easy+accurate via 2 Squares.

  5. #5
    Tyler Durden Tyler Durden @TylerDurden
    *

    Right you are.

    PS: 0.765 looks pretty good here, if snapping is to be trusted.

    Star
  6. #6
    Polygon Polygon @Polygon🌶

    Do you know the underlying math?

  7. #7
    Xav Xav @Xav👹

    In this specific case it can trivially be created using the polygon tool, taking advantage of snapping and the fact that Inkscape creates 45° guides when you drag from the ends of the rulers:

     

  8. #8
    Polygon Polygon @Polygon🌶
    TylerDurden

    PS: 0.765 looks pretty good here, if snapping is to be trusted.

    Seems to can be approved by Xav´s method and snaps to 0,765 - I just wonder where that number comes from?

  9. #9
    Aero Aero @Aero◻️

    The more accurate Spoke ratio value 0.765367 is stored in preferences.xml.

  10. #10
    tukykarmakar tukykarmakar @tukykarmakar

    I see that many people have suggested their methods of doing it, here is my explanation of one of these methods. Read the Theory if you want to understand how it works, read the Practical to make it.

    Theory

    The Star and Polygon tool can create either a star or a polygon having the features defined by the parameters given by the user. Your shape is a star, which has Spoke Ratio as one of its defining features. The spoke ratio is the ratio between the base radius and the tip radius, you can see this if you hover your cursor on the Spoke Ratio box. Referring to the figure below, spoke ratio = length of red line / length of blue line. For your case, the spoke ratio is 0.76666… an infinite decimal.

    Practical

    Step 1: Draw a star using the Star and Polygon tool while holding down the Ctrl button (this locks rotation of every shape while drawing by 15-degree increments and will help you later to rotate easily). To make sure that it’s a star, click on the star icon near the top-left corner, below the menu bar.

    Step 2: Using the Star and Polygon tool, select the shape you drew and put 8 in the ‘Corner’ parameter and 0.766 in the ‘Spoke Ratio’ parameter.

    Step 3: Align and Rotate the shape to what you need.

  11. #11
    Polygon Polygon @Polygon🌶

    I already figured; but its still 0,765236567:

  12. #12
    Tyler Durden Tyler Durden @TylerDurden

    Excellent, Mark!

  13. #13
    Xav Xav @Xav👹
    *

    I've spent far longer on this than I should have - and I'm no mathematician, so there's probably some shortcut, rule or law I should have used - but here's my take on the 0.765 value. First, some construction lines:

     

    We have two unknown length lines - the red vertical one, drawn here as a dashed part and a solid part; and the angled green one. We want to know the ratio of their lengths.

    Let's designate the length of the complete red line (both parts) as "x".

    Let's say that the length of the solid part of the red line is length 1 unit. Therefore the horizontal purple line is also 1 unit.

    By symmetry (indicated by the second purple line), we know that the angle between the red and green lines is 22.5°.

    The length of the dashed part of the red line must be (x - 1).

    Now we have two sides and an angle for the red-green-purple triangle.

    From trigonometry we know that tan = opposite/adjacent. Therefore tan(22.5°) = 1/(x-1).

    Rearranging gives: x = 1/tan(22.5°) + 1

    tan(22.5°) = 0.414213562373. Therefore x = 1/0.414213562373 + 1 = 3.41421356239

     

    Now that we know x, we also know the length of the dashed line (x-1) = 2.41421356239

    From Pythagoras we can now calculate the length of the green line: √(2.41421356239² + 1²) = √6.82842712483 = 2.61312592977

     

    So the red line is 3.41421356239 units long, the green line is 2.61312592977 units long.

    The ratio between them is 2.61312592977/3.41421356239 = 0.765366864731

     

  14. #14
    JohnCC JohnCC @JohnCC

    Every one ,thank you for taking the time on this its most appreciated

  15. #15
    Tyler Durden Tyler Durden @TylerDurden

    Thanks for the trig, Xav, (I flunked that class.)

    I get pretty close to that with Pixel's simple division method done properly. So, Inkscape in my case was getting some rounding, probably.

  16. #16
    Xav Xav @Xav👹

    I also flunked maths quite badly. I took it as an A-level subject (elective exams at age 18), where I received a grade of "U" - that's U for "Unclassified", which is the lowest mark you can get. I would have got the same grade if I'd stayed at home instead of going to the exam.

    So, I got some private tuition and took the exam again the following year. At which time I received... another U.

    Then I had a go at night classes for a year. That netted me a low pass at an AS-level (which is essentially A-level standard, but half the content). That was sufficient for me to get into university, so I left maths alone for a while.

    After I'd finished university and had been working for a while, I still felt that I had unfinished business with the world of maths. More night classes. I finally passed my A-level when I was about 24.

     

    That was over 20 years ago. So the calculation you see above is the result of some vague memories and several false starts. Like I said, I spent far too long on it than I should have!