Message Boards Message Boards

0
|
6434 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to Draw an irregular shape

Posted 9 years ago

Hello,

Can someone guide me that how can i draw an irregular polygon in Mathematica.

thanks

POSTED BY: Kashif Nazar
3 Replies

Define a List of points and then apply Polygon to them. You can define styles for the face and edge of the polygon with FaceForm and EdgeForm directives.

points = {{0, 0}, {1, 0}, {1, 1}, {1/2, 1/2}, {0, 1}};
Graphics[{FaceForm[Orange], EdgeForm[Directive[Thick, Black]], 
  Polygon@points},
 ImageSize -> 200]

enter image description here

You can also click off a series of points using the cross hairs on the GraphicsTools palette from the menu Graphics/Drawing Tools item and then paste them into your notebook.

enter image description here

POSTED BY: Simon Cadrin

Type

In[5]:= Graphics[Polygon[AnglePath[Transpose[{RandomReal[1, 17], RandomReal[2 \[Pi], 17]}]]]]

to produce - in most cases - a self-intersecting polygon (with 17 corners in that case) ...

self-intersecting

Exercise: Change the above line to produce for sure a non-selfintersecting polygon!

POSTED BY: Udo Krause
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract