Tag Archives: polygon

Draw a star with a given number of points in C#

My goal here was to draw a “normal” star where the interior concave angles were located at intersections of lines connecting the exterior convex points. This turned out to be a more interesting problem than I expected. There’s only one … Continue reading

Posted in algorithms, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , | 2 Comments

Draw a non-intersecting star in C#

The following NonIntersectingStarPoints method generates the points needed to draw a non-intersecting star and returns them in an array. // Return PointFs to define a non-intersecting star. private PointF[] NonIntersectingStarPoints( int num_points, Rectangle bounds) { // Make room for the … Continue reading

Posted in drawing, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , | Leave a comment

Draw a star in C#

The following StarPoints method generates the points needed to draw a star and returns them in an array. // Return PointFs to define a star. private PointF[] StarPoints(int num_points, Rectangle bounds) { // Make room for the points. PointF[] pts … Continue reading

Posted in drawing, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , | 2 Comments

Perform geometric operations on polygons in C#

This example contains a Polygon class that perform several useful geometric operations for polygons. The following list describes the key methods provided by the class. Click the links to see posts that describe the methods in greater detail. PolygonIsConvex – … Continue reading

Posted in algorithms, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment

Find a minimal bounding rectangle for a polygon in C#

This program assumes that its Points array contains the points in a convex polygon in counterclockwise order. If you have some other group of points, first find their convex hull and then orient the resulting polygon counterclockwise. See these related … Continue reading

Posted in algorithms, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , | 6 Comments