From: Nathan on 5 Apr 2010 20:29 On Apr 5, 5:10 pm, "Pr B" <pb2...(a)columbia.edu> wrote: > well with the above code i tried to go based off how you normally draw a star. > > assume the points are drawn in a sequence clockwise. then i connect the points to each other in a counterclockwise fashion. coordinate 1 to coordinate 3, coord 3 to coord 5, etc. this seems like the right way to approach the problem, but this only gives me the inner pentagon with some line overhang instead of the points of the star. any ideas? > > ImageAnalyst <imageanal...(a)mailinator.com> wrote in message <307e71f3-6284-479d-96bb-9f1b55c7a...(a)o30g2000yqb.googlegroups.com>... > > Well, yeah! If you're thinking of a regular star, you'd need 10 > > points - think about it. 5 for the tips, and 5 for the "inner" > > vertices. So no wonder you get a pentagon if you're only asking for 5 > > points! If the user generated points are produced clockwise (or counterclockwise) in some sort of circular shape, then this should draw the star for you: line([x(1) x(3)], [y(1) y(3)],'Color', 'g') line([x(3) x(5)], [y(3) y(5)],'Color', 'g') line([x(5) x(2)], [y(5) y(2)],'Color', 'g') line([x(2) x(4)], [y(2) y(4)],'Color', 'g') line([x(4) x(1)], [y(4) y(1)],'Color', 'g') Note that your original coordinate pairs were strange. The first argument of line should be the [x1,x2] value (the run), not an [x,y] pair. I hope this works for you. -Nathan |