how to get polygon borders by 2d vector

Started by
4 comments, last by alvaro 10 months, 1 week ago

i have cave generated with help of perlin noise. I have 2d vector with marked borders so I need to split them into polygons to handle collisions with them (i use qt, c++)

Advertisement

Maybe it's just me, but I have no idea what you are asking, or if you are even asking a question.

Just guessing here, but it seems like you want to generate a representation of your Perlin noise caves that you can use for collision detection? If the caves are 2D, you could use the marching squares algorithm to convert it to a series of lines representing the cave walls. In 3D, use the dual contouring or marching cubes algorithm to convert the noise field to a triangle mesh. Then you can use the mesh or lines to do collision detection using standard approaches.

Marching Squares:

https://github.com/sjhalayka/Marching-Squares

If the cave is defined as the points where some noise function is positive, couldn't you just evaluate the function to detect collisions? There are reasons why that might not work, but it's hard to tell without the OP being 20 times more clear on what the question is.

This topic is closed to new replies.

Advertisement