Borders of CreateGroundFromHeightMap

I am using CreateGroundFromHeightMap to load a heightmap, the png of heightmap is a rectangle. so the mesh/ground also a rectangle. how can I get the border of “real” terrain? e.g, the borders of the heightmap image below? Thanks.
borders

Get as what? Outline coordinates? Or do you want to just draw a border around the image?

thanks for reply - I need to get the border lines (a serious of screen XYZ points).

Do you want the pixel coordinates that follow the borders? or just to crop the image as a rectangle to the border?

The former is usually done with a Hough Transform. The latter can be done by looking through the pixels or finding a cropping library.

You can do it like this:

I didn’t know you could do this with BABYLON.CreateGreasedLine(“border”, …) !

Do you think you get a border just by using the name “border”?

Then it’s:

You have to calculate the line points vectors for the border line. GRL simply draws a line between these points.

1 Like

Ahh, thank you for the clarification. I thought it was MAGIC (e.g. determine ordered border points from random collection of points). I didn’t correctly parse the algorithm you used to generate points:

1 Like

cool - looks like it’s exactly what I need - I will check this PG these days.

1 Like