I have a collection of sets of points, each set defining the segment of a (nice) curve on the unit sphere $S^2 \subset \mathbb{R}^3$. The points are computed numerically. I now want to compute the intersection of the curve segments and I would like to get all solutions if two curve segments intersect more than once. The following Mathematica script works but only gives me one solution:
f1 = BSplineFunction[points[[1]]];
f2 = BSplineFunction[points[[2]]];
g[u_, v_] := Norm[f1[u] - f2[v]]
NMinimize[{g[x, y], 0 <= x <= 1, 0 <= y <= 1}, {x, y}]
Using
NSolve[g[x, y] == 0, {x, y}]
simply yields the function call as an output, and
FindRoot[g[x, y] == 0, {{x, 0.5, 0, 1}, {y, 0.5, 0, 1}}]
complains that the number of variables does not match the number of equations. Any suggestions on how to solve this?
Edit2: This is a sample of the data I am using that I would like to yield two points of intersection
points =
{{{ 0.0563319, -0.0207277, -0.998197}, { 0.0468164, -0.020208, -0.998699},
{ 0.0361213, -0.0187319, -0.999172}, { 0.0269836, -0.0165999, -0.999498},
{ 0.0191223, -0.0140227, -0.999719}, { 0.0122367, -0.0111131, -0.999863},
{ 0.00603102,-0.00789628, -0.999951}, { 0.000232715,-0.00432551,-0.999991},
{-0.00539442,-0.000299408,-0.999985}, {-0.0110431, 0.00431947,-0.99993},
{-0.0168598, 0.00968684, -0.999811}, {-0.0229461, 0.0159607, -0.999609},
{-0.0293624, 0.0232877, -0.999298}, {-0.036133, 0.031792, -0.998841},
{-0.0432526, 0.0415674, -0.998199}, {-0.0506922, 0.0526714, -0.997324}},
{{-0.0563319, 0.0207277, -0.998197}, {-0.0468164, 0.020208, -0.998699},
{-0.0361213, 0.0187319, -0.999172}, {-0.0269836, 0.0165999, -0.999498},
{-0.0191223, 0.0140227, -0.999719}, {-0.0122367, 0.0111131, -0.999863},
{-0.00603102, 0.00789628, -0.999951}, {-0.000232715, 0.00432551,-0.999991},
{ 0.00539442, 0.000299408,-0.999985}, { 0.0110431, -0.00431947,-0.99993},
{ 0.0168598, -0.00968684, -0.999811}, { 0.0229461, -0.0159607, -0.999609},
{ 0.0293624, -0.0232877, -0.999298}, { 0.036133, -0.031792, -0.998841},
{ 0.0432526, -0.0415674, -0.998199}, { 0.0506922, -0.0526714, -0.997324}}};