1
\$\begingroup\$

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

\$\endgroup\$
0

1 Answer 1

2
\$\begingroup\$

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.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged .