Showing posts with label C++. Show all posts
Showing posts with label C++. Show all posts

2012-10-17

3次ベジェ曲線を高速に計算して描画する方法

ずっと昔に読んだ、3次ベジェ曲線 (Cubic Bezier curve) を前進差分で高速に計算する方法を解説した記事が復活していたので、メモ。
Forward Difference Calculation of Bezier Curves | Dr Dobb's
http://www.drdobbs.com/forward-difference-calculation-of-bezier/184403417
Figure とか Listing とかのリンクが切れているが、ページ下の方の「1 2 3 4 5 Next」から見ることができる。

2013-08-17 追記
リンク先の生存を確認。http://www.drdobbs.com/ はしばしばアクセスできなくなるが、その場合は時間をおいて再度アクセスするとよい。

2013-10-25 追記
下記のページにも Dr Dobb's と同じ記事が存在する。http://www.drdobbs.com/ のサイトが見られない場合はこちらを参照。
November 1997/Forward Difference Calculation of Bezier Curves
http://collaboration.cmc.ec.gc.ca/science/rpn/biblio/ddj/Website/articles/CUJ/1997/9711/bartley/bartley.htm

2012-09-09

Population count

先日の「Long.bitCount(long) の速度」の記事で比較した it.unimi.dsi.bits.Fast.count(long) だが、Wikipedia にも同様のコードが載っていてショック。
Hamming weight - Wikipedia, the free encyclopedia
http://en.wikipedia.org/wiki/Hamming_weight
そのコードを一般化したものが次のページに載っている。
Counting bits set, in parallel - Bit Twiddling Hacks
http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel