Welcome on MasterOf13FPS! MasterOf13FPS

Register today or sign up if you are already a member and never miss any cool content again :)

Ocatgon

MasterOf13FPS

Administrator
Staff member
Administrator
MasterOf13FPS
Joined
Jul 11, 2020
Messages
0
Reaction score
25
Points
0
Hey ich hätte mal eine frage,hätte jemand den Code von einem Ocatgon/8 Eck für mich?
 
Last edited by a moderator:
1. Ein 8. eck ist kein pentagon xD
Code:
    public static void polygon(double radius, int sides) {
       GL11.glBegin(GL11.GL_LINE_STRIP);
       for (int i = 0; i < sides; i++) {
           double angle = i * 2 * Math.PI / sides;
           GL11.glVertex2d(400 + radius * Math.cos(angle), 300 + radius * Math.sin(angle));
       }
       GL11.glEnd();
   }

polygon(100, 8);
 
1. Ein 8. eck ist kein pentagon xD
Code:
    public static void polygon(double radius, int sides) {
       GL11.glBegin(GL11.GL_LINE_STRIP);
       for (int i = 0; i < sides; i++) {
           double angle = i * 2 * Math.PI / sides;
           GL11.glVertex2d(400 + radius * Math.cos(angle), 300 + radius * Math.sin(angle));
       }
       GL11.glEnd();
   }

polygon(100, 8);
1. Danke
2. Hatte mich vertan mit dem Begriff, wollte nach einem Ocatgon(Achteck fragen und nicht nach einem fünfeck/pentagon xd
 
Es heißt Pentagram/Octagram. Das Pentagon ist das schicke Gebäude hier

1200px-The_Pentagon_January_2008.jpg
 
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top