タグ

graphicsとbezierに関するnitoyonのブックマーク (3)

  • Anti-Grain Geometry - Interpolation with Bezier Curves

    Interpolation with Bezier Curves A very simple method of smoothing polygons Initially, there was a question in comp.graphic.algorithms how to interpolate a polygon with a curve in such a way that the resulting curve would be smooth and hit all its vertices. Gernot Hoffmann suggested to use a well-known B-Spline interpolation. Here is his original article. B-Spline works good and it behaves like an

    nitoyon
    nitoyon 2009/03/04
    ポリゴンをベジェで丸く補間する方法。
  • Catmull-Rom 補間 - blog.seyself.com

    スプライン補間があんまり混雑な計算になってしまうので いろいろ探してたら「Catmull-Rom 補間」なるものを知りました。 function CatmullRom(p0:Number, p1:Number, p2:Number, p3:Number, t:Number):Number { var v0:Number = (p2 - p0) / 2; var v1:Number = (p3 - p1) / 2; var t2:Number = t * t; var t3:Number = t2 * t; return (2 * p1 - 2 * p2 + v0 + v1) * t3 + ( -3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; } t には 0.0 から 1.0 の係数が入ります。 p0 から p3 間にある点、p

    nitoyon
    nitoyon 2008/06/13
    Catmull-Rom 補間というアルゴリズムで曲線を描くデモ。
  • NUTSU » [as]ベジェ曲線と点の距離(2)

    最近の季の節で風邪をひいてへたってますが、先日書いた「ベジェ曲線と点の距離」の続きを書きます。計算のやり方としては、2次ベジェ関数から導いた距離の数式を微分して解を求める、という感じ。 さて、2次ベジェのx,y座標を、tの関数とすると、それぞれ // 始点 point0 // 終点 point1 // コントロール点 control //x座標の関数 fx(t) = point0.x*tp*tp + 2*control.x*t*tp + point1.x*t*t; //y座標の関数 fy(t) = point0.y*tp*tp + 2*control.y*t*tp + point1.y*t*t; というような2次式になります。ここで、任意の点(x,y)からの距離を考えると、距離はtの関数で //点(x,y)と曲線の距離平方の関数 fd2(t) = (fx(t)-x)*(fx(t)-x) +

    nitoyon
    nitoyon 2007/11/08
    ベジェと点の距離を計算。微分して求めている。デモのFlashも分かりよい。
  • 1