JavaScript 数学曲线—双角线
2021/11/15 9:10:04
本文主要是介绍JavaScript 数学曲线—双角线,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
引子
继星形线,接着尝试双角线(Bicorn)。
- Origin
- My GitHub
简介
双角线也称为三角帽(cocked-ha)曲线,是 Sylvester 在 1864 年研究的一组四次曲线的名称。Cayley 在 1867 年研究了同样的曲线。
在笛卡尔坐标系中公式描述:
其中 a 为常数。
绘制
参数化转换:
这是示例,绘制主要逻辑代码:
function draw() { let a = -100, start = 0; let x = 0, y = 0, points = []; const acceleration = 0.1, max = 40; while (start <= max) { x = a * Math.sin(start); const yNumerator = a * Math.pow(Math.cos(start), 2) * (2 + Math.cos(start)); const yDenominator = 3 + Math.pow(Math.sin(start), 2); y = yNumerator / yDenominator; points.push([x, y]); start = start + acceleration; } // 实现把点绘制成线的方法 line({ points: points}); }
参考资料
- Bicorn Curves
- Bicorn Wolfram
这篇关于JavaScript 数学曲线—双角线的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-21订单系统资料入门教程:轻松管理你的订单
- 2024-09-21Java部署资料:新手入门教程
- 2024-09-21Java部署资料:新手入门教程
- 2024-09-21Java订单系统资料:新手入门教程与实战指南
- 2024-09-21Java管理系统资料入门教程
- 2024-09-21从零开始学习Java监控系统资料
- 2024-09-21Java就业项目资料:新手入门的必备教程
- 2024-09-21Java全端资料:初学者指南
- 2024-09-21Java全栈资料入门教程及资源汇总
- 2024-09-21Java日志系统资料入门教程