d3.js中轮廓图的最小设置

时间:2019-05-02 10:45:09

标签: javascript d3.js svg

我正在使用D3-Contour库绘制隐式曲线(由等式f(x,y)=0描述的那些曲线),由于D3中存在大量可能性(因此大)。我只需要

  • 要绘制单条曲线f(x,y)=0),
  • 要频繁更改公式f,并能够有效地更新曲线

理想情况下,我的代码将是这样的:

class ImplicitCurve {

    constructor(svg, ...anotherArguments) {
        this.curve = svg.append(...........);
        // dimensions of grid?
        // grid of values?

    }

    paintFunction(f) {
        this.curve
            .attr(.......)
            .attr(.......)
            .attr(.......)
            .attr(.......)
            .attr(.......)
    }
}
  • 哪些对象仅需要实例化一次?应在类中保留什么?
  • 在绘制新功能f时,需要更改哪些对象?

0 个答案:

没有答案