Signed distance function about a circular arc

78 Views Asked by At

I have a rectangle of 1.3 mm * 0.2 mm, take the origin to the lower left corner of the rectangle. Say, I have a circular arc defined by the (0.3,0),(0.2732,0.1) & (0.3,0.2). It has a radius of 0.2 mm & center of the circular arc is (0.4732,0.1)

Now, imagine that the circular arc has a thickness of $\epsilon = 0.0002$

I want to define a signed distance function such that $\phi$ is 0 to the left of the left interface (or the arc), smoothly varies between 0 and 1 within the interface, and 1 beyond the right interface.

This is what I tried:

$d(x,y) = \sqrt{(x-x_{center})^2 + (y-y_{center})^2} - radius$

$\phi = \frac{1}{1+\exp(\frac{d}{\epsilon})}$

I am getting the following variation:

<span class=$\phi$ as per above Equation" />

However, I want this to be the result

Expected result for <span class=$\phi$" />

How do I approach this differently to get the target function ?

Code for the plot(s):

import numpy as np

def level_set_function(x, y, x_center, y_center,radius,epsilon):
    d = np.sqrt((x-x_center)**2 + (y-y_center)**2) - radius
    phi = 1/(1+np.exp(d/epsilon))
    
    return phi

# Define constants
epsilon = 0.0002
x_center = 0.4732
y_center = 0.1
radius = 0.2

x = np.linspace(0, 1.3, 100)


y = np.ones_like(x) * y_center

phi = level_set_function(x, y, x_center, y_center,radius, epsilon)

# phi[x>0.4] = 1

import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(8, 4))

ax.plot(x, phi)
ax.set_xlabel('x ')
ax.set_ylabel('ϕ')
ax.set_title('ϕ along y=0.1')
plt.show()