# The intersection of two "mesh surfaces from points" which are not convex

After solving the problems with determining the intersection of two mesh surfaces I came across an additional obstacle.

Unfortunately, I encountered a problem with the solution - if the surface is not convex, the solution mentioned in the previous question unfortunately does not work. Example below - I have point data:

S22Y01 = {{0.005, 0.975, -4098820}, {0.005, 0.925, 1491250}, {0.005,
0.875, -28651}, {0.005, 0.825, -126520}, {0.005,
0.775, -64731}, {0.005, 0.725, -104303}, {0.005,
0.675, -79939}, {0.005, 0.625, -96720}, {0.005,
0.575, -87269}, {0.005, 0.525, -91978}, {0.005,
0.475, -91978}, {0.005, 0.425, -87269}, {0.005,
0.375, -96720}, {0.005, 0.325, -79939}, {0.005,
0.275, -104303}, {0.005, 0.225, -64732}, {0.005,
0.175, -126521}, {0.005, 0.125, -28651}, {0.005, 0.075,
1491250}, {0.005, 0.025, -4098820}, {0.015,
0.975, -4697260}, {0.015, 0.925, 1827450}, {0.015, 0.875,
32231}, {0.015, 0.825, -77745}, {0.015, 0.775, -9879}, {0.015,
0.725, -54141}, {0.015, 0.675, -26396}, {0.015,
0.625, -44977}, {0.015, 0.575, -34275}, {0.015,
0.525, -39468}, {0.015, 0.475, -39468}, {0.015,
0.425, -34275}, {0.015, 0.375, -44978}, {0.015,
0.325, -26396}, {0.015, 0.275, -54141}, {0.015,
0.225, -9879}, {0.015, 0.175, -77745}, {0.015, 0.125,
32231}, {0.015, 0.075, 1827460}, {0.015, 0.025, -4697260}, {0.025,
0.975, -3973280}, {0.025, 0.925, 1528990}, {0.025, 0.875,
69598}, {0.025, 0.825, -32712}, {0.025, 0.775, 29682}, {0.025,
0.725, -11319}, {0.025, 0.675, 14488}, {0.025,
0.625, -2641}, {0.025, 0.575, 7329}, {0.025, 0.525, 2533}, {0.025,
0.475, 2533}, {0.025, 0.425, 7329}, {0.025, 0.375, -2642}, {0.025,
0.325, 14487}, {0.025, 0.275, -11319}, {0.025, 0.225,
29682}, {0.025, 0.175, -32712}, {0.025, 0.125, 69598}, {0.025,
0.075, 1528990}, {0.025, 0.025, -3973280}, {0.035,
0.975, -3699430}, {0.035, 0.925, 1434040}, {0.035, 0.875,
71368}, {0.035, 0.825, -18771}, {0.035, 0.775, 35147}, {0.035,
0.725, -92}, {0.035, 0.675, 21944}, {0.035, 0.625, 7239}, {0.035,
0.575, 15798}, {0.035, 0.525, 11659}, {0.035, 0.475, 11659}, {0.035,
0.425, 15798}, {0.035, 0.375, 7239}, {0.035, 0.325, 21943}, {0.035,
0.275, -93}, {0.035, 0.225, 35146}, {0.035, 0.175, -18771}, {0.035,
0.125, 71369}, {0.035, 0.075, 1434050}, {0.035,
0.025, -3699430}, {0.045, 0.975, -2556970}, {0.045, 0.925,
589167}, {0.045, 0.875, 68270}, {0.045, 0.825, -13121}, {0.045,
0.775, 34969}, {0.045, 0.725, 3117}, {0.045, 0.675, 23125}, {0.045,
0.625, 9696}, {0.045, 0.575, 17541}, {0.045, 0.525, 13739}, {0.045,
0.475, 13739}, {0.045, 0.425, 17541}, {0.045, 0.375, 9695}, {0.045,
0.325, 23125}, {0.045, 0.275, 3117}, {0.045, 0.225, 34969}, {0.045,
0.175, -13122}, {0.045, 0.125, 68270}, {0.045, 0.075,
589168}, {0.045, 0.025, -2556970}, {0.055, 0.975, -1734810}, {0.055,
0.925, -89464}, {0.055, 0.875, 63625}, {0.055,
0.825, -10042}, {0.055, 0.775, 33048}, {0.055, 0.725, 4086}, {0.055,
0.675, 22283}, {0.055, 0.625, 10028}, {0.055, 0.575,
17193}, {0.055, 0.525, 13719}, {0.055, 0.475, 13719}, {0.055, 0.425,
17193}, {0.055, 0.375, 10028}, {0.055, 0.325, 22282}, {0.055,
0.275, 4086}, {0.055, 0.225, 33047}, {0.055, 0.175, -10042}, {0.055,
0.125, 63625}, {0.055, 0.075, -89463}, {0.055,
0.025, -1734810}, {0.065, 0.975, -1631200}, {0.065,
0.925, -85660}, {0.065, 0.875, 58998}, {0.065,
0.825, -10133}, {0.065, 0.775, 30128}, {0.065, 0.725, 2769}, {0.065,
0.675, 19914}, {0.065, 0.625, 8375}, {0.065, 0.575, 15113}, {0.065,
0.525, 11850}, {0.065, 0.475, 11850}, {0.065, 0.425,
15113}, {0.065, 0.375, 8375}, {0.065, 0.325, 19914}, {0.065, 0.275,
2769}, {0.065, 0.225, 30128}, {0.065, 0.175, -10133}, {0.065, 0.125,
58998}, {0.065, 0.075, -85660}, {0.065, 0.025, -1631200}, {0.075,
0.975, -1580130}, {0.075, 0.925, -85180}, {0.075, 0.875,
55136}, {0.075, 0.825, -11562}, {0.075, 0.775, 27188}, {0.075,
0.725, 678}, {0.075, 0.675, 17272}, {0.075, 0.625, 6101}, {0.075,
0.575, 12623}, {0.075, 0.525, 9466}, {0.075, 0.475, 9466}, {0.075,
0.425, 12623}, {0.075, 0.375, 6101}, {0.075, 0.325, 17272}, {0.075,
0.275, 677}, {0.075, 0.225, 27188}, {0.075, 0.175, -11562}, {0.075,
0.125, 55136}, {0.075, 0.075, -85180}, {0.075,
0.025, -1580130}, {0.085, 0.975, -1580130}, {0.085,
0.925, -85180}, {0.085, 0.875, 55136}, {0.085,
0.825, -11562}, {0.085, 0.775, 27188}, {0.085, 0.725, 678}, {0.085,
0.675, 17272}, {0.085, 0.625, 6101}, {0.085, 0.575, 12623}, {0.085,
0.525, 9466}, {0.085, 0.475, 9466}, {0.085, 0.425, 12623}, {0.085,
0.375, 6101}, {0.085, 0.325, 17272}, {0.085, 0.275, 677}, {0.085,
0.225, 27188}, {0.085, 0.175, -11562}, {0.085, 0.125,
55136}, {0.085, 0.075, -85180}, {0.085, 0.025, -1580130}, {0.095,
0.975, -1631200}, {0.095, 0.925, -85660}, {0.095, 0.875,
58998}, {0.095, 0.825, -10133}, {0.095, 0.775, 30128}, {0.095,
0.725, 2769}, {0.095, 0.675, 19914}, {0.095, 0.625, 8375}, {0.095,
0.575, 15113}, {0.095, 0.525, 11850}, {0.095, 0.475, 11850}, {0.095,
0.425, 15113}, {0.095, 0.375, 8375}, {0.095, 0.325, 19914}, {0.095,
0.275, 2769}, {0.095, 0.225, 30128}, {0.095,
0.175, -10133}, {0.095, 0.125, 58998}, {0.095,
0.075, -85660}, {0.095, 0.025, -1631200}, {0.105,
0.975, -1734810}, {0.105, 0.925, -89464}, {0.105, 0.875,
63625}, {0.105, 0.825, -10042}, {0.105, 0.775, 33048}, {0.105,
0.725, 4086}, {0.105, 0.675, 22283}, {0.105, 0.625, 10028}, {0.105,
0.575, 17193}, {0.105, 0.525, 13719}, {0.105, 0.475, 13719}, {0.105,
0.425, 17193}, {0.105, 0.375, 10028}, {0.105, 0.325,
22282}, {0.105, 0.275, 4086}, {0.105, 0.225, 33047}, {0.105,
0.175, -10042}, {0.105, 0.125, 63625}, {0.105,
0.075, -89463}, {0.105, 0.025, -1734810}, {0.115,
0.975, -2556970}, {0.115, 0.925, 589167}, {0.115, 0.875,
68270}, {0.115, 0.825, -13121}, {0.115, 0.775, 34969}, {0.115,
0.725, 3117}, {0.115, 0.675, 23125}, {0.115, 0.625, 9696}, {0.115,
0.575, 17541}, {0.115, 0.525, 13739}, {0.115, 0.475, 13739}, {0.115,
0.425, 17541}, {0.115, 0.375, 9695}, {0.115, 0.325, 23125}, {0.115,
0.275, 3117}, {0.115, 0.225, 34969}, {0.115,
0.175, -13122}, {0.115, 0.125, 68270}, {0.115, 0.075,
589168}, {0.115, 0.025, -2556970}, {0.125, 0.975, -3699430}, {0.125,
0.925, 1434040}, {0.125, 0.875, 71368}, {0.125,
0.825, -18771}, {0.125, 0.775, 35147}, {0.125, 0.725, -92}, {0.125,
0.675, 21944}, {0.125, 0.625, 7239}, {0.125, 0.575, 15798}, {0.125,
0.525, 11659}, {0.125, 0.475, 11659}, {0.125, 0.425, 15798}, {0.125,
0.375, 7239}, {0.125, 0.325, 21943}, {0.125, 0.275, -93}, {0.125,
0.225, 35146}, {0.125, 0.175, -18771}, {0.125, 0.125,
71369}, {0.125, 0.075, 1434050}, {0.125, 0.025, -3699430}, {0.135,
0.975, -3973280}, {0.135, 0.925, 1528990}, {0.135, 0.875,
69598}, {0.135, 0.825, -32712}, {0.135, 0.775, 29682}, {0.135,
0.725, -11319}, {0.135, 0.675, 14488}, {0.135,
0.625, -2641}, {0.135, 0.575, 7329}, {0.135, 0.525, 2533}, {0.135,
0.475, 2533}, {0.135, 0.425, 7329}, {0.135, 0.375, -2642}, {0.135,
0.325, 14487}, {0.135, 0.275, -11319}, {0.135, 0.225,
29682}, {0.135, 0.175, -32712}, {0.135, 0.125, 69598}, {0.135,
0.075, 1528990}, {0.135, 0.025, -3973280}, {0.145,
0.975, -4697260}, {0.145, 0.925, 1827450}, {0.145, 0.875,
32231}, {0.145, 0.825, -77745}, {0.145, 0.775, -9879}, {0.145,
0.725, -54141}, {0.145, 0.675, -26396}, {0.145,
0.625, -44977}, {0.145, 0.575, -34275}, {0.145,
0.525, -39468}, {0.145, 0.475, -39468}, {0.145,
0.425, -34275}, {0.145, 0.375, -44978}, {0.145,
0.325, -26396}, {0.145, 0.275, -54141}, {0.145,
0.225, -9879}, {0.145, 0.175, -77745}, {0.145, 0.125,
32231}, {0.145, 0.075, 1827460}, {0.145, 0.025, -4697260}, {0.155,
0.975, -4098820}, {0.155, 0.925, 1491250}, {0.155,
0.875, -28651}, {0.155, 0.825, -126520}, {0.155,
0.775, -64731}, {0.155, 0.725, -104303}, {0.155,
0.675, -79939}, {0.155, 0.625, -96720}, {0.155,
0.575, -87269}, {0.155, 0.525, -91978}, {0.155,
0.475, -91978}, {0.155, 0.425, -87269}, {0.155,
0.375, -96720}, {0.155, 0.325, -79939}, {0.155,
0.275, -104303}, {0.155, 0.225, -64732}, {0.155,
0.175, -126521}, {0.155, 0.125, -28651}, {0.155, 0.075,
1491250}, {0.155, 0.025, -4098820}}


