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
WIP: RectVisual, Regular polygon visuals, and more. #284
Conversation
@@ -23,7 +22,8 @@ class Ellipse(Polygon): | |||
default: (1,1) | |||
""" | |||
def __init__(self, pos=None, color=(0, 0, 0, 0), border_color=None, | |||
radius=(0.1, 0.1), **kwds): | |||
radius=(0.1, 0.1), start_angle=0., span_angle=360., | |||
num_segments=100, **kwds): | |||
super(Ellipse, self).__init__() | |||
|
|||
glopts = kwds.pop('gl_options', 'translucent') |
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.
Try to avoid repeated code as much as possible. For example, set_gl_options is called once for each constructor, which means it is called 3 times for the RegularPolygon constructor.
Sorry, hadn't realized this had been updated. |
I think this is ready for merge; it just needs to be merged with scenegraph first to resolve a minor conflict. |
Sure. No problem. I'm currently working on tests for the EllipseVisual. With regards, On Sat, Jul 5, 2014 at 12:22 AM, Luke Campagnola notifications@github.com
|
On Fri, Jul 4, 2014 at 3:12 PM, M S Suraj notifications@github.com wrote:
I recommend to read up on the difference between logical pixels and |
Thanks. With regards, On Sat, Jul 5, 2014 at 6:28 AM, Luke Campagnola notifications@github.com
|
@lcampagn Here's a sample test that uses a reference image and checks if the visual data is same as that. I was thinking of adding a diff based comparison with some tolerance level for other tests. Since Also, a373cd4 adds |
If the goal is to use it for testing, my vote would be to put it in
Assuming we can settle on a reasonable API for the function, this would work well. I had in mind checking the maximal value of a cross-correlation, since this would allow for small shifts/inaccuracies. But we might have to experiment with different ideas to get it to work. Note that a diff-with-tolerance is exactly what Regarding the |
Note: image data should not be added to the main repository. For this PR, you should backtrack to the last commit before the image was added, and re-commit from there without the image. I have opened a new vispy/test-data repository that you can push test data into, and the test should attempt to download the test data from there if it is not already available. (see https://github.com/vispy/vispy/blob/master/vispy/util/_data.py#L21, perhaps that can be modified to facilitate this?) @eric, perhaps we should discuss a basic system for enabling this kind of testing throughout vispy. |
@lcampagn that should be pretty easy. We already have functions for downloading data for examples, should be straightforward to adapt that to download test data (and save to disk permanently) on demand. |
I wonder if, for testing purposes, it might be better to just use git to synchronize the complete set of test results? Then when we run |
Perhaps we should continue this discussion over at #89 . |
Strike that, #156 is closer. |
@lcampagn My bad. I will re-commit. |
@lcampagn Can this be merged? I think it would be better if I wrote all the tests in a different PR. |
Agreed.
Normally |
You could also use this if you want: $ git checkout more-visuals-clean
$ git rebase -i HEAD~2 # during this interactive rebase, delete the offending commit(s)
$ git push origin --force more-visuals-clean:more-visuals
|
Grazie! |
WIP: RectVisual, Regular polygon visuals, and more.
Request: for a future PR, can we add properties like Ellipse.radius, Polygon.border, Polygon.fill_color, etc? Ideally, changing any of these properties should call Visual.update() to inform listeners that the visual needs to be redrawn, and should delay rebuilding the geometry until Visual.draw() is called. |
Sure. I will keep it in mind. |
As a start, I have updated the EllipseVisual to support float input as radius to draw a circle. I have also replaced instances of
paint
withdraw
which wasn't done in PR #275