Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I am trying to render a plane with nodes.

FYI : Nodes know what other nodes it is being attached to.

I can think of a way to render them as long as they are aligned in a circular pattern; have a center and draw triangles. However I want the shape to be not necessarily circular.

I have a picture below to enhance my description. Attempting to draw such a vertices with my previously stated method will result into an undesired shape, like the third picture.

enter image description here

share|improve this question

marked as duplicate by msell, Byte56, Tetrad Jun 16 '13 at 13:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 2 down vote accepted

enter image description here

If you take the points A,B,C and derive the vectors AB and BC you will find that:

atan2(AB.x,AB.y) - atan2(BC.x,BC.y) < 0

Conversely if you take the points B,C,D and derive the vectors BC and CD you will find that:

atan2(BC.x,BC.y) - atan2(CD.x,CD.y) > 0

By using this test you can identify which points define concave or convex angles.

share|improve this answer

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