Hacker News new | ask | show | jobs
by user-the-name 1640 days ago
This is missing out an important step when using marching squares to visualise fields like the original example: You should not just apply a threshold to the input data, but instead you should keep the original values around, and use them to figure out where along an edge the intersection point should be placed. This gives you contours that follow the actual isolines much more closely.

For instance, if you are plotting the line where the field crosses zero, and one point is at 9 and its neighbour at -1, you should place the intersection point at 90% of the distance from the first to the second.

2 comments

>> For instance, if you are plotting the line where the field crosses zero, and one point is at 9 and its neighbour at -1, you should place the intersection point at 90% of the distance from the first to the second.

He does mention interpolation but doesn't go into it. That can also be used to resolve the ambiguity in cases 5 and 10.

you can also use the original field to produce normals that look a lot better (for cubes)