Closed akleb closed 11 months ago
When writing some unit tests for pyFoil I found that there seems to be a problem with the pySpline.Curve.projectCurve finding a proper intersection.
pySpline.Curve.projectCurve
See Code below list
pySpline.Curve.splitCurve
import pyspline as pySpline import numpy as np import matplotlib.pyplot as plt coords = np.array([[1., 0.5], [0., 0.], [1., -0.5]]) vert_ray_coords = np.array([[0.05, 0.5], [0.05, -0.5]]) surf = pySpline.Curve(X=coords, k=3) vert_ray = pySpline.Curve(X=vert_ray_coords, k=2) top, bottom = surf.splitCurve(0.5) s_top, t_top, d_top = top.projectCurve(vert_ray, eps=1e-16) s_bottom, t_bottom, d_bottom = bottom.projectCurve(vert_ray, eps=1e-16) print(top.getValue(s_top)) print(vert_ray.getValue(t_top)) print(d_top) print(d_bottom) top_intersect = top.getValue(s_top) top_correct = top.getValue(1-s_bottom) bottom_intersect = bottom.getValue(s_bottom) s = np.linspace(0, 1, 200) s2 = np.linspace(0, 1, 15) fig = plt.[mwe.pdf](https://github.com/mdolab/pyspline/files/6672752/mwe.pdf)() plt.plot(surf.getValue(s)[:, 0], surf.getValue(s)[:, 1], label='total') plt.plot(top.getValue(s)[:, 0], top.getValue(s)[:, 1], '--', label='top') plt.plot(bottom.getValue(s)[:, 0], bottom.getValue(s)[:, 1], '--', label='bottom') plt.plot(vert_ray.getValue(s)[:, 0], vert_ray.getValue(s)[:, 1], label='vert_ray') plt.plot(top_intersect[0], top_intersect[1], 'o', label='top_intersect') plt.plot(top_correct[0], top_correct[1], 'o', label='top_correct') plt.plot(bottom_intersect[0], bottom_intersect[1], 'o', label='bottom_intersect') plt.legend() fig.savefig("mwe.pdf", bbox_inches='tight')
which produces
Check the figure, top_intersect is not at the intersection
top_intersect
Check the figure, top_correct is where top_intersect should be
top_correct
Description
When writing some unit tests for pyFoil I found that there seems to be a problem with the
pySpline.Curve.projectCurve
finding a proper intersection.Steps to reproduce issue
See Code below list
pySpline.Curve.splitCurve
to split the curve into its two symmetric halvespySpline.Curve.projectCurve
to determine the intersection of the two halveswhich produces
Current behavior
Check the figure,
top_intersect
is not at the intersectionExpected behavior
Check the figure,
top_correct
is wheretop_intersect
should be