#Help with Polygon Creation (Based on inputs from button panel)

17 messages · Page 1 of 1 (latest)

buoyant ocean
#

So I am trying to get inputs from my code, which then creates a polygon with Input for sides, lengh,ID and color. I have created the main part in which the input is gained From a panel button. The ID system might work, however I couldnot check if it works because of the main problem, actually drawing the polygon.

For Some reason I cannot seem to create an actual polygon at all, let alone based on the inputs. So im just looking for a bit of help with this. The drawn polygon should look like the figure below where I have labelled how
each of the attributes relate to it.

I also use intelliJ for my coding.
attached is code files as there is more files in use

hearty sailBOT
#

This post has been reserved for your question.

Hey @buoyant ocean! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

buoyant ocean
dark depot
#

Suppose you have n sides. every inner angle is 2pi / n radians.
So something like this should work:

double innerAngle = 2* Math.PI / n;
for (int i = 0; i < n; i++) {
  double x = cenX + Math.cos(i * innerAngle) * radius;
  double y = cenY + Math.sin(i * innerAngle) * radius;
}
#

the x and y coordinates are the vertices. Just draw lines between them.

buoyant ocean
hearty sailBOT
# buoyant ocean thank you i will try this tonight

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

buoyant ocean
#

dunno yet mate

buoyant ocean
#

@dark depot I tried to add it but i had no luck, can i send the code here for you to have a look and go through it?

hearty sailBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.

buoyant ocean
dark depot
#

The one that generates and draws the polygon, please ;)

buoyant ocean
#

its a zip folder containing the project with that file inside, unless u want it seperatly

dark depot