<p>Try starting at the origin, then dividing 360 degrees by n to find some useful angles for the points of your star.
I hope this drawing will help you to find a solution.
<a href="https://i.sstatic.net/CCGsh.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/CCGsh.png" alt="enter image description here"></a></p>

<p>Now that you have the angle theta, and the values of alpha and x are chosen by you, you have the tools to calculate all required vertices to make the star using trigonometry.</p>

CC BY-SA 3.0
2016-02-10T15:26:21.163Z
Thanks for the comment, updated my post. This is my first post on stackoverflow so I appreciate all constructive criticism haha
Chara
CC BY-SA 3.0
2016-02-10T15:37:30.790Z
This is a significant improvement! Note that [so] and [computergraphics.se] are different sites. They are both part of the Stack Exchange network but they have different rules about what is on topic. If there's any confusion feel free to drop in to [chat].
trichoplax is on Codidact now
CC BY-SA 3.0
2016-02-09T21:44:18.417Z
2016-02-10T15:22:58.323Z
2016-02-10T15:22:58.323Z
Chara
<p>A simple way would be to think about how you can decompose your star into triangles.</p>

<p>And then just draw these triangles. Not as a triangle-fan since those may be a bit strange to use.</p>

<p>Since triangles are one of the most basic and standard ways to draw all kinds of meshes and shapes (every polygon can be triangulated as far as I know), I suggest du don't use the polygon draw as a beginner. Begin with the basic stuff everyone uses.</p>

CC BY-SA 3.0
2016-02-09T19:57:51.373Z
2016-02-09T19:57:51.373Z
Dragonseel
<p>Completely stuck on how to do this. Yes, it is a homework problem, but its the first we've had in the class so not too familiar with graphics. Also, seeing as its homework, please don't just give the answer, just some pointers in the right direction would be great.</p>

<p>I've tried to do it as a triangle fan, and as a polygon but that just ends up in really weird shapes.</p>

<opengl><c++><mathematics><computational-geometry>
OpenGL with SFML, create an n-pointed star?
user2645
# OpenGL with SFML, create an n-pointed star?

(Asked by: username_0 on 2016-02-09)

Completely stuck on how to do this. Yes, it is a homework problem, but its the first we've had in the class so not too familiar with graphics. Also, seeing as its homework, please don't just give the answer, just some pointers in the right direction would be great.

I've tried to do it as a triangle fan, and as a polygon but that just ends up in really weird shapes.

**Tags:** opengl, c++, mathematics, computational-geometry


---

## 2 answers

### Answer by username_1 on 2016-02-09. Score: 3

Try starting at the origin, then dividing 360 degrees by n to find some useful angles for the points of your star.
I hope this drawing will help you to find a solution.
[![enter image description here](https://i.sstatic.net/CCGsh.png)](https://i.sstatic.net/CCGsh.png)

Now that you have the angle theta, and the values of alpha and x are chosen by you, you have the tools to calculate all required vertices to make the star using trigonometry.

> **Comments:**
> **username_1**: Thanks for the comment, updated my post. This is my first post on stackoverflow so I appreciate all constructive criticism haha  
> **username_2**: This is a significant improvement! Note that [so] and [computergraphics.se] are different sites. They are both part of the Stack Exchange network but they have different rules about what is on topic. If there's any confusion feel free to drop in to [chat].  

---

### Answer by username_3 on 2016-02-09. Score: 2

A simple way would be to think about how you can decompose your star into triangles.

And then just draw these triangles. Not as a triangle-fan since those may be a bit strange to use.

Since triangles are one of the most basic and standard ways to draw all kinds of meshes and shapes (every polygon can be triangulated as far as I know), I suggest du don't use the polygon draw as a beginner. Begin with the basic stuff everyone uses.


---