After displaying and using the "cases" function, I get intersection points for only one line of interesction. I guess why this is so - unfortunately I do not know how to get points from all intersection lines.

S22Y1PLOT =
ListPlot3D[S22Y01, BoxRatios -> {0.16, 1, 0.2},
PlotRange -> {{0, 0.16}, {0, 1}, {1000000, -5000000}},
BoundaryStyle -> None, MeshFunctions -> {#3 &},
Mesh -> {{{0, Directive[Thick, Red]}}},
ColorFunction -> "SouthwestColors"]
Y01POINTS = Cases[Normal@S22Y1PLOT, Line[x_, ___] :> x, Infinity][[1]];
Show[S22Y1PLOT, Graphics3D[{Purple, Sphere[#, .01] & /@ Y01POINTS}]]


Does anyone have an idea how to solve the problem?

• Please fix the link to the previous question. It is broken. Commented Oct 21, 2018 at 9:34

Just use

Y01POINTS = Cases[Normal@S22Y1PLOT, Line[x_, ___] :> x, Infinity];


Now Y01POINTS contains five list of points: One list for each connected component of the intersection.
Show[S22Y1PLOT, Graphics3D[{Purple, Sphere[#, .01] & /@ Y01POINTS}]]

You can turn it into a single list of points with Join @@ Y01POINTS.