Bezier Curves

Hi !

How can i draw two different PolyBezier consecutively

for (; i < N; i++)
{
pointsIdea.x = i;
pointsIdea.y = f(i, 1); // draws a y=x
}

PolyBezier(hdc, points, N);

//------------------------------------

for (; i < N; i++)
{
pointsIdea.x = i;
pointsIdea.y = f(i, 1); // draws a y=logx
}

PolyBezier(hdc, points, N);

This does not work. I get only the first function.
And another problem. I can't erase a Bezier Curve if I use InvalidateRect(). I use a counter to test. if(count) { draw; count=0} and by the next WM_PAINT i still get the curve.



Answer this question

Bezier Curves

  • Minhaj

    ok thx
  • Tom Regan

    You have two loops here.  Both go from the initial value of i up to N-1.  You don't reset i, so when the second loop comes around, i already equals N.

    I'm not sure what your erasing problem is - obviouslyyou mean that WM_PAINT is where you draw this to the screen Your code snippet doesn't really tell me anything, but if draw calls a function to do the drawing and count is the number that becomes N, then they are the wrong way around.

    The obvious way to do this is to keep a collection in a vector of the data you need to draw a curve, then remove them as you want to not draw them anymore.

     



  • Bezier Curves