I want to draw cassini oval parametrically with using analytical face option of cst.
I write python code below. If any one can help me ı will really appreciate.
import numpy as np
import matplotlib.pyplot as plt
def cassini_oval(x, y, x1, y1, x2, y2, a):
# Compute the Cassini oval equation
return np.sqrt((y - y1)**2 + (x - x1)**2) * np.sqrt((y - y2)**2 + (x - x2)**2) - a
# Parameters
x1 = -15.0 # x-coordinate of the first focus
y1 = 0.0 # y-coordinate of the first focus
x2 = -x1 # x-coordinate of the second focus
y2 = 0.0 # y-coordinate of the second focus
a = x1**2 # constant 'a' in the equation
# Generate points for plotting
x_range = np.linspace(-30, 30, 1000)
y_range = np.linspace(-30, 30, 1000)
X, Y = np.meshgrid(x_range, y_range)
Z = cassini_oval(X, Y, x1, y1, x2, y2, a)
# Plot Cassini oval
plt.figure()
plt.contour(X, Y, Z, levels=[0], colors='b')
plt.xlabel('x')
plt.ylabel('y')
plt.title('Cassini Oval')
plt.axis('equal')
plt.grid(True)
plt.show()