POV-Ray : Newsgroups : povray.general : Create heightmap from contour lines : Re: Create heightmap from contour lines Server Time
29 Jul 2024 04:22:21 EDT (-0400)
  Re: Create heightmap from contour lines  
From: scott
Date: 2 Jan 2013 08:28:35
Message: <50e43603$1@news.povray.org>
>> Not specifically for POV but I'm after a method to create a heightmap
>> from a contour map. All I have available is the map showing contours of
>> constant height, I have traced these and made them into arrays of points
>> but I can't figure out a way to generate a height map from this.
>
> in povray terminology, I think it would be easier to generate a mesh
> from your points.

I was hoping there would be an easier way to generate a heightmap rather 
than triangulating a mesh, and there to also be a way to keep the 
gradient continuous rather than sharp changes along the contour lines. I 
got quite close by doing a simple linear interpolation from the 2 
nearest contours, but maybe I need to do a higher order interpolation.

> Assuming that your map is a single plane projection (no special case of
> a vertical elevation to provide such fancy things as a balcony over some
> empty space), you have first to generate the tesselation (set of
> triangles) from your set of points. (not as easy as it sound, you should
> keep only the nearest points in 2D-projection plane, not the nearest in
> 3D... yet it must cover once and only once the plane (do not have
> overlapping triangles))

Yeh this is pretty much what I expected needed to be done to generate a 
mesh, but I was scared of coding the tessellation step and what the 
results might be, especially if the contour lines were quite complex (eg 
some areas very close together and others much further apart).

> Then for each vertex, you can compute the average normal at that vertex
> by averaging the normal of its contributing triangles.

There's still the problem with how to deal with areas above the highest 
contour and below the lowest contour, I would like it to somehow follow 
on the gradient the other side of the contour rather than just be flat.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.