Trying to use GraphicsContext method Public void fill and strokepolygon in order to draw a regular polygon

I created a draw method in order to draw a regular hexagon using the fillPolygon and strokePolygon methods in java.Currently I am stuck trying to figure out how to get the six x and y coordinates needed to draw the regular polygon. Would anyone be able to help me? Here is the structure of fill polygon:

Public void fillPolygon(double[] xPoints,
                        double[] yPoints,
                        int nPoints)

Fills a polygon with the given points using the currently set fill paint. A null value for any of the arrays will be ignored and nothing will be drawn. This method will be affected by any of the global common, fill, or Fill Rule attributes as specified in the Rendering Attributes Table.

Parameters: xPoints - array containing the x coordinates of the polygon's points or null. yPoints - array containing the y coordinates of the polygon's points or null. nPoints - the number of points that make the polygon.



from Recent Questions - Stack Overflow https://ift.tt/33WPYH3
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)