Order coplanar points for drawing them

25
October 22, 2019, at 8:40 PM

I have an algorithm wich generates from three to six points of intersection between a plane and the edges of a cube which contains that plane. For drawing the plane (which gets drawn a polygon) OpenGL needs the vertex to be ordered as in the following picture:

If the vertex are unordered, this result may be drawn:

Edit: I found this question but i dont know how to code it in python and that's not exactly what I need

Answer 1

If points were built as intersections between a plane and the edges of a cube, then they form convex polygon.

To properly order vertices of this polygon, make projection onto some plane - or onto section plane, or onto one of OXY, OXZ, OYZ planes - just choose one not normal to section plane and make corresponding component zero.

Then choose the leftmost point in that plane as base and sort other points by polar angle relative to base.

READ ALSO
Bytes input is INCORRECT (can't convert to JSON) in Python

Bytes input is INCORRECT (can't convert to JSON) in Python

Basically, I have this API end point that will be called if you make a POST request to itThe problem is for some reason, I can't convert the bytes to JSON so I can access the data

51
Python Email message not producing an output

Python Email message not producing an output

I have to design a class Message that models an e-mail messageA message has a recipient, a sender, and a message text

41
Understanding lambda function inputs in Spark for RDDs

Understanding lambda function inputs in Spark for RDDs

I am doing a course on Spark and I am a bit confused

25
Python Count With Many Conditions

Python Count With Many Conditions

I need to count values according to "Calculation" and "Order" columnsbut i have several conditions like this:

47