I have following coordinates in this nested array that generate a path for each of those players. They're all straight lines at right angles. Now the problem is that I don't have any methods in mind that allow me to calculate the coordinates of any potential intersections between each of those paths in case they overlap.
Does anyone knows of a Javascript method that allows me to calculate any intersections between a dynamic number of paths each with a different amount of coordinate sets?
Here's how it looks like in the frontend just to give you a picture:
Here's the array code that I use to generate the paths on a HTML canvas:
var data = [{
"uid": 1,
"prop": [{
"name": "im1tta",
"color": "#5FFFC1",
"path": [{
"x": 20,
"y": 20
}, {
"x": 20,
"y": 100
}, {
"x": 70,
"y": 100
}, {
"x": 70,
"y": 200
}]
}]
}, {
"uid": 2,
"prop": [{
"name": "Difan",
"color": "#FF5F88",
"path": [{
"x": 450,
"y": 100
}, {
"x": 450,
"y": 210
}, {
"x": 400,
"y": 210
}]
}]
}, {
"uid": 3,
"prop": [{
"name": "Alina",
"color": "#5F78FF",
"path": [{
"x": 310,
"y": 200
}, {
"x": 350,
"y": 200
}, {
"x": 350,
"y": 290
}, {
"x": 410,
"y": 290
}, {
"x": 410,
"y": 320
}]
}]
}];
Btw, this is my first Stackoverflow Questions & thanks for helping me out!