How can I create custom polygon?

Hi, everyone! I’m sry it is difficult to say properly. I’m chezh.

Trying to create 3d model of countries which is bound to sphere. I’ve read a lot of doc and watch lots of examples, but i still cannot catch the better way to do it.

I use bufferGeometry and I thought it would be easy, but I can’t even build a geometry of my polygons. If do it with THREE.Points() i get smth that is similar to polygon I need, but if I use THREE.Plane or .Line, i get lot of triangles. What am i doing wrong? Or how can I connect dots, if using .Point()

Hello,
it would be helpful if you post a sketch showing what you want to achieve. :slightly_smiling_face:

1 Like

Of course, here is it
https://codepen.io/bersonazh/pen/JjWRLqR

While I was doing a sketch, i don’t undestand how, but it now draws correct lines. So pls can you say what should I use, to fill it with color?

I thought about shape, but I need it to be conversed to sphere coords

To get a colored surface you need a mesh. You can specify a point (or several for more complicated borders) inside your line and then specify the indices.

An example where something similar happens is in the collection
Collection of examples from discourse.threejs.org

2018 SwingingPolygon

Remove wireframe.

Note that instead of .addAttribute now .setAttribute is to be used.

Instead of .setDynamic( true ) now the usage is to be indicated.

1 Like

Could you please tell where can I find information about for what these indices are and how to compute them?

There are indexed and non indexed BufferGeometry.

Two simple examples can be found
in the beginner’s example on * discourse.threejs.hofk.de

// … step 02: buildt custom geometries …

1 Like

Can someone upload a code example on how to draw this polygon?
It should be a few lines of code.