npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fexamples/event

v0.0.2

Published

https://wardenfeng.github.io/bezier

Downloads

2

Readme

Bézier曲线

https://wardenfeng.github.io/bezier

创建该库的原始目的是为了解决feng3d引擎粒子中时间与常量的变化曲线问题。

制作Bézier曲线这个库忙了整整3天了,感觉要跳进高等代数的坑了,得赶紧爬出这个坑,这坑太深了,以后再来跳。

说了不陷入,结果又制作了 EquationSolving.ts 提供了方程求解功能。

核心文件

  1. Bezier.ts Bézier曲线
Bezier.ts

解决任意Bézier曲线的求值求导获取极值等问题。

  1. 1次Bézier曲线
    • 求值 bezier.linear
    • 导数 bezier.linearDerivative
    • 二阶导数 bezier.linearSecondDerivative
  2. 2次Bézier曲线
    • 求值 bezier.quadratic
    • 导数 bezier.quadraticDerivative
    • 二阶导数 bezier.quadraticSecondDerivative
  3. 3次Bézier曲线
    • 求值 bezier.cubic
    • 导数 bezier.cubicDerivative
    • 二阶导数 bezier.cubicSecondDerivative
  4. n次Bézier曲线的值 n > 0
    • 求值 bezier.getValue
    • 导数 bezier.getDerivative
    • 二阶导数 bezier.getSecondDerivative
    • N阶导数 bezier.bnND
  5. n次Bézier曲线的极值列表 bezier.getExtremums
  6. n次Bézier曲线的区间列表 bezier.getMonotoneIntervals
  7. 查找区间内极值列表 bezier.getExtremums
  8. 获取目标值所在的插值度T bezier.getTFromValue
  9. 分割曲线,在曲线插值度t位置分割为两条连接起来与原曲线完全重合的曲线 bezier.split
  10. 合并曲线,合并两条连接的曲线为一条曲线并且可以还原为分割前的曲线 bezier.merge
EquationSolving.ts

解决任意一元函数求导以及方程求解等问题。

  1. 获取近似导函数 f'(x) equationSolving.getDerivative
  2. 二分法 求解 f(x) == 0 equationSolving.binary
  3. 连线法 求解 f(x) == 0 equationSolving.line
  4. 切线法 求解 f(x) == 0 equationSolving.tangent
  5. 割线法(弦截法) 求解 f(x) == 0 equationSolving.secant

示例

使用BezierCurve进行模拟canvas提供的 bezierCurveTo方法

quickstart website

随机生成n阶Bézier曲线并且播放插值动画

quickstart website

Bézier曲线编辑器

quickstart website

连续三阶Bézier曲线编辑

quickstart website

基于时间轴的连续三阶Bézier曲线编辑

该示例已经满足feng3d中曲线编辑器的需求。

quickstart website

单元测试

quickstart website

参考资料

  1. https://en.wikipedia.org/wiki/B%C3%A9zier_curve
  2. https://baike.baidu.com/item/%E8%B4%9D%E5%A1%9E%E5%B0%94%E6%9B%B2%E7%BA%BF/1091769
  3. https://blog.csdn.net/venshine/article/details/51750906
  4. https://github.com/venshine/BezierMaker
  5. https://github.com/gre/bezier-easing
  6. https://github.com/vrk/beziertool
  7. https://github.com/gre/bezier-easing-editor
  8. 高等数学 第七版上册 第三章第八节 方程的近似解

关于作者

网站:http://feng3d.com/

github:https://github.com/wardenfeng

github:https://github.com/feng3d-labs

getee:https://gitee.com/feng3d

feng3d交流QQ群:519732759