6
$\begingroup$

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.

$\endgroup$
3
$\begingroup$

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

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.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks for the comment, updated my post. This is my first post on stackoverflow so I appreciate all constructive criticism haha $\endgroup$ – Chara Feb 10 '16 at 15:26
  • 1
    $\begingroup$ This is a significant improvement! Note that Stack Overflow and Computer Graphics 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 Computer Graphics Chat. $\endgroup$ – trichoplax Feb 10 '16 at 15:37
2
$\begingroup$

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.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.