引子
繼連鎖螺線,接着嘗試星形線(Astroid)。
簡介
Johann Bernoulli 在 1691-1692 年首次討論了星形線。它也出現在 Leibniz 1715 年的信件中。它有時被稱為四尖瓣,很明顯因為它有四個尖。
Astroid 直到 1836 年才在維也納出版的一本書中獲得了現在的名稱。即使在 1836 年以后,文獻中也出現了各種名稱,包括 cubocycloid 和 paracycle 。
在笛卡爾坐標系中公式描述:
其中 a 為常數。
繪制
參數化轉換:
這是示例,繪制主要邏輯代碼:
function draw() {
let a = 100, start = 0;
let x = 0, y = 0, points = [];
const acceleration = 0.1, max = 20;
while (start <= max) {
x = a * Math.pow(Math.cos(start), 3);
y = a * Math.pow(Math.sin(start), 3);
points.push([x, y]);
start = start + acceleration;
}
// 實現把點繪制成線的方法
line({ points: points});
}