Skip navigation
clon2
Currently Being Moderated

Polygons: specifying side lengths

Feb 12, 2013 1:57 PM

Tags: #cs5 #length #polygon #side

I am working on a project using polygons—a pentagon, specifically—and I want all of the sides to be 2 in. The radius doesn't matter to me. I can't figure out if there is any way to do this. I am using CS5.

 
Replies
  • Currently Being Moderated
    Feb 12, 2013 2:09 PM   in reply to clon2

    What happens if you enter "2 in" in the radius field?

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 12, 2013 2:16 PM   in reply to clon2

    I think I would do it like this:

    Picture 1.png

    Draw a pentagon in approximately the right size.

    Draw a rectangle with width 2".

    Snap guides to the sides of the rectangle.

    Snap a (bottom) corner of the pentagon to a guide.

    With the Scale tool (S) click on the point where the guide intersects the upper side of the pentagon (centre of red ring).

    Hold down Shift and drag on the opposite lower corner of the pentagon until it snaps to the (right hand) guide.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 12, 2013 2:18 PM   in reply to clon2

    Only with a hexagon are the radii the same length as the sides.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 12, 2013 2:25 PM   in reply to clon2

    Maybe there’s a formula for finding out the relationship between radius and side length of regular polygons.

    Not my strong point but Jacob is quite good at that sort of thing.

    See if he clocks in :-)

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 12, 2013 3:11 PM   in reply to clon2

    Clocking in, Steve.

     

    clon, you may use a radius of 1.7013 to get a side length of 2. The ratio is √(2/(5-√5)) for a pentagon.

     

    But drawing is more fun, and only limited by the accuracy of Illy herself.

     

    There are at least two (rather silly) ways of actually drawing the pentagon starting with one side.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 12, 2013 3:11 PM   in reply to Jacob Bugge

    There is at least one (rather silly) way of actually drawing the pentagon starting with one side.

    Yes Jacob, I thought of that one. Silly isn’t it?!

     

    Good formula. Thought you might have one up your sleeve.

    Makes an interesting graph that goes from 2 for a straight line, through 1 for six sides to 0 for an infinite number of sides.

    Illie says she can’t draw a polygon with fewer than 3 sides but I reckon that a polygon with less than 3 sides must be a straight line.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 12, 2013 3:20 PM   in reply to Steve Fairbairn

    Indeed, Steve, both of them.

     

    I reckon that a polygon with less than 3 sides must be a straight line.

     

    Not quite. A digon is a closed curve. Whatever Illy says, she can, with the Pen Tool: One click at either end and then one click at the first end.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 12, 2013 3:15 PM   in reply to Jacob Bugge
    But drawing is more fun....

     

    Scripting it is more fun

     

    if (app.documents.length>0) polygonBySide ();
    else alert ("no document to draw the polygon");
     
    function polygonBySide() {
        var title = "Create Polygon by Side";
        var sideLen = Number(prompt ("Enter Side Length in Points", 20, title));
        var numberOfSides = Number(prompt ("Enter number of sides", 5, title));
     
        //var s = 2*r*Math.sin(Math.PI/n); // side length = 2*radius*sin(180 deg/number of sides)
        var radius = sideLen/(2*Math.sin(Math.PI/numberOfSides));
     
        var idoc = app.activeDocument;
        var ctr = idoc.activeView.centerPoint;
     
        var ipoly = idoc.pathItems.polygon (ctr[0], ctr[1], radius, numberOfSides);
    }
    
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 12, 2013 3:26 PM   in reply to CarlosCanto

    Indeed, Carlos, but not only limited by the accuracy of Illy herself.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 12, 2013 6:40 PM   in reply to Steve Fairbairn

    For any polygon with side of length n the interior angle between sides is (n-2) × 180°/ n.

     

    For a pentagon n=5, so the interior angle is 

    (5-2) × 180°/5.                

    5-2=3,   180°/ 5 = 36°,   3 × 36° = 108°

     

    Draw a line segment of two inches.

     

    With the rotate tool OPT/ALT-click the left anchor point, enter 108 for the angle, click Copy. Repeat until all five sides are drawn. Join at overlapping anchor points.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 13, 2013 2:29 AM   in reply to Steve Fairbairn

    Correction to mine: Post #8 should read “... to 0.5 for an infinite number of sides.”, the radius of a regular polygon with an infinite number of sides (a circle) being half of its diameter.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 13, 2013 2:31 AM   in reply to tromboniator

    Hi Peter. Isn’t that Jacob’s silly way (before he edited to two of them)?

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 13, 2013 3:17 AM   in reply to Steve Fairbairn

    I don't know. I must have missed it. Where?

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 13, 2013 3:30 AM   in reply to tromboniator

    See post #7 which I quoted in post #8.

    Then at some point Jacob edited his to “at least two (rather silly) ways”.

     

    I first imagined drawing one side of a given length, rotate-copying it by a given number of degrees, snapping and joining endpoints etc. etc.

    Which would be a pretty daft way of doing things given that Illie has a (not-very-good) Polygon tool.

    The method sends one back to Illie88 in the eighties before she had one at all.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 13, 2013 3:54 AM   in reply to Steve Fairbairn

    Steve, Peter, the second silly way I thought of (which made me edit from one to two, sorry Steve, I was unable to go back because the edit and your reply crossed each other), was to rotate a copy round the centre by 72 degrees then repeat twice, then drag each by end points to snap, then join.

     

    A third, just about as silly, way is with the Transform pallete/panel.

     

    Edit: Hi Peter, hi Steve. I seem to be too slow today (too).

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 13, 2013 3:57 AM   in reply to Steve Fairbairn

    So I'm the silly one. I was thinking that the method would be dead accurate (avoiding √2, √5, trig functions, etc.) for all values of n, which it is for n=1…n=6, but missing the fact that n=7 yields an irrational number, therefore an approximation. Might as well snap to guides. Or go to bed.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 13, 2013 4:44 AM   in reply to tromboniator

    I am unconvinced about your silliness as compared to ours, Peter.

     

    You can use 360/N for centre rotation or 180 - (360/N) for end rotation and get at least as accurate polygons by drawing as by guide snapping.

     

    Edit: Probably still too slow, or maybe time is just flying today.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 17, 2013 11:10 AM   in reply to clon2

    clon,

     

    That closely corresponds to the way described in post #17, and as mentioned it is only necessary to create four of them, the fifth being created by joining.

     

    Maybe we should avoid repeating the adjective describing these ways.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 17, 2013 11:29 AM   in reply to clon2

    clon2 wrote:

     

    I actually discovered that the best most accurate way of creating a perfect polygon with defined sides is to create it manually with the line tool.

     

    hmm....this makes it seem you did not try the script in post # 10

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 18, 2013 4:52 AM   in reply to CarlosCanto

    i tried it! it made my day better

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points