-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Line duplicate points fix #979
Line duplicate points fix #979
Conversation
for a in [x,y]: | ||
while len(a)<n: | ||
while len(a)<number_points: | ||
a.append(a[-1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@doutriaux1 This looks like the same issue we had in 46105aa. Can you check the similar functions in this file and make sure they're treating both n and N correctly?
I think this while len(a) < number_points: a.append(a[-1])
bit should just be assert(len(a) == number_points)
(or similar failure) here, too, unless this is an expected feature. Otherwise it would likely just mask user mistakes and give unexpected incorrect results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I'm open to this, but historically it would pad it for the user with the last value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. As long as it's doing what they'd expect it to!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, and I'd linked the wrong commit earlier -- I meant to point at this one: d8f725a
is this still valid? |
Yup. Looks like it's still doing it. In [1]: l = vcs.createline()
In [2]: l.x = [[0, .5], [0]]
In [3]: l.y = [[0, .5], [0]]
In [4]: x.line(l)
Out[4]: <vcs.displayplot.Dp at 0x111a548c0>
In [5]: l.x
Out[5]: [[0, 0.5], [0, 0]]
In [6]: l.y
Out[6]: [[0, 0.5], [0, 0]] |
@chaosphere2112 can you also please add the test to CMakeList.txt in testing/vcs ? Thanks, C. |
Oh, yeah, that would probably be helpful 😅 |
dont' worry I did it |
Ah, thanks! |
When using lines in vcs, a bug would add many duplicate points to the line object. Here's a sample:
which outputs
I spruced up the prepLine function in vcs2vtk.py, and renamed the ambiguous variables that led to the bug. I also added a test that makes sure that the X and Y points are being extended correctly.