I am using d3.svg.symbol().type("triangle-up")
as a way to show the intended direction of a path. See image for what I mean
I need the direction of the triangle to be facing words the end point of a path.
I can position the triangle in the middle point of a path and manually rotate it, however, I do not what direction the arrow will need to be facing as the paths are not always the same.
Here is an image of what I currently have:
And here is an image of what I am trying to achieve:
And here is the code i am using up to now:
PLEASE NOT THAT THE VALUES IN THE TRANSLATE PART OF THE CODE ARE THE MIDDLE POINTS OF THE CURVED LINE:
radiusSensorsG.append("path")
.attr("class", "curved-triangles")
.attr("d", d3.svg.symbol().type("triangle-up").size(10)))
.attr("transform", function () {
if(index % 2 == 0) {
return "translate(" +
map.latLngToLayerPoint(curvedCoords[index][1].curveLatLng).x + "," +
map.latLngToLayerPoint(curvedCoords[index][1].curveLatLng).y + ")";
}
else {
return "translate(" +
map.latLngToLayerPoint(curvedCoords[index][1].curveLatLng).x + "," +
map.latLngToLayerPoint(curvedCoords[index][1].curveLatLng).y + ")";
}
})
If it helps the answer in any way, I have the lat/lng positions of the pink markers. These pink markers are what I need my green arrow facing toward and the pink arrow facing back into the large green circle.
If there is any information that I have not provided, please let me know.
Thanks