1
$\begingroup$

So I just saw a video on Marching Squares by reducible, and I thought of a straightforward optimisation, but I couldn't find anything about it online. Basically here's the idea -
Start with a fairly large grid size, sample the points, this forms a very rough image, but what we do now is only for the cells which the contour passes through, we further divide them into more cells recursively (make the grid smaller but only inside those cells) and sample more points until a set recursion depth. For example turning a single cell into 4 different cells only require you to sample an additional 5 points This should give us a much sharper image without having to sample too many points, most of which give us no information.

This came pretty naturally to me so I refuse to believe that no one else has thought of this, so is there any particular reason why I wasn't able to find anything about it? (Maybe it has some fault I don't see, or maybe there's a better optimisation, or maybe it just has a different name I don't know)

$\endgroup$
2
  • 1
    $\begingroup$ Your idea is correct, it is a 2D generalization of dichotomic root search and is related to quad-trees. As explained by Kevin, it can miss complete level curves. I seem to remind a paper giving a method with guaranteed solutions if you can supply bounds on the gradient of the function in a given domain (or was it even 3D, marching cubes and oct-trees ?). $\endgroup$
    – user1703
    Commented May 6, 2023 at 7:35
  • $\begingroup$ See Quadtree Algorithms for Contouring Functions of Two Variables by K. G. Suffern $\endgroup$
    – lhf
    Commented Oct 25 at 16:49

1 Answer 1

1
$\begingroup$

If the contour exists in a loop entirely inside one of your coarse cells — or has some thin protrusion that passes between the corner points, at least — then it will be missed entirely; it will look just like empty space in that cell. This puts a limit on how large your initial grid can be: it must be fine enough that at least one point lies within and one point outside the contour.

Now, if you know that there must be at least one loop within a region then you can sample finer until you find it. But then you've given up on “plot any implicit curve”, because you need to know where to look.

This doesn't mean there isn't any point in multiple resolutions. Once a grid of a certain resolution has found the features of the shape (as many as are coarse enough for it to notice), you can sample more finely to get more smoothly curved lines/surfaces.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.