Create svg arcs between two points

前端 未结 3 1936
死守一世寂寞
死守一世寂寞 2021-02-03 23:57

I want to connect two SVG points (e.g. the centers of two circles) using arcs. If there is only one connection, the line () will be straight. I

3条回答
  •  终归单人心
    2021-02-04 00:33

    You're making life very difficult for yourself by requiring circular arcs.

    If you use quadratic curves instead, then the geometry becomes very simple — just offset the central X coordinate by half the difference in Y coordinates, and vice versa.

    function arc_links(dwg,x1,y1,x2,y2,n,k) {
      var cx = (x1+x2)/2;
      var cy = (y1+y2)/2;
      var dx = (x2-x1)/2;
      var dy = (y2-y1)/2;
      var i;
      for (i=0; i
    
    

提交回复
热议问题