Loading [MathJax]/extensions/tex2jax.js
FuncViz examples
Generalized bitree/quadtree/octree library
All Files Functions
implicit_curve_2d.cpp File Reference

Sampleing on a 2D grid to extract an implicit curve. More...

Go to the source code of this file.

Detailed Description

Sampleing on a 2D grid to extract an implicit curve.

Author
Mitch Richling http://www.mitchr.me/
Date
2024-07-13
Standards
C++23
Details


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:

  • Using cell_cross_range_level() to find cells that cross a particular level (zero in this case)
  • Using cell_cross_sdf() instead – which generally works just like cell_cross_range_level() with a level of zero.

Today we extract the curve with Paraview, but I hope to extend MR_rt_to_cc to extract level sets in the future:

  • Extract "standard" midpoint level sets (TBD)
  • Solve for accurate edge/function level intersections, and construct high quality level sets. (TBD)

Definition in file implicit_curve_2d.cpp.