引子

继双角线,接着尝试心形线(Cardioid)。

  • Origin
  • My GitHub

简介

Cardioid 是 Castillon 在 1741 年《Philosophical Transactions of the Royal Societyin》的一篇论文中首次应用的名称,它是一条曲线,是圆周上一点绕着半径相等的圆的圆周旋转所造成的轨迹。

在笛卡尔坐标系中公式形容:

其中 a 为常数。

绘制

参数化转换:

这是示例,绘制次要逻辑代码:

function draw() {  let a = 40, start = 0;  let x = 0, y = 0, points = [];  const acceleration = 0.1, max = 40;  while (start <= max) {    const cal = 2 * start;    x = a * (2 * Math.cos(start) - Math.cos(cal));    y = a * (2 * Math.sin(start) - Math.sin(cal));    points.push([x, y]);    start = start + acceleration;  }  // 实现把点绘制成线的办法  line({ points: points});}

参考资料

  • Cardioid Curves
  • Cardioid Wolfram