earcut.hpp | Fast, header-only polygon triangulation | Graphics library
kandi X-RAY | earcut.hpp Summary
kandi X-RAY | earcut.hpp Summary
Fast, header-only polygon triangulation
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of earcut.hpp
earcut.hpp Key Features
earcut.hpp Examples and Code Snippets
Community Discussions
Trending Discussions on earcut.hpp
QUESTION
I’m trying to convert a 2D map created in my map editor to a 3D plotting with OpenGL. This is my map generated in my map editor:
Those vertices are relative to my Cartesian origin world coordinate (top up of the picture) and I’m applying this formula to convert it to an OpenGL object coordinate:
World size: 800x600
...ANSWER
Answered 2018-Jun-11 at 13:46It's hard to know for sure, but it seems your object has only thwo faces rendered because you didn't add the other faces to the index.
Because you have your vertices, but you also need to tell have a triangles for the sides. If they are triangles you should end up with 16 triangles to draw. If you don't use an index, you need to duplicate your vertices, for each triangle and end up with 48 vertices to draw.
As to get the earing algorithm to work in 3D, if you know for sure that your polygon has all it's point in the same plan, you can take 3 vertices, deduce it's plan, and create a transformation matrix to bring all these points to (x,y,0) which is like 2D coordinates.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install earcut.hpp
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page