相关疑难解决方法(0)

D3.js - 检测交叉区域

NB

这个问题不重复..其他帖子正在寻找交叉点而不是交叉区域

我试图检测3个圆的交叉区域,以便以不同于非交叉区域的方式处理它.

我的圈子看起来像: 在此输入图像描述

此处的交叉区域不可见.到目前为止我能做的是通过降低不透明度来显示它,得到这样的东西:

在此输入图像描述

我正在寻找一种智能的方法来检测这三个圆圈的交叉区域.

编辑

如果可以提供帮助,这是我的d3.js代码:

// Code circle 
    svg.append("circle")
    .attr("class","services_nodes")
    .attr("cx",7*width/16)
    .attr("cy",height/2)
    .attr("r",height/4)
    .attr('fill', "blue")

    // Label code
    svg.append("text")
    .attr("class","label_services")
    .attr("x", 7*width/16 - 21*width/265)
    .attr("y",35*height/64)
    .text("Code");

    // Consulting
    svg.append("circle")
    .attr("class","services_nodes")
    .attr("cx",9*width/16)
    .attr("cy",height/2)
    .attr('fill', "red")
    .attr('r', height/4)

    // Label Consulting
    svg.append("text")
    .attr("class","label_services")
    .attr("x", 9*width/16)
    .attr("y",35*height/64)
    .text("Consulting");

    // Support 
    svg.append("circle")
    .attr("class","services_nodes")
    .attr("cx",7*width/16 + height/8)
    .attr("cy",height/2 - Math.sqrt(3)*height/8) // y +/- Math.sqrt(3)*r/2
    .attr('fill', "green")
    .attr('r',height/4)

    // Label Support
    svg.append("text")
    .attr("class","label_services")
    .attr("x", 7*width/16 + 3*height/64)
    .attr("y",height/2 …
Run Code Online (Sandbox Code Playgroud)

javascript intersection d3.js

10
推荐指数
1
解决办法
3017
查看次数

标签 统计

d3.js ×1

intersection ×1

javascript ×1