# How do I plot a distance map in $R^2$ to a curve given in form $y=f(x)$?

As in the title, I'd like to display image using DensityPlot representing distance to a given curve, e.g., $y=x^2$.

I find it difficult to derive distance function to from a an arbitrary point to a curve (even for such simple quadratic function).

Is it possible to tell Mathematica to find numerically the distance to a given function from every $x,\,y$ location?

• Not the easiest thing to do. Could use "fast marching" to get points of constant distance from the given curve, and color them accordingly. A notebook with some code can be found here. – Daniel Lichtblau Aug 14 '18 at 20:42
• Interesting approach, over kill tho :) thanks anyway! – Anonymous Aug 14 '18 at 20:47

rd = RegionDistance @ ParametricRegion[{x, x^2}, {{x, 0, 1}, {y, 0, 1}}];