[Python] 3D vertices to faces - howto? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

[Python] 3D vertices to faces - howto?

Ok, so I have finished part of my GeoProject PL task and built a dictionary of Polish cities, their population and geolocation (longitude and latitude). I am about to run it yet to find the average elevation of each of the cities and add it to the dictionary. So let's say I have a set of 3D coordinates for each city point and I want to produce faces out of them to pass the whole surface to OpenGL. The problem is - with such a big network, how to link them, which with which? Is there an algorithm for that?

12th Feb 2017, 9:16 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
3 Answers
+ 8
that's exactly what OpenGL is designed for. It takes in lists of 3D points and renders polygons (usually triangles) in the OpenGL environment. Instead of trying to figure out how to connect the vertices, why don't you try generating a large plane, a terrain of sorts. the position of of any point on the terrain is determined by the 'city point'
13th Feb 2017, 11:11 AM
Aidan Haddon-Wright
Aidan Haddon-Wright - avatar
+ 4
The problem is I want to generate a plane based on exactly those coordinates. I am just looking for a way to tell OpenGL how to connect those points into triangles. I hope to get their elevation, too, so the terrain will already be quasi-realistic. When I get a decent list of villages and rural locations, I'll get an even more perfect image :)
13th Feb 2017, 10:30 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 4
I finished the 3D labyrinth mini-project, so now when I understand how to play it, I'm off to GeoProject now :) https://www.instagram.com/p/BQszVwBhoYT/
21st Feb 2017, 6:55 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar