From: Pr B on
i'm trying to draw a green star on a picture imported to matlab named 'file'. i'm taking user defined coordinates and trying to connect the dots, but the output is a weird looking pentagon instead of a star. how do i change the code below to plot a star given 5 random inputs of coordinates?

imshow(file)
[x y] = ginput(5);

line([x(1) y(1)], [x(3) y(3)],'Color', 'g')
line([x(3) y(3)], [x(5) y(5)],'Color', 'g')
line([x(5) y(5)], [x(2) y(2)],'Color', 'g')
line([x(2) y(2)], [x(4) y(4)],'Color', 'g')
line([x(4) y(4)], [x(1) y(1)],'Color', 'g')

thanks!
From: Pr B on
anyone? anything?
From: us on
"Pr B" <pb2297(a)columbia.edu> wrote in message <hpda82$lps$1(a)fred.mathworks.com>...
> anyone? anything?

well... guess what:
it most certainly depends on the sequence those points are entered...
hence, you may have to re-consider your assumption...

us
From: ImageAnalyst on
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!
From: Pr B on
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 <imageanalyst(a)mailinator.com> wrote in message <307e71f3-6284-479d-96bb-9f1b55c7a800(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!