SFML community forums
General => General discussions => Topic started by: Dejan Geci on July 23, 2014, 08:12:15 pm
-
I was looking around the https://github.com/SFML/SFML.Net/pull/41 and it got me thinking...
ConvexShape class is not named properly (http://www.mathsisfun.com/definitions/convex.html). It should be named PolygonShape, since we can manually define points that create angles > 180°. Right?
-
No Convexe is alright.
According to the tutorial:
Indeed, SFML is unable to draw concave shapes; if you need to draw a concave shape, you'll have to split it into multiple convex polygons (if possible).
For concave shape Thor library has a class to handle this:
http://www.bromeon.ch/libraries/thor/v2.0/doc/classthor_1_1_concave_shape.html
-
It's great to start a public discussion about a class without reading its documentation or tutorials first...
It is important to keep in mind that a convex shape must always be... convex, otherwise it may not be drawn correctly.
-
Thanks Chaore, you are right. I guess I'm used to reading the source code as documentation, and I didn't see any constraints in the code.
-
I guess I'm used to reading the source code as documentation
You must be working a lot with very badly documented software :P
-
I didn't see any constraints in the code.
There isn't any constraints imposed by the SFML library, the constraint comes from how OpenGL is able to handle primitive types.
-
It's great to start a public discussion about a class without reading its documentation or tutorials first...
It is important to keep in mind that a convex shape must always be... convex, otherwise it may not be drawn correctly.
In the tutorial it says: Officially, sf::ConvexShape can only create convex shapes. But in fact, its requirements are a little more relaxed. In fact, the only technical constraint that your shape must follow, is that if you draw a line from its center of gravity to any of its point, you mustn't cross an edge. With this relaxed definition, you can for example draw stars.
-
It's more an implementation detail. If one day I change the way convex shapes are drawn, this may not be true anymore. I should probably remove this from the tutorial.