Ask Your Question
2

Possible problem in bezier_path.py

asked 2021-04-11 02:07:59 +0100

RozaTh gravatar image

updated 2021-04-11 10:49:37 +0100

vdelecroix gravatar image

It seems that the path that is stored by BezierPath is not correct.

Let

p2d = [[(3.0,0.0),(3.0,0.13),(2.94,0.25),(2.8,0.35)],
  [(2.7,0.44),(2.6,0.5),(2.5,0.5)],
  [(2.36,0.5),(2.24,0.44),(2.14,0.35)],
  [(2.05,0.25),(2.0,0.13),(2.0,6.1e-17)]]

then

bezier_path(p2d)[0].path

is different than the given path p2d. There are several consequences to this, for example, the stored path cannot be fed again to bezier_path, so this won't work (results in weird errors):

bezier_path(bezier_path(p2d)[0].path)

and also affects the plot3d method of the class.

The issue seems to stem from line 64 of bezier_path.py:

vertices = self.path[0]

Since the list of vertices changes size after the line so does self.path. I believe the line should be

vertices = deepcopy(self.path[0])
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-04-11 10:24:59 +0100

vdelecroix gravatar image

updated 2021-04-11 10:39:06 +0100

hmmm I wonder who wrote that extremly buggy and untested code! You were exactly right vertices = self.path[0] was the line to blame. Thanks for your report and the precise analysis of the bug!

I opened the ticket #31646 in which I provide a more general cleaning of the BezierPath constructor.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-04-11 02:07:59 +0100

Seen: 71 times

Last updated: Apr 11