Area of a Closed Bezier Curve - Graphics

This is a discussion on Area of a Closed Bezier Curve - Graphics ; Hi all, I need to evaluate the area of a closed cubic bezier curve defined by the list of control points ( num. points = 1 + 3 * num. bezier sub-curves ). I found a posible solution evaluating the ...

+ Reply to Thread
Results 1 to 7 of 7

Area of a Closed Bezier Curve

  1. Default Area of a Closed Bezier Curve

    Hi all,

    I need to evaluate the area of a closed cubic bezier curve defined by
    the list of control points ( num. points = 1 + 3 * num. bezier sub-curves ).

    I found a posible solution evaluating the curve to get a polyline and
    calculate the area of the enclosed area ( very simple ) but I'd like to
    use a closed solution that doesn't depend on the number of points of the
    polyline.

    Any advise? Thanks..

  2. Default Re: Area of a Closed Bezier Curve

    > Hi all,
    >
    > I need to evaluate the area of a closed cubic bezier curve defined by
    > the list of control points ( num. points = 1 + 3 * num. bezier sub-curves ).
    >
    > I found a posible solution evaluating the curve to get a polyline and
    > calculate the area of the enclosed area ( very simple ) but I'd like to
    > use a closed solution that doesn't depend on the number of points of the
    > polyline.
    >
    > Any advise? Thanks..


    An interesting problem. For any piecewise differentiable curve in 2D,
    the following general procedure gives you the area inside the curve /
    series of curves. For polynomial curves (Bezier curves), you will get
    closed form solutions.

    Let
    g(t) be a piecewise differentiable curve, with 0 <= t <= 1. g(t) is
    oriented clockwise and g(1) = g(0).

    Let
    F(x, y) = [x, y] / 2

    Then div(F(x, y)) = 1
    where div is for divergence.

    Now the divergence theorem gives you the area inside the closed curve g
    (t) as a line integral along the curve:

    int(dot(F(g(t)), perp(g'(t))) dt, t = 0..1)
    = (1 / 2) * int(dot(g(t), perp(g'(t))) dt, t = 0..1)

    perp(x, y) = (-y, x)

    where int is for integration, ' for differentiation and dot for dot
    product. The integration has to be pieced to the parts corresponding to
    the smooth curve segments.

    Now for examples. Take the Bezier degree 3 and one such curve with
    control points (x0, y0), (x1, y1), (x2, y2), (x3, y3). The integral over
    this curve is:

    I := 3 / 10 * y1 * x0 - 3 / 20 * y1 * x2 -
    3 / 20 * y1 * x3 - 3 / 10 * y0 * x1 -
    3 / 20 * y0 * x2 - 1 / 20 * y0 * x3 +
    3 / 20 * y2 * x0 + 3 / 20 * y2 * x1 -
    3 / 10 * y2 * x3 + 1 / 20 * y3 * x0 +
    3 / 20 * y3 * x1 + 3 / 10 * y3 * x2

    Calculate this for each curve in the sequence and add them up. The sum
    is the area enclosed by the curves (assuming the curves form a loop).

    If the curve consists of just one Bezier curve, then it must be x3 = x0
    and y3 = y0, and the area is:

    Area := 3 / 20 * y1 * x0 - 3 / 20 * y1 * x2 -
    3 / 20 * y0 * x1 + 3 / 20 * y0 * x2 -
    3 / 20 * y2 * x0 + 3 / 20 * y2 * x1

    Hope I did not do mistakes.

    --
    Kalle Rutanen
    http://kaba.hilvi.org

  3. Default Re: Area of a Closed Bezier Curve

    You made me remember some calculus theorems, searched on Google and
    found Gauss-Green Theorem, the same you explained to me.

    Thanks Kalle..

  4. Default Momentum of Inertia of a Closed Bezier Curve

    Thanks Kalle. This works great !!

    But I have another question: can I use the same approach to calculate
    the momentum of inertia of the closed bezier curve ?

    Let:

    F(x,y) = [-xy,xy]

    Then:

    div(F(x,y)) = x+y

    The integral (momentum of inertia) results:

    I = int( dot( F(g(t)) , perp(g'(t) ) ) dt =
    = int( -gx(t)gy(t)d(gy(t))/dt + gx(t)gy(t)d(gx(t))dt ) dt

    Where:
    g(t) = [gx(t),gy(t)]

    Did I do any mistake ?

    Kaba escribi:
    >> Hi all,
    >>
    >> I need to evaluate the area of a closed cubic bezier curve defined by
    >> the list of control points ( num. points = 1 + 3 * num. bezier sub-curves ).
    >>
    >> I found a posible solution evaluating the curve to get a polyline and
    >> calculate the area of the enclosed area ( very simple ) but I'd like to
    >> use a closed solution that doesn't depend on the number of points of the
    >> polyline.
    >>
    >> Any advise? Thanks..

    >
    > An interesting problem. For any piecewise differentiable curve in 2D,
    > the following general procedure gives you the area inside the curve /
    > series of curves. For polynomial curves (Bezier curves), you will get
    > closed form solutions.
    >
    > Let
    > g(t) be a piecewise differentiable curve, with 0 <= t <= 1. g(t) is
    > oriented clockwise and g(1) = g(0).
    >
    > Let
    > F(x, y) = [x, y] / 2
    >
    > Then div(F(x, y)) = 1
    > where div is for divergence.
    >
    > Now the divergence theorem gives you the area inside the closed curve g
    > (t) as a line integral along the curve:
    >
    > int(dot(F(g(t)), perp(g'(t))) dt, t = 0..1)
    > = (1 / 2) * int(dot(g(t), perp(g'(t))) dt, t = 0..1)
    >
    > perp(x, y) = (-y, x)
    >
    > where int is for integration, ' for differentiation and dot for dot
    > product. The integration has to be pieced to the parts corresponding to
    > the smooth curve segments.
    >
    > Now for examples. Take the Bezier degree 3 and one such curve with
    > control points (x0, y0), (x1, y1), (x2, y2), (x3, y3). The integral over
    > this curve is:
    >
    > I := 3 / 10 * y1 * x0 - 3 / 20 * y1 * x2 -
    > 3 / 20 * y1 * x3 - 3 / 10 * y0 * x1 -
    > 3 / 20 * y0 * x2 - 1 / 20 * y0 * x3 +
    > 3 / 20 * y2 * x0 + 3 / 20 * y2 * x1 -
    > 3 / 10 * y2 * x3 + 1 / 20 * y3 * x0 +
    > 3 / 20 * y3 * x1 + 3 / 10 * y3 * x2
    >
    > Calculate this for each curve in the sequence and add them up. The sum
    > is the area enclosed by the curves (assuming the curves form a loop).
    >
    > If the curve consists of just one Bezier curve, then it must be x3 = x0
    > and y3 = y0, and the area is:
    >
    > Area := 3 / 20 * y1 * x0 - 3 / 20 * y1 * x2 -
    > 3 / 20 * y0 * x1 + 3 / 20 * y0 * x2 -
    > 3 / 20 * y2 * x0 + 3 / 20 * y2 * x1
    >
    > Hope I did not do mistakes.
    >


  5. Default Re: Momentum of Inertia of a Closed Bezier Curve

    > Thanks Kalle. This works great !!
    >
    > But I have another question: can I use the same approach to calculate
    > the momentum of inertia of the closed bezier curve ?


    You want to integrate x^2 + y^2 over the area enclosed by the Bezier
    curve? Yes you can use the same approach as for any polynomial of x and
    y.

    > Let:
    >
    > F(x,y) = [-xy,xy]
    >
    > Then:
    >
    > div(F(x,y)) = x+y


    There's a mistake here, the divergence of the given F is -2xy + 2xy = 0.
    (div(F) = d(F)/dx + d(F)/dy)
    The right F is
    F(x, y) = [x^3, y^3] / 3

    > The integral (momentum of inertia) results:
    >
    > I = int( dot( F(g(t)) , perp(g'(t) ) ) dt =
    > = int( -gx(t)gy(t)d(gy(t))/dt + gx(t)gy(t)d(gx(t))dt ) dt
    >
    > Where:
    > g(t) = [gx(t),gy(t)]
    >
    > Did I do any mistake ?


    Try again with the new F

    --
    Kalle Rutanen
    http://kaba.hilvi.org

  6. Default Re: Area of a Closed Bezier Curve

    > You made me remember some calculus theorems, searched on Google and
    > found Gauss-Green Theorem, the same you explained to me.


    Yes, although I haven't heard of Gauss-Green, just Gauss and Green
    separately. They are very close to each other, yet I prefer Gauss
    because it generalizes to higher dimensions. Greens theorem mixes the
    actual idea and the computation of the normal that works only in 2D.

    --
    Kalle Rutanen
    http://kaba.hilvi.org

  7. Default Re: Momentum of Inertia of a Closed Bezier Curve

    What a silly mistake !!.. Thanks Kaba. Now it works.

    Kaba escribi:
    >> Thanks Kalle. This works great !!
    >>
    >> But I have another question: can I use the same approach to calculate
    >> the momentum of inertia of the closed bezier curve ?

    >
    > You want to integrate x^2 + y^2 over the area enclosed by the Bezier
    > curve? Yes you can use the same approach as for any polynomial of x and
    > y.
    >
    >> Let:
    >>
    >> F(x,y) = [-xy,xy]
    >>
    >> Then:
    >>
    >> div(F(x,y)) = x+y

    >
    > There's a mistake here, the divergence of the given F is -2xy + 2xy = 0.
    > (div(F) = d(F)/dx + d(F)/dy)
    > The right F is
    > F(x, y) = [x^3, y^3] / 3
    >
    >> The integral (momentum of inertia) results:
    >>
    >> I = int( dot( F(g(t)) , perp(g'(t) ) ) dt =
    >> = int( -gx(t)gy(t)d(gy(t))/dt + gx(t)gy(t)d(gx(t))dt ) dt
    >>
    >> Where:
    >> g(t) = [gx(t),gy(t)]
    >>
    >> Did I do any mistake ?

    >
    > Try again with the new F
    >


+ Reply to Thread

Similar Threads

  1. Bezier curve
    By Application Development in forum CSharp
    Replies: 2
    Last Post: 11-11-2007, 09:23 AM
  2. Bezier curve to NURBS curve
    By Application Development in forum Graphics
    Replies: 4
    Last Post: 10-12-2007, 10:10 AM
  3. Moment of Inertia of a Closed Bezier Curve
    By Application Development in forum Graphics
    Replies: 0
    Last Post: 05-17-2007, 03:42 AM
  4. bezier curve: solve for y
    By Application Development in forum Graphics
    Replies: 6
    Last Post: 05-04-2007, 04:32 AM
  5. How to plot an arbitrary closed bezier curve
    By Application Development in forum Graphics
    Replies: 3
    Last Post: 01-30-2006, 06:00 AM