[Python] (2D) How to make Bezier curve line has width by using python?

Discussão em 'Python' iniciado por Stack, Janeiro 15, 2025.

  1. Stack

    Stack Membro Participativo

    If I have a Bezier curve, how could I make it have width, and how to get vertices of its contour?

    My attempt: I have plot a Bezier curve by using one start point, two control points and one end points, their coordinates are:

    p0_ = [11, -0.45]
    p1_ = [13.5, -0.45]
    p2_ = [13.5, -4]
    p3_ = [16, -4]


    the figure is as shown below:

    [​IMG]

    But I want to make it have width, lets say width=0.7, then I change the original coordinates into:

    width = 0.7
    p01_ = [11, -0.45 + width / 2]
    p11_ = [13.5, -0.45 + width / 2]
    p21_ = [13.5, -4 + width / 2]
    p31_ = [16, -4 + width / 2]
    p02_ = [11, -0.45 - width / 2]
    p12_ = [13.5, -0.45 - width / 2]
    p22_ = [13.5, -4 - width / 2]
    p32_ = [16, -4 - width / 2]


    And then I plot new figure, I find it looks quite strange. It is not uniform.

    [​IMG]

    Obviously, this is not the one I want, I guess the coordinates are wrong, But I do not know how to get correct one? What I want is like the one shown below:

    [​IMG]

    You see, everywhere is uniform.

    Continue reading...

Compartilhe esta Página