Sign in to follow this  

Calculating vectorized isolines (2D and 3D)

This topic is 3724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm not sure whether this is a graphics programming problem or a math problem, so forgive me if I'm posting in the wrong forum. Anyhow, the problem is such: given a heightmap of limited resolution and a reference scale (say, an 8-bit 128x128 heightmap with value 1 equalling, say, 5 m), I need to calculate a set of isolines to mark topographic regions by elevation. In essence, an elevation map one can usually find in an atlas. However, I need the isolines to be vectorized, allowing me to use limited resolution for unlimited zoom after the initial extraction of isoregions (is that the term?) is done in isometric view and altitude lines in 3D view. I've done some snooping around on the internet, but there's virtually no information readily available on this (or maybe I'm just really bad at googling....). I'm posting my initial thoughts on how I would do this. However, this method seems kind of crude and may suffer from various problems. Plus my idea for vectorization and subsequent rasterization seems somewhat awkward: 1 - CREATING THE ELEVATION MAP (isometric view) decimate the height values, rounding all nearest height values to the isovalues (5, 10, 15m, etc) - this should give a (filled) topographic map by elevation ranges 2 - VECTORIZING THE ISOLINES (isometric view) take each height range individually (as a heightmap) and do a left-to-right scan on each line. If a set height value (a "non-null" value, so to say) is encountered, follow the perimeter of the filled shape, creating a new vector for every point (pixel) where the direction of the scan changes. Scanning is done in clockwise order around the current pixel (to avoid back-tracking) until the initial pixel is encountered. Note that this seems prone to error IMO as cases such as this can cause awkwardly linked areas and possibly even areas with endless perimeter:
 XXX         XXX
XXXXXXXXXXXXXXXXX
 XXX         XXX
Each X represents a pixel on this elevation level. 3 - DRAWING THE ISOLINES (isometric view) unless the resulting shapes have no overlapping pixels (pixels that are used more than once in the vector set defining the contour), interpolation can't be reliably used to represent the contour. 4 - USING ISOLINES ON 3D SURFACES I have no solid idea how to quickly calculate the actual perimeter line at a specific elevation for a 3D dataset (such as a circle around a hill at a specific elevation). Using the above method will fail miserably at that - in fact it's only good for an isometric view of the surface. The only truly reliable way that would be free of artifacts (that I can think of) is by using clip planes for each elevation range. This will not, however, allow for a fast drawing of elevation lines. So - in conclusion, I don't have a solid idea how this should be done - so if anyone knows any resources or has suggestions, I'd really appreciate those. I posted my ideas to show that I have given this some thought and am not asking blindly. Cheers

Share this post


Link to post
Share on other sites
I think you might want to look at level-set methods, and/or signed-distance fields -- both involve taking a scalar grid and identifying the contour which has a particular interpolated value.

I don't have any experience with either sadly, but google/wikipedia should help.

Share this post


Link to post
Share on other sites
The marching squares algorithm allows you to extract an edge from an object. For better results, do not decimate your set and use linear interpolation instead. This will also result in non-overlapping level sets, so you can render them directly without additional effort.

Share this post


Link to post
Share on other sites

This topic is 3724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this