Sampleing on a 2D grid to extract an implicit curve. More...
Go to the source code of this file.
Sampleing on a 2D grid to extract an implicit curve.
Copyright (c) 2024, Mitchell Jay Richling http://www.mitchr.me/ All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
For many of us our first exposure to an implicit curve was the unit circle in high school algebra, \(x^2+y^2=1\), where we were ask to graph \(y\) with respect to \(x\) only to discover that \(y\) didn't appear to be a function of \(x\) because \(y\) had TWO values for some values of \(x\)! But we soon discovered that a great many interesting curves could be defined this way, and that we could represent them all by thinking of the equations as a functions of two variables and the curves as sets of zeros. That is to say, we can always write an implicit equation in two variables in the form \(F(x,y)=0\), and think of the implicit curve as the set of roots, or zeros, of the function \(F\). We can then generalize this idea to "level sets" as solutions to \(F(x,y)=L\) – i.e. the set of points where the function is equal to some "level" \(L\).
Many visualization tools can extract a "level set" from a mesh. For 2D meshes (surfaces), the level sets are frequently 1D sets (curves). The trick to obtaining high quality results is to make sure the triangulation has a high enough resolution. Of course we could simply sample the 2D grid uniformly with a very fine mesh. A better way is to detect where the curve is, and to sample at higher resolution near the curve.
Currently we demonstrate a couple ways to refine the mesh near the curve:
Today we extract the curve with Paraview, but I hope to extend MR_rt_to_cc to extract level sets in the future:
Definition in file implicit_curve_2d.cpp.